Cooking the onions for a very long time over low heat mellows their flavor. Don’t stir them too often or they won’t caramelize. This soup tastes best when made with homemade beef stock.
4 tablespoons unsalted butter
2 teaspoons chopped fresh thyme or 3/4 teaspoon dried thyme
Melt butter in a large Dutch oven or heavy pot on medium-low heat. Add onions. Spread them out in as thin a layer as possible. Sprinkle with sugar, and cook, stirring just as needed to keep onions from sticking, until they are melting and soft, golden brown, and beginning to caramelize, about 1 hour.
Sprinkle flour over onions, and stir to coat. Add sherry, stock, and thyme, and bring to a simmer. Cook, partially covered, for about 30 minutes, to allow the flavors to combine. Season with salt and pepper to taste.
Meanwhile, lightly toast bread under a broiler; set aside. Ladle hot soup into six ovenproof bowls. Arrange the bowls on a baking pan. Place 1 or 2 slices of toasted bread over each bowl of soup. Sprinkle 1/2 cup grated cheese over bread in each bowl, and place under the broiler until cheese is melted and crusty brown around the edges. Watch carefully that bread doesn’t burn. Serve immediately.