コード

コード

ここで、 がbat の次に上がっているかどうかを先読みするコードを に追加します。このコードは 内に隠されています。に\\は、を最終 的に呼び出す前に、star を検索し、次に を検索するコードがあります。ここに問題があると思われます。\end\end{tabular}\noalign\\[\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

これは LaTeX カーネルに対してのみ機能しますが、名前を少し変更すればパッケージ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}

関連情報