[luatex] Poor Spacing in the \frac Environment

Ulrik Vieth ulrik.vieth at arcor.de
Mon Jan 19 01:58:41 CET 2015

Not sure if my previous reply was clearly enough.

I am not convinced if anything is really wrong. The behaviour can be 
understood in the way the different spacing mechanisms play out.

The position of the numerator is presumably chosen in such a way,
so that descenders (e.g. g, \gamma) and subscripts (e.g. x_{0})
can be placed without causing any shift-up relative to the baseline.
As a result, there will be a significant gap below L in the numerator.

The position of the denominator, however, is chosen in such way,
so that ascenders just fit tightly below the fraction rule,
whereas superscripts (e.g. x^{2}) may cause an extra shift-down.
As a result, there will be a smaller gap above T in the denominator.

One might argue that the position of the denominator could be
shifted down, so that the gaps below L and above T should be equal.
This needs to be carefully balanced with other requirements,
e.g. that the gap below x_{0} and above x^{2} should be equal.

In any case, this requires careful testing with a lot of examples
as part of the font development, not just a few particular cases.

Since TeX Gyre math is not frozen yet, it might well be possible
to apply some improvements, if there are good reasons to do so.

It might be helpful to collect interesting examples as test cases
such as this one.

Ulrik Vieth

On 18.01.2015 19:17, Emil E wrote:
> Hello,
> I'm typesetting some simple math problems/solutions using LuaLaTeX,
> and I'm having trouble with the spacing between the numerator and
> division bar in \frac environments.
> I've attached a MWE below, along with an image showing the my
> output of the MWE.
> I apologize in advance if my image links don't follow the proper
> etiquette for this mailing list.
> \documentclass[11pt]{article}
> \usepackage{amsmath,amsthm,amssymb,amsfonts}
> \usepackage{fontspec}
> \setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
> \usepackage{unicode-math}
> \setmathfont{TeX Gyre Pagella Math}
> \begin{document}
> $$
> \frac{xxxxxxLLLLLL}{xxxxxxTTTTTT} \frac{2(x-1)-(x^{2}-1)}{(x^{2}-1)(x-1)}
> $$
> \end{document}
> Here is a screenshot of the PDF output on my system.
> Note how the spacing between the bottom of the L and the division bar
> is about 2-3x larger than the spacing between the top of the T and
> division bar.
> https://i.imgur.com/RWeuSVA.png
> The bizarre spacing occurs regardless of font, or the packages
> fontspec, unicode-math, or the AMS packages.
> This seems to indicate that it's a problem with LuaLaTeX itself.
> I've been able to fix the fraction spacing by defining a new \frac
> environment that manually adjusts the spacing of the numerator,
> but that's a "hacky" solution that I don't like using.
> PDFLaTeX shows proper spacing using the same math code, however
> I'd like to stay with LuaLaTeX instead of reverting to PDFLaTeX.
> Is there any way to fix this spacing?
> Below are some details of my set-up:
> Arch Linux x64
> Running TeXLive 2014, installed manually and up-to-date
> LuaLaTeX version is beta-0.79.1 (TeX Live 2014) (rev 4971)
> Compiling through TeXStudio 2.8.8

More information about the luatex mailing list