将 $$ 放在“equation”环境中:为什么 Latex 不抱怨?
我很惊讶最近的问题中的 Latex 代码没有抛出任何错误,更令我惊讶的是进一步的调查,克劳利的解释似乎是正确的。我对 \begin{equation} ... \end{equation}
代码的直觉显然是错误的,到底发生了什么?
考虑一下这个稍微修改过的代码:
\begin{equation}
1: e^{i\pi}+1=0
$$ 2: B\"ob $$
3: e=mc^2
\end{equation}
这似乎证明了 Crowley 对此类代码的解释,即“该代码对 LaTeX 所说的是开始方程,结束它,再次开始它,排版切线的定义并结束方程”是正确的:第 1 行和第 3 行只能在数学模式下排版,第 2 行只能在文本模式下排版。
Latex 不应该看到 \end{equation}
正在结束不是由 \begin{equation}
启动的显示数学吗?
I was surprised that the Latex code from a recent question didn't throw up any errors, and even more surprised on further investigation, that Crowley's explanation seems to be true. My intuition about the \begin{equation} ... \end{equation}
code is clearly off, what's really going on?
Consider this, slightly adapted code:
\begin{equation}
1: e^{i\pi}+1=0
$ 2: B\"ob $
3: e=mc^2
\end{equation}
This seems to prove that Crowley's explanation of such code, namely that "What that code says to LaTeX is begin equation, end it, begin it again, typeset definition of tangens and end the equation" is right: lines 1&3 can only be typeset in maths mode, line 2 only in text mode.
Shouldn't Latex see that the \end{equation}
is ending a display math that wasn't started by the \begin{equation}
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许是因为环境
math
和displaymath
。我刚刚尝试了这些代码
\[\alpha$$
- 正常工作\begin{displaymath}\alpha$$
- 错误(\begin{displaymath} 结束\end{document}
) *\displaymath\alpha$$
- 正常工作\displaymath\alpha\displaymath
- 错误(错误的数学环境分隔符
)\displaymath\alpha\enddisplaymath
- 工作正常。对称选项产生相同的结果,所以我认为 LaTeX 命令定义和 TeX 中有
类似“
也许我错了”的内容,但这对我来说似乎是合乎逻辑的。
Maybe it is because of environments
math
anddisplaymath
.I just tried those codes
\[\alpha$$
- works properly\begin{displaymath}\alpha$$
- error (\begin{displaymath} ended by \end{document}
) *\displaymath\alpha$$
- works properly\displaymath\alpha\displaymath
- error (Bad math environment delimiter
)\displaymath\alpha\enddisplaymath
- works properly.Symetric options produce same results, so I think there's in LaTeX command definition
and in TeX something like
Maybe I'm wrong, but this seems logical to me.