# [Tex/LaTex] “Undefined control sequence” on left parenthesis after midrule in longtable

booktabslongtable

With this file:

\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
{
\begin{longtable}{p{.3\textwidth}p{.5\textwidth}}
\midrule
label & value \\
\midrule
(2) label & value \\
\midrule
\end{longtable}
}
\end{document}


running pdflatex, I get:

! Undefined control sequence.
<argument> ...al \expandafter \let \cmrsideswitch
\@tempa \fi \fi
l.10 (2)
label & value \\


There seems to be something about the midrule that makes a left parenthesis invalid. But with tabular instead of longtable, there is no such problem.

You are running into the same problem as in "[" as first character in table row.

booktabs defines the rules to take an optional argument in the form [..] or (..). The use of (2) on the row immediately following \midrule is being interpreted as an optional argument, yet it doesn't match the definition that's expected with that type of optional argument.

To avoid this, use

\midrule\relax


\documentclass{article}
\usepackage{longtable,booktabs}
\begin{document}
\begin{longtable}{p{.3\textwidth}p{.5\textwidth}}
\midrule
label & value \\
\midrule\relax
(2) label & value \\
\midrule
\end{longtable}
\end{document}