In most OECD countries, girls outperform boys in all subjects except mathematics. Usually, only test scores are utilised as a measure of mathematical skills. In this paper, we argue that in order to measure children's capability in mathematics we need to include some indicators of the attitudes of children towards the subject. This is particularly important when we analyse gender gaps, because attitudes towards mathematics differ by gender. We first describe the differences by gender both in test scores and attitudes utilising a model including school fixed effects. Next, we estimate a quantile regression in order to analyse how the gender gap varies across the distribution of the attitudes. Lastly, in addition to the test scores in mathematics, we use indicators of attitudes towards maths to estimate a Structural Equation Model, which takes into account that maths capability is a latent construct of which we only observe some indicators (test scores and attitudes). We use data from the Italian National Test (Invalsi) for year 5 and year 10 in 2014 and 2015. Results confirm that when we measure mathematics capability including attitudes in addition to test scores, the gap between boys and girls is even wider with respect to the analysis of test scores alone, and therefore educational policies aimed at reducing the gender gap in mathematics should address both attitudes and test scores.