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?

  • 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....) – David Carlisle Nov 19 '16 at 8:15
  • Can you show a context where this would be useful? – egreg Nov 19 '16 at 10:13
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

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.