1. Preheat your oven to 190°C/Gas 5.
2. Place a wide-bottomed pan over high heat. Splash in some oil. Add the onions, a pinch salt and half the pepper.
3. Coat in the oil. Lower the heat. Cook till glossy, sweet and tender, about 30 mins.
4. Whip up the pastry. Sift the flour, salt and baking powder together. Cut the butter into tiny 1-2cm cubes and add to the flour, little by little, coating the butter cubes in the flour as you add them.
5. Rub the butter into the flour until the mix is like breadcrumbs. Add enough water to bring it together into a soft, silky (not sticky) dough.
6. On a floured surface, pat the dough into a rectangle. Roll until 1-2cm thick. Fold in the sides like your folding a letter. Rotate the rectangle 90degrees. Roll out again. Repeat this process five times, ending with a letter-folded piece of dough. Wrap up in a clean tea towel. Refrigerate 30mins.
7. When the onions are almost done, turn the heat up a little. Add bay, if using, the red wine and balsamic. Let the onions guzzle it up, and get a sticky glaze. Fold in the soy and 1 tsp butter. Taste. Season. Don’t overdo the salt though, as you’ll be adding salty cheese later.
8. Lightly butter a small, shallow baking dish or frying pan (about 20cm diameter). Scatter onions in. Crumble over 100g of the cheese.
9. On a floured surface, roll the pastry out. Cut into a circle the size of the pan. Lay on top of the cheese and onions. Tuck the edges in. Gently press down.
10. Bake for 40 mins or till golden. Carefully turn out onto a serving plate. If the sides of the pastry are pale, cook a little longer. Finish tart off by dotting over the remaining cheese, a dusting of rosemary and walnuts.