Step 1Heat the oven to 350 degrees. Grease a 15-by-11-inch baking dish with butter.
Step 2In a medium bowl, combine the Parmesan and Gruyere cheeses.
Step 3Line the bottom of the baking dish with one-half of the sliced potatoes, overlapping the slices and forming rows to make a single layer.
Step 4Season the potatoes with three-fourths teaspoon salt and one-half teaspoon pepper, or to taste. Sprinkle over the garlic.
Step 5Add the artichoke hearts, arranging them in a single layer over the potatoes. Scatter one-third of the grated cheese mixture over the artichokes, then drizzle over one-half of the heavy cream.
Step 6Arrange the remaining potatoes in a single, overlapping layer over the cheese. Season with one-half teaspoon salt and one-fourth teaspoon pepper. Drizzle over the remaining cream, then sprinkle over the remaining cheese.
Step 7Butter the underside of a piece of foil to keep the cheese from sticking, then cover the baking dish. Bake the gratin until the potatoes are softened and almost completely cooked, 45 minutes to an hour (a knife should easily pierce the potatoes). Uncover the gratin and continue to bake until the cheese is melted and is golden brown, 15 to 20 minutes. Remove from the oven and cool slightly on a rack before serving.