In a large project, I reuse with \input tabular rows stored as child files. This has worked perfectly in the past, but in my texlive 2021 this fail when a booktabs rule follow the input. MWE:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ccc}
\toprule
1 & 2 & 3\\
\midrule
\input{foo}
\bottomrule % This causes the error
\end{tabular}
\end{document}
Where foo.tex is simply a & b & c \\.
It fails also ending the tabular rows with \tabularnewline or \cr. The funny point is that \bottomrule works fine inside foo.tex (a & b & c \\\bottomrule) but this is not good a solution because foo.tex could be needed in another table, and not necessarily as the last row. AFAIK, unlike \include, \input add strictly the content of the file, so it should be irrelevant if \bootomrule is inside or outside the child file, but is it not. I wonder if there is a better fix that \input{foot}\\[-12pt]\bottomrule.

catchfileto store the contents offoo.texinside a macro that you can then use (\CatchFileDef{\foo}{foo.tex}{}). – Werner Aug 23 '21 at 22:34\ExplSyntaxOn \cs_new:Npn \expandableinput #1 { \use:c { @@input } { \file_full_name:n {#1} } } \AddToHook{env/tabular/begin} { \cs_set_eq:NN \input \expandableinput } \ExplSyntaxOff(similar to this). Completely overriding\inputmay break other things down the road. The above will only change\inputin atabularenvironment. – Phelype Oleinik Aug 24 '21 at 00:03