Sift the flour and xanthan gum into a food processor bowl.
Blend the margarine or butter into the flour until the mixture resembles breadcrumbs.
Add water and blend until the dough forms a ball.
Remove the dough, wrap it, and chill for 30 minutes.
Preheat the oven to 180°C.
Roll the pastry out on a floured board and line a 20-25cm loose-bottomed flan tin.
Line the pastry with paper and baking beans.
Bake for 15 minutes, remove weights and paper, then bake for another 10 minutes.
Gradually whisk the milk into the cornflour and heat until thickened.
Stir 60g of broken chocolate into the hot cornflour mixture until melted.
Stir in the liqueur or brandy.
Arrange peeled, cored, and quartered pears in the cooled pastry case.
Spoon the chocolate sauce over the pears and allow to cool.
Grate the remaining 20g of chocolate over the top before serving.