我试图包括html输入字段,如:
<input id="txtBox" type="text" size="1" style="text-align: center">在mathML方程中。当我最初在Firefox上本地创建和测试它们时,一切看起来都很好(本机呈现内容)。但是,现在我已经将它上传到了我们的站点,它使用mathjax 2.01来呈现我得到的“未知节点类型:输入”错误,无论输入框在哪里都应该是这样。我现在把箱子包在里面
<annotation> 标签,如在另一篇文章中所描述的,然而,我仍然收到同样的错误。
<script type="math/mml">
<math>
<mstyle displaystyle="true">
<msup>
<mi>x</mi>
<semantics>
<annotation-xml encoding="application/xhtml+xml">
<input xmlns="http://www.w3.org/1999/xhtml" style="text-align:right" type="text" size="2" name="n" /></input>
</annotation-xml>
</semantics>
</msup>
<mo>+</mo>
<semantics>
<annotation-xml encoding="application/xhtml+xml">
<input xmlns="http://www.w3.org/1999/xhtml" type="text" size="2" name="b" /></input>
</annotation-xml>
</semantics>
</mstyle>
</math>
</script>发布于 2014-01-17 20:02:58
MathML3.0规范不提供直接嵌入在MathML中的HTML元素。HTML5扩展了定义,允许在MathML中的令牌元素中使用HTML标记,例如<mtext>。然而,MathJax是在HTML5完成之前开发的,它遵循MathML3.0规范,因此通常不允许使用HTML5标记。
但是,可以使用<semantics>和<annotation-xml>元素在MathML中包含MathML。请注意,<annotation>和<annotation-xml>只能作为<semantics>的子级出现,因此两者都需要。另外,<annotation>标记的主体应该是纯文本,而不是HTML标记,因此要包含<annotation-xml>,必须使用<annotation-xml>而不是<annotation>。最后,您需要为encoding标记提供<annotation-xml>属性,注释的内容需要一个xmlns属性,以确保它在<annotation-xml>名称空间中被解析。
下面是一个与MathJax以及火狐中的原生MathML一起工作的示例:
<script type="math/mml">
<math>
<mstyle displaystyle="true">
<msup>
<mi>x</mi>
<semantics>
<annotation-xml encoding="application/xhtml+xml">
<input xmlns="http://www.w3.org/1999/xhtml" style="text-align:right" type="text" size="2" name="n" />
</annotation-xml>
</semantics>
</msup>
<mo>+</mo>
<semantics>
<annotation-xml encoding="application/xhtml+xml">
<input xmlns="http://www.w3.org/1999/xhtml" type="text" size="2" name="b" />
</annotation-xml>
</semantics>
</mstyle>
</math>
</script>我们确实希望在未来版本的MathJax中改进这种情况,但现在这是唯一的选择。我希望这对你有用。
https://stackoverflow.com/questions/21171107
复制相似问题