A perfect gratin should be crispy on top and moist and soft underneath. To get the right texture, be careful not to crisp the top too early - you'll have to take it out of the oven before the inside is cooked through.
Start on a low heat (130°C) and then 10 minutes before the end, turn the heat up or turn the grill on to brown the surface. This way your gratin will be cooked through and nicely browned on top.
Add a glass of vegetable stock to aubergine or pepper-based gratins before you put them in the oven.