Combination of booktabs and ltablex fails if cell starts with bracket

My document contains several tables, one of which spans several pages. Following this question, I tried to use the ltablex package for that. However, my document doesn't compile anymore if I use that package instead of tabularx.

I was able to isolate the problem. It seems that there's an issue with using the rulers from booktabs in a tabularx environment provided by the ltablex package if the next cell starts with a bracket. Here is a minimal working example that illustrates this:

\documentclass{article}

\usepackage{blindtext}
\usepackage{ltablex}
\usepackage{booktabs}

\begin{document}

\begin{table}[tbp]
\begin{tabularx}{\linewidth}{Xr}
\toprule
Label       & Estimate \\
\midrule
% What follows seems to be the offending line. If I remove
% the brackets around Intercept, the file is compiled
% without an error.
(Intercept) & 10.0 \\
\bottomrule
\end{tabularx}
\end{table}

% this is a very big table that spans several pages, which is
% why I want to use the ltablex package:
\begin{tabularx}{\linewidth}{Xr}
\toprule
Statement  & Number \\
\midrule
\blindtext & 1 \\
\blindtext & 2 \\
\blindtext & 3 \\
\blindtext & 4 \\
\blindtext & 5 \\
\bottomrule
\end{tabularx}

\end{document}


Compiling this produces seven errors, most of which are Undefined control sequence \end{tabularx} errors in line 19, i.e. the \end{tabularx} command at the end of the first tabularx environment. Here's the output for the first error (I can post the whole error log if needed):

! Undefined control sequence.
<argument> ...al \expandafter \let \cmrsideswitch
\@tempa \fi \fi
l.19             \end{tabularx}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


I've found some ways of making the error disappear, but at the cost that the document doesn't contain what I want:

• Remove the brackets around (Intercept) in line 17
• Remove the \midrule command in line 13
• Use tabularx instead of ltablex

So, I have two questions.

1. Is this a bug in one of the packages, or is the bug in my document?
2. How can I fix this without sacrificing the \midrule, the brackets, or the multi-page table?
• Perhaps the ltxtable package provides a by-pass here – user31729 Apr 11 '17 at 10:37
• It's not clear why, with ltablex, \midrule starts looking forward for a (. Anyway, adding \relax in front of (Intercept)` solves the issue. – egreg Apr 11 '17 at 10:41