3

For many years I've been using the subalign environment described in Align in Substack. However, with a fully updated version of TexLive 2023 I've recently observed a negative interaction with unicode-math. Consider the following MWE:

\documentclass{article}

\usepackage{fontspec} \usepackage{unicode-math} \usepackage{amsmath}

\makeatletter \newcommand{\subalign}[1]{% \vcenter{% \Let@ \restore@math@cr \default@tag \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \scriptfont\tw@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \ialign{\hfil$\m@th\scriptstyle##$&$\m@th\scriptstyle{}##$\hfil\crcr #1\crcr }% }% } \makeatother

\begin{document} [ \sum_{\substack{n=1\n\neq i}}^N \sum_{\subalign{n&=1\n&\neq i}}^N \sum_{\subalign{uvw&=1\n&\neq ijk}}^N ] \end{document}

which renders as:

MWE

with there being a large amount of extra vertical spacing in the subalign environment but not in the substack environment. Commenting the unicode-math use resolve these issues.

1 Answers1

3

LuaTeX has a completely different method for math font parameters.

Here's a fixed version that produces (essentially) the same result with pdflatex, xelatex and lualatex.

\documentclass{article}
\usepackage{iftex}

\iftutex % here just to be able to compare pdflatex and lualatex \usepackage{fontspec} \usepackage{unicode-math} \fi \usepackage{amsmath}

\makeatletter \newcommand{\subalign}[1]{% \vcenter{% \Let@ \restore@math@cr \default@tag \ifluatex \baselineskip\Umathstacknumup\scriptstyle \advance\baselineskip\Umathfractiondenomdown\scriptstyle \lineskip=3\Umathfractiondenomvgap\scriptstyle \else \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \scriptfont\tw@ \ifxetex\baselineskip=0.724\baselineskip\fi \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \fi \lineskiplimit\lineskip \ialign{\hfil$\m@th\scriptstyle##$&$\m@th\scriptstyle{}##$\hfil\crcr #1\crcr }% }% } \makeatother

\begin{document} [ \sum_{\substack{n=1\n\neq i}}^N \sum_{\subalign{n&=1\n&\neq i}}^N \sum_{\subalign{uvw&=1\n&\neq ijk}}^N ] \end{document}

output with pdflatex

enter image description here

output with lualatex

enter image description here

egreg
  • 1,121,712