5

When I use a parbox or minipage inside an align environment (from the amsmath package) while using the amsart document class, the line spacing within the parbox is irregular. The following example shows how, inside the parbox or minipage, two lines are set closer together if the line above contains letters with descenders and the line below contains letters with ascenders. The issue does not arise inside equation environments, and does not arise if I change the document class to article.

\documentclass{amsart}

\usepackage{amsmath}

\begin{document}

Align, parbox:
\begin{align}
\parbox{16mm}{aaaa aaaa aaaa aaaa aaaa aaaa}\qquad
\parbox{16mm}{aaaa aaap aaaa aaap aaaa aaaa}\qquad
\parbox{16mm}{aaaa aaaa aaaa aaat aaaa aaat}\qquad
\parbox{16mm}{aaaa aaap aaaa aaat aaaa aaap}\qquad
\parbox{16mm}{aaaa aaap aaap aaat aaat aaap}
\end{align}

Equation, parbox:
\begin{equation}
\parbox{16mm}{aaaa aaaa aaaa aaaa aaaa aaaa}\qquad
\parbox{16mm}{aaaa aaap aaaa aaap aaaa aaaa}\qquad
\parbox{16mm}{aaaa aaaa aaaa aaat aaaa aaat}\qquad
\parbox{16mm}{aaaa aaap aaaa aaat aaaa aaap}\qquad
\parbox{16mm}{aaaa aaap aaap aaat aaat aaap}
\end{equation}

Align, minipage:
\begin{align}
\begin{minipage}[c]{16mm}aaaa aaaa aaaa aaaa aaaa aaaa\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaaa aaap aaaa aaaa\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaaa aaaa aaat aaaa aaat\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaaa aaat aaaa aaap\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaap aaat aaat aaap\end{minipage}
\end{align}

Equation, minipage:
\begin{equation}
\begin{minipage}[c]{16mm}aaaa aaaa aaaa aaaa aaaa aaaa\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaaa aaap aaaa aaaa\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaaa aaaa aaat aaaa aaat\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaaa aaat aaaa aaap\end{minipage}\qquad
\begin{minipage}[c]{16mm}aaaa aaap aaap aaat aaat aaap\end{minipage}
\end{equation}

\end{document}

Here is the output:

Sample output showing line spacing issues

How do I ensure consistent line spacing in the parbox or minipage in this context? I assume I am using them incorrectly but that coincidentally the problem does not show up when using the article class or equation environment.

(I know it is simple enough to hack around this issue by adding \strut in appropriate places, but I would prefer to understand the fundamental problem.)

7
  • That's ... interesting ... +1 Mar 22 '17 at 23:34
  • Mostly you have problems with descenders on the last row. Try starting and ending with a \strut. Mar 23 '17 at 4:12
  • @JohnKormylo a strut will make them all bad! It is the lines with descenders or letters higher than x-height that have bad spacing, so struts don't really help here. Mar 23 '17 at 7:46
  • 1
    We have decided to fix this in the next latex release. Mar 30 '17 at 7:54
  • 1
    Fixed on 2017-03-29 in ltxboxes.dtx github.com/latex3/latex2e/commit/…
    – jaspast
    Mar 26 '19 at 21:50
4

enter image description here

\documentclass{amsart}


\usepackage{amsmath}

\begin{document}

Align, parbox:
\begin{align}
\parbox{16mm}{1aaa aaaa aaaa aaaa aaaa aaaa}
\parbox{16mm}{2aaa aaap aaap aaat aaat aaap}
\end{align}

\makeatletter
\g@addto@macro\@parboxrestore{\lineskiplimit\normallineskip}
\makeatother
Align, parbox:
\begin{align}
\parbox{16mm}{1aaa aaaa aaaa aaaa aaaa aaaa}
\parbox{16mm}{2aaa aaap aaap aaat aaat aaap}
\end{align}


\end{document}

Inside parboxes, minipages etc LaTeX executes \@parboxrestore to normalise settings including \baselineskip and \lineskip which control baseline spacing however (which is arguably a bug, although it's always been that way) it does not reset \lineskiplimit which is the cutoff point when TeX switches to using \lineskip. in amsart this has a relatively high value of 4pt inside align which makes sense to keep displayed equation rows apart but the behaviour when \lineskip is set back to \normalineskip (which is 1pt) is never useful, \lineskiplimit should never be larger than \lineskip or, as you observe making the text in the line taller can result in closer line spacing.

Note that the issue is also potentially there in article not just amsart. If you add

\typeout{%
\the\baselineskip,
\the\lineskip,
\the\lineskiplimit
}

You will see

12.0pt, 1.0pt, 4.0pt

in amsart and

and

12.0pt, 1.0pt, 3.0pt

in article.

So the issue of \lineskiplimit being too large applies in both cases, it is just a little bit worse in amsart so even the modest extra height/depth of lowercase t and p are enough to trigger the effect.

\@parboxrestore should reset \lineskiplimit to \normallineskiplimit eg by running \normalbaselines but compatibility concerns may make it difficult to change this....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.