报错信息:
Foreign command \atopwithdelims; \frac or \genfrac should be used
代码
\begin{equation}
{\mathbf{S}^{t_1}\brack\mathbf{W}^{t_1}} = {\mathbf{S}^{t_0}\brack\mathbf{W}^{t_0}} + \int^{t_1}_{t_0} g\left( {\mathbf{S}^t\brack\mathbf{W}^t}, t \right) dt,
\end{equation}
[ S t 1 W t 1 ] = [ S t 0 W t 0 ] + ∫ t 0 t 1 g ( [ S t W t ] , t ) d t , {\mathbf{S}^{t_1}\brack\mathbf{W}^{t_1}} = {\mathbf{S}^{t_0}\brack\mathbf{W}^{t_0}} + \int^{t_1}_{t_0} g\left( {\mathbf{S}^t\brack\mathbf{W}^t}, t \right) dt, [Wt1St1]=[Wt0St0]+∫t0t1g([WtSt],t)dt,
原因
报错信息中说\atopwithdelims
被使用了,这个命令是一个
TeX
\TeX
TEX 数学命令,如果我们使用了amsmath
包,那么我们不需要使用类似于\atopwithdelims
或\atop
这样的命令,而应该使用amsmath
设定的命令,例如\frac
、\binom
、\genfrac
等。
具体可以下图:
来自于这个网页。
解决方案
我个人建议使用\genfrac
来使用,示例:
原来:
{a\brack b}
[
a
b
]
{a\brack b}
[ba]
更新:
\genfrac [ ] {0pt}{0}{a}{b}
[ a b ] \genfrac [ ] {0pt}{0}{a}{b} [ba]
更新后的公式:
\begin{equation}
\genfrac [ ] {0pt}{0}{\mathbf{S}^{t_1}}{\mathbf{W}^{t_1}} = \genfrac [ ] {0pt}{0}{\mathbf{S}^{t_0}}{\mathbf{W}^{t_0}} + \int^{t_1}_{t_0} g\left( \genfrac [ ] {0pt}{0}{\mathbf{S}^t}{\mathbf{W}^t}, t \right) dt,
\end{equation}
[ S t 1 W t 1 ] = [ S t 0 W t 0 ] + ∫ t 0 t 1 g ( [ S t W t ] , t ) d t , \genfrac [ ] {0pt}{0}{\mathbf{S}^{t_1}}{\mathbf{W}^{t_1}} = \genfrac [ ] {0pt}{0}{\mathbf{S}^{t_0}}{\mathbf{W}^{t_0}} + \int^{t_1}_{t_0} g\left( \genfrac [ ] {0pt}{0}{\mathbf{S}^t}{\mathbf{W}^t}, t \right) dt, [Wt1St1]=[Wt0St0]+∫t0t1g([WtSt],t)dt,
零报错,很舒服!
参考文献
- Stefan Kottwitz. Jun 1, 2011. “Why does amsmath print a warning about a foreign command?”. Retrieved from https://tex.stackexchange.com/questions/19587/why-does-amsmath-print-a-warning-about-a-foreign-command
- “ KaTeX \KaTeX KATEX Supported Functions”. Retrieved from https://katex.org/docs/supported.html#fractions-and-binomials. Accessed on May 26, 2022.