MathJax JS API:如何发送包含文本的 var 并从中获取 html?
从一些外部源(例如 flash 应用程序)我得到文本(它是简单的 html、wiki markdown 和 TeX/LaTeX 的混合)。目前我有:(我使用 jQuery)
function render(text)
{
$("#wikiContent").html(text);
MathJax.Hub.Typeset()
$("#wikiContent").html(Markdown_Showdown_Converter.makeHtml( $("#wikiContent").html()));
}
这会导致下一个问题 - 任何复杂的数学,例如 这样:
$$
\begin{eqnarray*}
B_1 + z_1 M_1 &\equiv& B_2 \pmod {M_2}
\\ B_1 + z_1 M_1 + z_2 M_1M_2 &\equiv& B_3 \pmod {M_3}
\\ &\cdots&
\\ B_1 + z_1M_1 + z_2 M_1M_2 + \cdots + z_{k-1}M_1 M_2 \cdots M_{k-1} &\equiv& B_k \pmod{M_k}.
\end{eqnarray*}
$$
被破坏=(
所以我想知道如何将一些 var 放入MathJax 并从中获取 html?
From some external source (flash app for example) I get text (which is mix of simple html, wiki markdown and TeX/LaTeX). Currently I have: (I use jQuery)
function render(text)
{
$("#wikiContent").html(text);
MathJax.Hub.Typeset()
$("#wikiContent").html(Markdown_Showdown_Converter.makeHtml( $("#wikiContent").html()));
}
And that results in next problem - any complex math like such:
$
\begin{eqnarray*}
B_1 + z_1 M_1 &\equiv& B_2 \pmod {M_2}
\\ B_1 + z_1 M_1 + z_2 M_1M_2 &\equiv& B_3 \pmod {M_3}
\\ &\cdots&
\\ B_1 + z_1M_1 + z_2 M_1M_2 + \cdots + z_{k-1}M_1 M_2 \cdots M_{k-1} &\equiv& B_k \pmod{M_k}.
\end{eqnarray*}
$
gets broken=(
So I wonder how to put some var into MathJax and get html out of it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
continue
You should not call
MathJax.Hub.Typeset()
directly, but rather use theMathJax.Hub.Queue()
to queue the typesetting. Since the typesetting operates asynchronously, you would need to queue the code that looks up the resulting HTML as well. Something likeSee the MathJax documentation about modifying math on the page for more details.
Note, however, that the HTML that you get is not universal (that is, it depends on the browser you are using, the OS, the fonts you have installed, the CSS on the page where MathJax runs, and a variety of other factors, so you will not be able to copy and paste the HTML into another page and expect consistent results.