第二次渲染时发生MathJax错误
我使用MathJax动态呈现以下代码:第二次渲染时发生MathJax错误,mathjax,Mathjax,我使用MathJax动态呈现以下代码: When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ In equation \eqref{eq:sample}, we find the value of an interesting integral: \begin{equation} \int_0^\inf
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
In equation \eqref{eq:sample}, we find the value of an interesting integral:
\begin{equation}
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
\label{eq:sample}
\end{equation}
使用Hub.Queue
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
第一次渲染效果很好。但是,当我尝试使用相同的代码再次渲染时,仅渲染第一部分,但第二部分(从\begin开始)未被解析并显示在黑色帧中。为什么会发生这种情况?问题在于
\label
的使用。当数学被重新排版时,标签已经存在(从第一次排版开始),因此TeX input jax将此报告为错误(禁用noErrors扩展以查看错误消息)
在再次排版之前,您需要重置标签(可能还有方程式编号)。要做到这一点,请使用
MathJax.Hub.Queue(
["resetEquationNumbers",MathJax.InputJax.TeX],
["Typeset",MathJax.Hub]
);
而不是
MathJax.Hub.Queue([“Typeset”,MathJax.Hub])
调用。问题在于使用\label
。当数学被重新排版时,标签已经存在(从第一次排版开始),因此TeX input jax将此报告为错误(禁用noErrors扩展以查看错误消息)
在再次排版之前,您需要重置标签(可能还有方程式编号)。要做到这一点,请使用
MathJax.Hub.Queue(
["resetEquationNumbers",MathJax.InputJax.TeX],
["Typeset",MathJax.Hub]
);
不要使用
MathJax.Hub.Queue([“Typeset”,MathJax.Hub])
调用。您应该添加一个实时示例以获得可靠的答案。但这很可能是由于label宏造成的,因为从LaTeX透视图和html透视图都不能有两个相同的标签,因为这些宏会生成重复的ID。您应该添加一个实时示例以获得可靠的答案。但这很可能是由于label宏,因为从LaTeX透视图和html透视图都不能有两个相同的标签,在html透视图中,这些宏生成重复的ID。