
在這裡,我附加了程式碼來\\
向前查看\end
in是否\end{tabular}
在 bat 旁邊。該代碼隱藏在\noalign
.其 \\
程式碼在[
最終調用\cr
.我懷疑問題就出在這裡。
我不確定這是否適用:
- 忽略環境後面的空格和 \par,因為
\\
在表格中進行了更改以滿足 TeX\cr
(行尾回車符)。
程式碼
請參閱日誌輸出\typeout{\noexpand\reserved@a value: \meaning\reserved@a}
\documentclass{article}
\usepackage{fontspec}
\usepackage{booktabs}
\catcode`@=11 % or \catcode"0040=11 or \makeatletter to change category code of @ to 11 and temporarily to access kernel macro \@tabularcr
\let\clone@tabularcr\@tabularcr%
\def\@tabularcr{\clone@tabularcr \mymidline}%
% Using \hline and \midrule as a model, I made my own hybrid with some extra end of tabular logic
\def\mymidline{%
\noalign{\ifnum0=`}\fi\@aboverulesep=\aboverulesep\global\@belowrulesep=\belowrulesep \futurelet
\reserved@a\@mymidline}%
\def\@mymidline{\typeout{\noexpand\reserved@a value: \meaning\reserved@a}\ifx\reserved@a\end\else% <-- Here is the value test. I need \reserved@a to eventually equal \end
\vskip\@aboverulesep%
\hrule \@height \lightrulewidth%
\vskip\@belowrulesep%
\fi
\ifnum0=`{\fi}}
\catcode`@=12 % or \catcode"0040=12 or \makeatother to restore category code of @ to 12
\begin{document}
\makeatletter
\begin{tabular}{ccc}
col1 & col2 & col3 \\
\meaning\@tabularcr & col2 & col3 \\
\meaning\\ & col2 & col3 \\
col1 & col2 & col3 \\
\meaning\clone@tabularcr & col2 & col3 \\
\end{tabular}
\makeatother
\end{document}
電流輸出
所需輸出
答案1
無論如何\\
,跳過空格尋找*
你可以讓它完成工作並詢問它是否找到了\end
這僅適用於乳膠內核,儘管也tabular
可以對套件進行一些名稱更改。array
\documentclass{article}
\usepackage{booktabs}
\catcode`@=11 % or \catcode"0040=11 or \makeatletter to change category code of @ to 11 and temporarily to access kernel macro \@tabularcr
\def\addmyrule{\noalign{%
\vskip\@aboverulesep%
\hrule \@height \lightrulewidth%
\vskip\@belowrulesep}}
\let\old@xtabularcr\@xtabularcr
\def\@xtabularcr{%
\ifx\@let@token\end\else
\aftergroup\aftergroup\aftergroup
\aftergroup\aftergroup\aftergroup
\aftergroup
\addmyrule
\fi
\old@xtabularcr}
\catcode`@=12 % or \catcode"0040=12 or \makeatother to restore category code of @ to 12
\begin{document}
\makeatletter
\begin{tabular}{ccc}
col1 & col2 & col3 \\
\meaning\@tabularcr & col2 & col3 \\
\meaning\\ & col2 & col3 \\
col1 & col2 & col3 \\
\meaning\clone@tabularcr & col2 & col3 \\
\end{tabular}
\makeatother
\end{document}