我想tabstackengine
在环境中使用该包tcblisting
,但收到很多错误消息。我该如何操作?
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine}
\usepackage{listings}
\usepackage[most]{tcolorbox}
\stackMath
\setstacktabbedgap{0.5em}
\setstackTAB{ }
\begin{document}
\begin{tcblisting}{title=System of linear equations,text side listing}
\[
\tabbedCenterstack[r]{
\text{I:} -2x + y + 3z = 10 + x \\
\text{II' = I + II:} x + y + z = 6 + 2z\\
\text{III:} 3 + 3y + 2z = y - 3z
}\]
\end{tcblisting}
\end{document}
错误消息:
./tabbedstacked.listing:6: Undefined control sequence.
\\->\let \reserved@e
\relax \let \reserved@f \relax \@ifstar {\let \reserved...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\\->\let \reserved@e \relax \let \reserved@f
\relax \@ifstar {\let \reserved...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
\new@ifnextchar ...served@d = #1\def \reserved@a {
#2}\def \reserved@b {#3}\f...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
<argument> \def \reserved@a *
{\let \reserved@e \vadjust \let \reserved@f \no...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
<argument> \def \reserved@a *{\let \reserved@e
\vadjust \let \reserved@f \no...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
<argument> ...eserved@e \vadjust \let \reserved@f
\nobreak \@xnewline }\rese...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
#2}\def \reserved@b {#3}\f...l.6 }
\]
./tabbedstacked.listing:6: Use of \@newline doesn't match its definition.
\@ifnextchar ...eserved@d =#1\def \reserved@a {#2}
\def \reserved@b {#3}\futu...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@secondoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@processROW has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
||\expandafter \ifstrempty \expandafter {\@postSEP }{\toggletrue {@do\ETC.
./tabbedstacked.listing:6: Paragraph ended before \@processROW was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@secondoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@processTABrow has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
||\global \csedef {TABX\row@ID X\roman {TABcellindex@}}{\expandonce \@preTAB \ETC.
./tabbedstacked.listing:6: Paragraph ended before \@processTABrow was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@secondoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@processTABrow has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
||\global \csedef {TABX\row@ID X\roman {TABcellindex@}}{\expandonce \@preTAB \ETC.
./tabbedstacked.listing:6: Paragraph ended before \@processTABrow was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\set@tabularcellalignment ...ef \tabular@settings
{#1.}\whileboolexpr {test ...l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\set@tabularcellalignment ...ef \tabular@settings
{\expandafter \@gobble \ta...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\set@tabularcellalignment ...le \tabular@settings
.}}\expandafter \@getnextT...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\set@tabularcellalignment ...ar \tabular@settings
\\\if l\@nextTABchar \edef...l.6 }
\]
./tabbedstacked.listing:6: Argument of \@getnextTABchar has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
\if l\@nextTABchar \edef \stackalignment {l}\else \if r\@nextTABchar \ETC.
./tabbedstacked.listing:6: Paragraph ended before \@getnextTABchar was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@secondoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@firstoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@firstoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\\->\let \reserved@e
\relax \let \reserved@f \relax \@ifstar {\let \reserved...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\\->\let \reserved@e \relax \let \reserved@f
\relax \@ifstar {\let \reserved...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
\new@ifnextchar ...served@d = #1\def \reserved@a {
#2}\def \reserved@b {#3}\f...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
<argument> \def \reserved@a *
{\let \reserved@e \vadjust \let \reserved@f \no...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
<argument> \def \reserved@a *{\let \reserved@e
\vadjust \let \reserved@f \no...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
<argument> ...eserved@e \vadjust \let \reserved@f
\nobreak \@xnewline }\rese...l.6 }
\]
./tabbedstacked.listing:6: Use of \\tabbedCenterstack doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
#2}\def \reserved@b {#3}\f...l.6 }
\]
./tabbedstacked.listing:6: Use of \@newline doesn't match its definition.
\@ifnextchar ...eserved@d =#1\def \reserved@a {#2}
\def \reserved@b {#3}\futu...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
{\calc@error #1}\fi \fi \f...l.6 }
\]
./tabbedstacked.listing:6: Undefined control sequence.
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next
l.6 }
\]
./tabbedstacked.listing:6: Argument of \@secondoftwo has an extra }.
<inserted text>
\par
l.6 }
\]
Runaway argument?
./tabbedstacked.listing:6: Paragraph ended before \@secondoftwo was complete.
<to be read again>
\par
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\csname\endcsname
l.6 }
\]
./tabbedstacked.listing:6: Missing \endcsname inserted.
<to be read again>
\MessageBreak
l.6 }
\]
(That makes 100 errors; please try again.)
./tabbedstacked.listing:6: ==> Fatal error occurred, no output PDF file produced!
Transcript written on tabbedstacked.log.
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
TeX Output exited abnormally with code 12 at Mon Aug 29 23:51:19
答案1
tcblisting(例如 minipage)内部调用\@parboxrestore
,设置\\
为\@normalcr
。Unlike\\
\@normalcr
不够健壮,因此 stackengine 的代码会中断。使其变得\@normalcr
健壮可以避免这个问题。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine}
\usepackage{listings}
\usepackage[most]{tcolorbox}
\stackMath
\setstacktabbedgap{0.5em}
\setstackTAB{ }
\makeatletter
\robustify{\@normalcr} %globally robust
%avoids error but wrong output:
%\def\@parboxrestore{\@arrayparboxrestore\def\\{\protect\@normalcr}}
\makeatother
\begin{document}
\begin{tcblisting}{title=System of linear equations,text side listing}
\[
\tabbedCenterstack[r]{
\text{I:} -2x + y + 3z = 10 + x \\
\text{II' = I + II:} x + y + z = 6 + 2z\\
\text{III:} 3 + 3y + 2z = y - 3z
}
\]
\end{tcblisting}
\end{document}
我不知道为什么\@normalcr
从一开始就不稳健,而且重新定义可能会产生副作用。在这种情况下,stackengine 必须使其在本地变得稳健,或者更改扫描 EOL 的代码。