# Why is the space below the numerator different to the space above the denominator?

I've never noticed it before, but LaTeX puts a lot more space between the numerator and the bar than it puts between the bar and the denominator. Now maybe this makes sense for more complicated fractions than a simple 1/2, but it looks quite wrong to me. Now that I've noticed, I can't unsee it. Why is this the default behaviour of LaTeX? Can I do anything about it?

\documentclass{article}

\begin{document}
$\frac{1}{2}$
\end{document}


• try \frak{x}{y} and \frak{pq}{bd} and you should see "more uniform" spacing. (better yet, put parentheses around the numerators and denominators.) fractions are not just digits. the baselines of the numerator and denominator are set so that all one-level occupants will be visually on the same baselines in adjacent fractions. (things get a bit more complicated when sub- and superscripts are involved.) – barbara beeton Jul 26 '15 at 14:24
• @barbarabeeton, you probably mean \frac{x}{y} and frac{pq}{bd}. – Zarko Jul 27 '15 at 22:07
• @Zarko -- yes, of course. (can i use as an excuse that i'm in germany rather than at home in the us? i guess not.) thanks for the correction. – barbara beeton Jul 28 '15 at 14:01

Barbara Beeton explains in a comment that this behaviour is intended to give good-looking fractions in typesetting situations where multiple fractions are near to one another, by setting the baselines of text in the numerator and denominator such that the various baselines of nearby fractions are lined up (even though they might contain a variety of different types of mathematical text). This led me to create a macro that attempts to defeat LaTeX's automatic vertical spacing so that fractions like 1/2, consisting of simple digits, are equally spaced above and below the bar. Looking carefully at the results, it seems to make the spacing above and below the bar much closer to equal, although there is still a small difference; I don't know where the remaining difference comes from, but you would have to look very closely to see it [per comment: probably due to "overshoot" at the top of the rounded "2" glyph; likely of no concern]

(Edited to provide an improved version)

\documentclass{article}

\usepackage{pgfmath, xparse}

\newlength{\MathStrutDepth}
\newlength{\MathStrutHeight}
\settoheight{\MathStrutHeight}{$\mathstrut$}
\settodepth{\MathStrutDepth}{$\mathstrut$}

\newlength{\NumeratorDepth}
\newlength{\DenominatorHeight}
\newlength{\DepthNegativeDifference}
\newlength{\HeightPositiveDifference}
\newlength{\NumeratorBaselineCorrection}
\newlength{\DenominatorBaselineCorrection}

% Fraction with equal top-and-bottom vertical spacing around the bar.
% Suited only to simple fractions that do not appear near other fractions.
% When used alongside other fractions, numerator and denominator baselines
% might not be aligned, which might give ugly results.
\NewDocumentCommand\EVSFrac{omom}{%
\IfValueTF{#1}%
{\settodepth{\NumeratorDepth}{$#1$}}%
{\settodepth{\NumeratorDepth}{$#2$}}%
\IfValueTF{#3}%
{\settoheight{\DenominatorHeight}{$#3$}}%
{\settoheight{\DenominatorHeight}{$#4$}}%
\pgfmathsetlength%
{\DepthNegativeDifference}%
{\NumeratorDepth - \MathStrutDepth}%
\pgfmathsetlength%
{\HeightPositiveDifference}%
{\MathStrutHeight - \DenominatorHeight}%
\pgfmathsetlength%
{\NumeratorBaselineCorrection}%
{\AdditionalEVSFracVerticalSpacing + \DepthNegativeDifference + \HeightPositiveDifference}%
\pgfmathsetlength%
{\DenominatorBaselineCorrection}%
\def\Numerator{\raisebox{\NumeratorBaselineCorrection}{$#2$}}%
\def\Denominator{\raisebox{\DenominatorBaselineCorrection}{$#4$}}%
$\EVSFrac{1}{2}$