![检测 \begin{...} ... \end{...} 不匹配,或者结束你没有开始的事情](https://linux22.com/image/392980/%E6%A3%80%E6%B5%8B%20%5Cbegin%7B...%7D%20...%20%5Cend%7B...%7D%20%E4%B8%8D%E5%8C%B9%E9%85%8D%EF%BC%8C%E6%88%96%E8%80%85%E7%BB%93%E6%9D%9F%E4%BD%A0%E6%B2%A1%E6%9C%89%E5%BC%80%E5%A7%8B%E7%9A%84%E4%BA%8B%E6%83%85.png)
在测试一些新环境时,我犯了这样的错误:
...
\begin{document}
...
\begin{A}
...
\end{A}
...
\begin{B}
...
\end{A}
...
\end{document}
LaTeX 抱怨说结束B
时没有结束document
。它谈论了行在哪里\end{document}
,以及行在哪里\begin{B}
,但它确实不是谈论不匹配\end{A}
(实际错误的位置)。
为什么 LaTeX 无法检测到这种情况?我知道\newenvironment
实际上定义了两个命令,一个用于开始,一个用于结束,但是难道它不能检测到从未开始过的事情即将结束的情况吗?
更新 1:
我给出的例子(据我所知)是问题的本质,我在头脑中构建了它,因为原始文件有数千行和许多图形等(太多了,无法在这里展示,而且也是由 TeX analphabet 编写的,所以你会抓狂地看到我的挣扎......)。但人们不相信我写的东西。所以我从我的大文件中制作了一个小测试文件,展示了这个问题:
以下是输入的重要部分:
\begin{gfxTableCap}[p]{lr}{Caption}{label2}%
\gfxCap{0.4}{Platzhalter.pdf}{Caption 2A}
&
\gfxCap{0.4}{Platzhalter.pdf}{Caption 2B}
\end{gfxTableCapLab}
导致此输出(截断为本质):
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/TeX Live for SUSE Linux) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./xxx.tex
LaTeX2e <2017-04-15>
[...]
<Platzhalter.pdf, id=1, 284.52756pt x 227.62204pt> <use Platzhalter.pdf>
<use Platzhalter.pdf> <use Platzhalter.pdf> <use Platzhalter.pdf>
! LaTeX Error: \begin{gfxTableCap} on input line 88 ended by \end{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
事实确实如此不是说“出乎意料” \end{gfxTableCapLab}
。
如果它对于我定义的环境来说很特殊,那么情况就是如此混乱:
\documentclass[a4paper,twoside]{report}
\newcommand{\gtLab}{}
\newcommand{\gtCap}{}
\newenvironment{gfxTableCapLab}[4][htbp]{%
\begin{figure}[#1]%
\begin{tabular}{#2}}%
{\end{tabular}%
\gtCap%
\end{figure}%
}
\newenvironment{gfxTableCap}[3][htbp]{%
\begin{gfxTableCapLab}{#2}{#3}{}%
}%
{\end{gfxTableCapLab}}
\newenvironment{gfxTableLab}[3][htbp]{%
\begin{gfxTableCapLab}{#2}{}{#3}%
}%
{\end{gfxTableCapLab}}
\newenvironment{gfxTable}[2][htbp]{%
\begin{gfxTableCapLab}{#2}{}{}%
}%
{\end{gfxTableCapLab}}
\newcommand{\gLab}{}
\newcommand{\gCap}{}
\newcommand{\gfxCapLab}[4]{%
\begin{minipage}[t]{#1\textwidth}%
{graphic}%
\gCap%
\end{minipage}
}
\newcommand{\gfxCap}[3]{\gfxCapLab{#1}{#2}{#3}{}}
\begin{document}
Some text...
\begin{gfxTableCapLab}[p]{lr}{Caption}{label1}%
\end{gfxTableCapLab}
%
Text
\begin{gfxTableCap}[p]{lr}{Caption}{label2}%
\end{gfxTableCapLab}
\end{document}
对于没有合适占位符 PDF 的所有人,这里是 uuencoded 版本(我无法将 PDF 作为图像附加):
begin 644 Platzhalter.pdf
M)5!$1BTQ+C4*);7MKOL*-"`P(&]B:@H\/"`O3&5N9W1H(#4@,"!2"B`@("]&
M:6QT97(@+T9L871E1&5C;V1E"CX^"G-T<F5A;0IXG)5036L"00R]YU?DJ(>-
MD\Q7]EHH!4&H[=S$PU*K4G8/6J'07V]VEQ9I*UC"9,)[Y.4EC,ZB8DLBB7+F
M%`5?.CB`&ZBG!YPU#G?OP!0X>_'X8=3<WANL4$A]2"%]%VOKV4#`!1Z0!X4Q
MFZ0H9<G8?UQCAQ(#:8Y?0&M`)`.1:Z4@J4>4?-`+8/]+Y1F7U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X@"C`P,#`P,#4Q,34@,#`P,#`@;B`*,#`P,#`P-3@W
M,2`P,#`P,"!N(`HP,#`P,#`U.3@X(#`P,#`P(&X@"G1R86EL97(*/#P@+U-I
M>F4@,30*("`@+U)O;W0@,3,@,"!2"B`@("]);F9O(#$R(#`@4@H^/@IS=&%R
1='AR968*-C`T,0HE)45/1@H`
`
end
答案1
请始终发布实际的测试文档,而不是无法测试的片段。一般来说,LaTeX 会在
\end{A}
但有些情况下不能这样做,例如,如果B
是,verbatim
那么根据定义,所有处理都将被禁用,直到\end{B}
看到,在这种情况下,该错误只会在文件末尾检测到。
所以
\documentclass{article}
\begin{document}
\begin{empty}
\end{empty}
\begin{quad}
\end{empty}
\end{document}
在第 11 行产生错误消息
! LaTeX Error: \begin{quad} on input line 9 ended by \end{empty}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \end{empty}
但
\documentclass{article}
\begin{document}
\begin{empty}
\end{empty}
\begin{verbatim}
\end{empty}
\end{document}
在文件末尾产生错误
Runaway argument?
^^M^^M\end{empty}^^M^^M^^M\end{document}^^M
! File ended while scanning use of \@xverbatim.
<inserted text>
\par
<*> bb469
?
查看提供的具体示例,请注意 tex 是一个宏扩展系统而不是编译器,它永远不会提前解析完整的文档。
所以从
\begin{gfxTableCap}[p]{lr}{Caption}{label2}%
\end{gfxTableCapLab}
\end{document}
\gfxTableCap
经过最初的几次扩张之后
\begin{gfxTableCapLab}{p}{lr}{Caption}%
\end{gfxTableCapLab}
\end{document}
\end{gfxTableCapLab}
因此,文档中明确指出 关闭了内部环境,但外部环境gfxTableCap
从未关闭,并且直到此处的包含组关闭后才能检测到\end{document}
。