I'm trying to patch \\ in tabular enviros using \@tabularcr as I've read that it uses it internally, and I'd like to simply add \midrule on each row (my real-life use is a bit more complex, but simplified here for MWE sake). I've tried \apptocmd as well but got a failure. Please see below. I don't get a failure for trying to patch it this way, but the midrules do not print.
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
%%% patching does not work
\makeatletter
\let\old@tabularcr@tabularcr
\def@tabularcr{\old@tabularcr\midrule}
\makeatother
\begin{document}
\begin{tabular}{l}
%%% patching in here doesn't work either
\makeatletter
\let\old@tabularcr@tabularcr
\def@tabularcr{\old@tabularcr\midrule}
\makeatother
Hello\
World\
\end{tabular}
\end{document}
\@arraycris needed. – likethevegetable Nov 27 '22 at 18:27\@xarraycrin the linked question's answers will not lead to correct results as well (it will kill the optional argument of\\). Correct would be to patch both\@xargarraycrand\@yargarraycr. – Skillmon Nov 27 '22 at 18:44tabularandarrayin the linked question (it does more than just patching\\but I guess you could take a look). – Skillmon Nov 28 '22 at 19:57