4

\\*[...] seems not to allow for plus/minus stretch: in a longtable where \\*[3ex] works, \\*[3ex plus 2ex minus 1ex] causes the error

! Missing = inserted for \ifdim.
<to be read again> 
                   p

(1) Why the error?

(2) Is this a generic problem, or special to longtable?

(3) How to work around?

(4) Anything special if \\*[...] is followed by \noalign{\penalty-200}?

1 Answer 1

6

It doesn't work in a tabular environment (no need for longtable). It seems like in a tabular environment the optional argument is evaluated using a \ifdim construct. Try the following to see that:

\ifdim 1ex plus 1pt > 1ex
  yeah
\fi

A workaround could be the following:

\documentclass[]{article}


\begin{document}
\begin{tabular}[]{ll}
  foo\\\noalign{\vspace*{2ex plus 1pt minus 2pt}}
bar
\end{tabular}
\end{document}

But this will break vertical rules. Also, as mentioned in the comments, this will not result in any glue in most cases as tables are normally boxed, it just solves the error message. An exception to this is the tabularht package.

11
  • As I have no vertical rules, this workaround will probably suffice. Putting the vspace inside the noalign is the clue I was missing, many thanks! Does it matter whether the penalty goes before or after the vspace?
    – Joachim W
    Commented Nov 17, 2017 at 8:09
  • Does this really result in a stretchable/shinkable space? I've tested with \documentclass[twoside]{article} \usepackage{mwe} \begin{document} \begin{tabular}[]{ll} foo\\\noalign{\vspace*{2ex plus 5cm minus 2pt}} bar \end{tabular}\par \blindtext[3]\par \rule{.5\textwidth}{.5\textheight} \end{document} and the only stretched space is that of \par. Commented Nov 17, 2017 at 8:46
  • 1
    @Schweinebacke A tabular is boxed, so stretch and shrink are irrelevant. The case is different for a longtable.
    – egreg
    Commented Nov 17, 2017 at 8:49
  • @egreg \documentclass[twoside]{article} \usepackage{mwe} \usepackage{longtable} \begin{document} \begin{longtable}{ll} foo\\ \noalign{\vspace*{2ex plus 5cm minus 2pt}} bar \end{longtable} \blindtext[3]\par \rule{.5\textwidth}{.5\textheight} \end{document} does also not result in a stretched space. Commented Nov 17, 2017 at 8:51
  • 1
    Package tabuarlt provides tables that must fit a given height and allows vertical glues inside the table. Commented Mar 3, 2018 at 11:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .