# longtable, \multicolumn and \boldmath

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?

• 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....) Nov 19, 2016 at 8:15
• Can you show a context where this would be useful? Nov 19, 2016 at 10:13

\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}