[luatex] Poor Spacing in the \frac Environment

Emil E e.ekmecic at gmail.com
Mon Jan 19 05:52:39 CET 2015

[I'm having trouble replying directly to Ulrik, so I apologize for posting
this reply directly to the mailing list, or wherever it ends up.]

Thank you for the detailed post Ulrik.

Admittedly, the specifics of TeX and LuaLaTeX font metrics/configurations
are outside my knowledge. However, I did appreciate the TUGboat
article and the paper you linked. There was quite a bit of
interesting information within, even though I didn't understand it all :).

I've tested out almost every combination of font/package/TeX Engine.
Below is the link to an image I made from the PDF outputs
of each combination. I'll also post a MWE of the math parts
below for reproducibility.

https://i.imgur.com/cqWQ0uk.png

The image shows that contrary to what I said in my first post,
this spacing occurs in PDFLaTeX as well as LuaLaTeX. It really seems
quite bizarre since I never recall seeing this "issue" back when I
used PDFLaTeX.

However, it seems that TeX is rendering each numerator as if it has
a descender. This gives the irregular spacing effect, and is visible
in the simple numerical fractions like 1/2, or the fractions where
there are no descenders, such as x/x, or \alpha over \alpha.

On numerators with descenders, the increased spacing is correct and
looks fine, however when extended to "normal" numerators, it looks
poorly spaced. I haven't got a clue as to why this behaviour happens
for _all_ numerators.

I've also noted that LuaLaTeX is making the correct adjustments for
superscripted denominators (ex. a denominator of \delta^{2}), but
this _only_ occurs on the LuaLaTeX engine with OTF TeX Gyre Pagella
fonts (it does not happen on LuaLaTeX Computer Modern defaults,
or in PDFLaTeX).
This can be seen in the top right section of the linked image,
on the third and fourth fractions from the right.

If anyone has some sort of simple remedy to this, please let me know!
For now, I suppose that I will have to introduce a patched \frac
environment, or I'll just have to deal with the spacing, as ugly
as it is.
I hope that my comparison has at least helped someone.

MWE for LuaLaTeX + fontspec + unicode-math + TeX Gyre Pagella

%%%%%%%%%%%%%%%%%%
\documentclass[11pt]{article}

\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{fontspec} % remove if testing PDFLaTeX
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} % remove if testing PDFLaTeX
\usepackage{unicode-math} % remove if testing PDFLaTeX
\setmathfont{TeX Gyre Pagella Math} % remove if testing PDFLaTeX, or
testing plain LuaLaTeX
%\usepackage{mathpazo} % add only if using PDFLaTeX, testing Palatino
variants
\begin{document}
Lua\LaTeX + fontspec, TeX Gyre Pagella, unicode-math.
$$\frac{xL}{xT} \; \frac{1}{2} \; \frac{3}{4} \; \frac{x}{x} \; \frac{\alpha}{\beta} \; \frac{\beta}{\beta} \; \frac{\beta}{\alpha} \; \frac{\alpha}{\alpha} \; \frac{\gamma}{\delta} \; \frac{\gamma_{1}}{\delta^{2}} \; \frac{\delta}{\gamma} \; \frac{\delta_{1}}{\gamma^{2}}$$
\end{document}
%%%%%%%%%%%%%%%%%%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20150118/473a2359/attachment-0001.html>