# luatex has different subscript distances

I wanted to write some scientific text in TeX Gyre Schola, because I like its increased weight compared to Latin Modern Roman.

Unfortunately, I noticed that the spacing between a variable and its upright subscript looks extremely odd. E.g. for $v_{\mathrm{eff}}$, the distance between v and e is too large.

To investigate further, I changed the font back to Latin Modern Roman and compared the output between pdflatex and luatex and noticed that the subscript from luatex is a bit further away than its pdflatex counterpart.

pdflatex:

luatex:

So what's the problem? Is the luatex font system simply 'bad' or did I use the wrong syntax? And maybe, is there a simple fix?

\documentclass[paper=a4]{article}

\usepackage{iftex}

% math
\usepackage{amsmath}
\ifPDFTeX
\usepackage{amsfonts}
\usepackage{amssymb}
\fi

% font
\ifPDFTeX
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\fi
\ifLuaTeX
\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
%\setmainfont{TexGyre Schola}
%\setmathfont{TexGyre Schola Math}
\fi
\begin{document}
\begin{align}
v_{\mathrm{eff}}
\end{align}
\end{document}

• Unrelated note: The article class has no option paper=a4, and tells you this in the log: LaTeX Warning: Unused global option(s): [paper=a4]. You want \documentclass[a4paper]{article}. – Torbjørn T. May 4 '16 at 13:25
• With LuaLaTeX the subscript is a bit lower, that's all. – egreg May 4 '16 at 13:47

Care needs to be taken when identifying the source/cause of the difference in output. For sure,

\documentclass{standalone}
\begin{document}
$v_{\mathrm{eff}}$
\end{document}


can be compiled with both pdfLaTeX and LuaLaTeX. Importantly, it produces identical results with respect of the relative position of the subscript term, irrespective of whether pdfLaTeX or LuaLaTeX is used. (I tested this on a system running either MacTeX2015/LuaTeX0.8 or TeXLive2016-prerelease/LuaTeX0.95.)

The cause of the difference you have discovered appears to be the unicode-math package, which is loaded in your example code (but not in the mini-example above). Specifically, it appears to be the case that LuaTeX typesets your formula using a "non-cramped" style for the subscript term if the unicode-math package is loaded, whereas LuaTeX uses the "cramped" style for the subscript (as does pdfLaTeX) if unicode-math is not loaded. I have no idea as to why unicode-math has this effect. I also have no idea as to whether or not this effect is intentional.

• I'm not sure the problem is unicode-math; when typesetting without it, LuaTeX uses the legacy setup with the traditional fonts and their metrics; with unicode-math different rules are used. – egreg May 4 '16 at 17:44
• @egreg - Fair enough. Well, I was careful not to claim that LuaLaTeX's behavior (with regard to the depth of the subscript position) when unicode-math is loaded constitutes a "problem". :-) I've done some more tests with the OP's example code; it looks like the difference in the relative position of the subscript (between pdfTeX and LuaTeX) occurs in display-style, text-style, and script-style math mode, but not in scriptscript-style mode. No idea why. – Mico May 4 '16 at 18:05