我很惊讶最近的问题中的 Latex 代码没有抛出任何错误,更令我惊讶的是进一步的调查,克劳利的解释 https://stackoverflow.com/questions/2892982/formatting-equations-in-latex/2894166#2894166似乎是真的。我的直觉\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}
?
也许是环境的原因math
and displaymath
.
我刚刚尝试过这些代码
\[\alpha$$
- 工作正常
\begin{displaymath}\alpha$$
- 错误 (\begin{displaymath} ended by \end{document}
) *
\displaymath\alpha$$
- 工作正常
\displaymath\alpha\displaymath
- 错误 (Bad math environment delimiter
)
\displaymath\alpha\enddisplaymath
- 工作正常。
对称选项产生相同的结果,所以我认为 LaTeX 命令定义中有
\newcommand{\[}{\displaymath}
\newcommand{\]}{\enddisplaymath }
\newenvironment{displaymath}{\displaymath}{enddisplaymath}
在 TeX 中类似
"if(displaymath)
{$$ := \displaymath}
else
{$$ := \displaymath}"
也许我错了,但这对我来说似乎是合乎逻辑的。
- 注:这证明我错了 https://stackoverflow.com/questions/2892982/formatting-equations-in-latex/2894166#2894166。更好的说法是它说:“开始方程,切换到文本模式,切换回显示数学,排版切线定义,最后结束方程”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)