3

The following code does compile

\documentclass{article}

\usepackage{longtable}


\begin{document}

\begin{longtable}{c}
  \noalign{\bfseries $r$ test}
  \multicolumn{1}{c}{Line 1}
\end{longtable}

\end{document}

but this one does not

\documentclass{article}

\usepackage{longtable}


\begin{document}

\begin{longtable}{c}
  \noalign{\bfseries\boldmath $r$ test}
  \multicolumn{1}{c}{Line 1}
\end{longtable}

\end{document}

I got the error message misplaced \omit. I have to double the braces:

\noalign{{\bfseries\boldmath $r$ test}}

Any ideas why?

2
  • 1
    note that even in the non-error case the markup is wrong latex is not set up to typeset a paragraph of text in \noalign you should always use a nested parbox or minipage or at least \@parboxrestore (\par is defined to do nothing, baseline spacing is zero....) Commented Nov 19, 2016 at 8:15
  • Can you show a context where this would be useful?
    – egreg
    Commented Nov 19, 2016 at 10:13

1 Answer 1

5

\boldmath uses \mathversion that puts stuff after the current group via \aftergroup. Therefore, the macro \glb@settings is leaking out of \noalign, disturbing the table.

A group helps:

\documentclass{article}
\usepackage{longtable}

\begin{document}

\begin{longtable}{c}
  \noalign{{\bfseries\boldmath $r$ test}}
  \multicolumn{1}{c}{Line 1}
\end{longtable}

\end{document}

Result

You must log in to answer this question.

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