当您按下回车键时,aloha 编辑器会插入<br>
标签或<p>
标签,或者您粘贴包含换行符的内容。现在这很好,直到我想使用{aligned}
MathJax 中的环境,它的格式如下:
\[\begin{aligned}
2x+3 &= 7 & 2x+3-3 &= 7-3 \\
2x &= 4 & \frac{2x}2 &= \frac42 \\
x &= 2
\end{aligned}\]
哪里\[...\]
是指示 MathJax 应该处理内容的分隔符。Aloha 编辑器将每一行包装在一个<p>
分隔分隔符的标记中,因此 MathJax 无法处理它们。
所以我的问题是,有没有办法将文本粘贴或输入到 aloha 而不将其拆分为多个文本节点?或者,有没有办法让 MathJax 跨标签读取分隔符?
编辑:我问是因为我不想做类似的事情
var math="";
_.each($("p:contains(\[)"),function(startEl){
math= $(startEl).html();
var startIndex = $(startEl).index();
var endIndex = $(startEl).parent().find("p:contains(\])").first().index();
$(startEl).siblings().slice(startIndex, endIndex).each(function(index){
math+=$(this).html();
});
$(startEl).siblings().slice(startIndex, endIndex).remove();
$(startEl).replaceWith("<p>"+math+"</p>");
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
});
将 TeX 放入单独<p>
的 s 中并将其放在一个<p>
中,因为它根本感觉不健壮