[Tex/LaTex] How to vertically center the fraction line

fontsfractionsmath-modespacingvertical alignment

I feel a bit weird because this is a really simple issue that apparently nobody has brought up so far but I find that very simple fractions produce output that looks vertically unbalanced. The following example uses Iwona as math font because there it's really obvious – with the gap between numerator and fraction line being almost 1.5 times as large as the space between denominator and the line.

\documentclass{standalone}
\usepackage[math]{iwona} % Iwona as math font
\begin{document}
$\frac{1}{2}\frac{1}{N}$
\end{document}

1/2 1/N in Iwona Math

It's not completely a font issue though. I measured Computer Modern and the imbalance factor there is about 1.3, too.

1/2 1/N in Computer Modern

I find this visually unpleasant and somewhat surprising – given how much LaTeX is hailed for its math typesetting, there is probably a reason for this imbalance. Either way, is there an easy way to fix this feature?

Best Answer

The default settings don't pack the numerator and denoimnator as close to the line as possible which gives a more consistent layout. In 1/2 the gap from the 1 to the bar is, as you say larger than the gap from the bar to the 2, but in 1/x the larger gap is below the bar, however 1/2 and 1/x are aligned consistently.

However you can change the font params to get a tighter spacing:

enter image description here

\documentclass{article}
\usepackage[math]{iwona} % Iwona as math font
\begin{document}
$a$
\typeout{\the\fontdimen9\textfont2}

$1+\frac{1}{2}+ \frac{1}{x}+\frac{1}{N}+\frac{1}{N^2} + \frac{1}{(a+b)}$


\fontdimen9\textfont2=2pt

\typeout{\the\fontdimen9\textfont2}
$1+\frac{1}{2}+ \frac{1}{x}+\frac{1}{N}+\frac{1}{N^2} + \frac{1}{(a+b)}$


\end{document}

See This answer for a list of font parameters.

Related Question