Preheat the oven to 180°C. Put the tomatoes on a baking tray and gently toss with ½ tablespoon of the olive oil, the garlic and a little salt and pepper. Cook the tomatoes for 12–15 minutes, or until just softened.
Meanwhile, cook the pasta in a large saucepan of lightly salted boiling water for 10–12 minutes, or according to the packet instructions, until al dente. Drain well.
At the same time, heat the remaining oil in a frying pan over a moderate heat. Add the onions and cook, stirring occasionally, for 8–10 minutes, or until golden. If the onions are browning too quickly, reduce the heat slightly, especially as it reaches the end of cooking time. Add the balsamic vinegar and sugar, and stir for 1 minute.
Toss the pasta, roasted tomatoes, caramelised onions, basil leaves, parmesan and pine nuts in a large bowl. Season to taste. The pasta can be eaten straight away, but is just as good at room temperature.