TeX - LaTeX Asked by nam on May 7, 2021
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}{6hfill}
Display of the above LaTeX:
Desired output:
Here are some options:
documentclass{article}
begin{document}
[
frac{pi^2}{6} quad % Default
frac{hphantom{^2}pi^2}{6} quad % Symmetric exponent around pi
frac{!hphantom{^2}pi^2!}{6} % Reduced horizontal width of numerator
]
end{document}
Correct answer by Werner on May 7, 2021
To get a zero-width ², you'll want to define
newcommandzwe[1]{rlap{${}^{#1}$}}
[
frac{pizwe{2}}{6}
]
although this will have the superscript extending beyond the fraction bar. An alternative definition for zwe
would be to take both the base and exponent as arguments and use an hphantom
on the left to balance the superscript on the right:
newcommandzwe[2]{hphantom{{}^{#2}}#1^{#2}}
[
frac{zwe{pi}{2}}{6}
]
Answered by Don Hosek on May 7, 2021
Use !
at the end of the numerator. Sometimes we need to correct the math spacing to get visually better results. For example:
{pi^2! over 6}, quad Gamma!_2.
Answered by wipet on May 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP