关于 longtable 包的两个问题

关于 longtable 包的两个问题
  1. 为什么在 \longtable 包中,行尾使用两个命令 - @tabularcr 和 \lt@tabularcr。因为对于我的包,\ 命令应该一行使用一次。是的,我无法重新定义 \lt@tabularcr 命令,只剩下 @tabularcr 命令,但了解为什么换行需要两个命令调用对我来说非常有趣。2. 如何为 longtable 重新定义 \caption 命令。当我尝试执行此操作时,出现错误:

    ! Extra alignment tab has been changed to \cr.
    

为什么会这样?非常感谢大家的帮助。

\documentclass{article}
\usepackage{longtable}
\ExplSyntaxOn
\makeatletter
\cs_new_eq:NN\LTX@LT@tabularcr \LT@tabularcr
\cs_new_eq:NN\original@caption \caption
\cs_new_eq:NN\LTX@tabularcr \@tabularcr
\RenewDocumentCommand \LT@tabularcr{s o}{
\use:x{
\exp_not:N\LTX@LT@tabularcr
\IfBooleanT {#1} { * } \IfValueT {#2} { [#2]}
}
\message{new~line}
}
\RenewDocumentCommand \@tabularcr{s o}{
\use:x{
\exp_not:N\LTX@tabularcr
\IfBooleanT {#1} { * } \IfValueT {#2} { [#2]}
}
\message{new~tabularcr~line}
}
\RenewDocumentCommand\caption{s o m}{
\message{new~caption}
\use:x{
\exp_not:N\orig@caption
\IfBooleanT {#1} { * } \IfValueT {#2} { [#2]}
}
}
\makeatother
\ExplSyntaxOff
\pagestyle{empty}
\begin{document}
\begin{longtable}{ccc}
\caption{test of long tables}
a&b&c\\
d&e&f\\
g&h&i
\end{longtable}
\end{document}

相关内容