问题描述
令我惊讶的是,最近一个问题中的Latex代码没有引发任何错误,对于进一步的调查,更令人惊讶的是,似乎是正确的.我对\begin{equation} ... \end{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?
请考虑以下代码:
\begin{equation}
1: e^{i\pi}+1=0
$$ 2: B\"ob $$
3: e=mc^2
\end{equation}
这似乎证明了克劳利对这种代码的解释,即该代码对LaTeX所说的是开始方程式,结束它,再次开始它,对tangens进行排版定义并结束方程式"是正确的:第1和第3行.只能在数学模式下排版,第2行只能在文本模式下排版.
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.
乳胶看不到\end{equation}
正在结束不是由\begin{equation}
开始的显示数学运算吗?
Shouldn't Latex see that the \end{equation}
is ending a display math that wasn't started by the \begin{equation}
?
推荐答案
可能是由于环境math
和displaymath
造成的.
Maybe it is because of environments 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命令定义中有
Symetric options produce same results, so I think there's in LaTeX command definition
\newcommand{\[}{\displaymath}
\newcommand{\]}{\enddisplaymath }
\newenvironment{displaymath}{\displaymath}{enddisplaymath}
在TeX中类似
"if(displaymath)
{$$ := \displaymath}
else
{$$ := \displaymath}"
也许我错了,但这对我来说似乎合乎逻辑.
Maybe I'm wrong, but this seems logical to me.
- 注意:这证明我是错误的.更好的说法是:开始方程式,切换到文本模式,切换回displaymath,排版切线定义,最后结束方程式."
- Note: That proves that I was wrong. Better words are It says: "Begin equation, switch to text mode, switch back to displaymath, typeset tangens definition and finally end the equation".
这篇关于将$$置于“等式"环境的中间:为什么Latex不抱怨?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!