Following LaTeX displays the numerator to the left. Question: How can we align the numerator (just like the denominator is) to the center:
\frac{\pi^2}{6}
Display of the above LaTeX:
I tried this suggestion from @DavidCarlisle for another scenario - and it (as asked by the OP there) displays the denominator to the left that makes both numerator and denominator look aligned to the left. But, in my case, I would like the numerator to be aligned to the center (with the denominator).
\frac{\pi^2}{6\hfill}
Display of the above LaTeX:
Desired output:




\pi^2is wider than\pi, if you want a^2that has no width then\pi\rlap{^2}– David Carlisle Apr 29 '21 at 23:27$$\frac{\pi\rlap{^2}}{6}$$giving error: `! Missing $ inserted.\mathrlapand place the^before it. Also (off topic), use\[...\]rather than$$. (The fraction line may be too narrow.) – barbara beeton Apr 30 '21 at 02:25\[\frac{\pi^{\mathrlap{2}}}{6}\]gives error:! Undefined control sequence. <argument> \pi ^{\mathrlap{2}} l.6 \[\frac{\pi^{\mathrlap{2}}}{6} \]– nam Apr 30 '21 at 15:51\mathrlaprequiresmathtools. But the third example in @Werner's answer looks better anyhow. – barbara beeton Apr 30 '21 at 17:13mathtoolspackage, I tested your suggestion - and it worked, as well. – nam Apr 30 '21 at 20:38