- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
现在没有命名空间的 mathML 可以正常渲染,但如果我添加命名空间如 m: 或 mml:,则渲染无法正常工作。任何帮助提前致谢。
下面是我用过的代码。
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:mml="http://www.w3.org/1998/Math/MathML">
<head>
<script type="text/javascript" src="file:/P:/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body>
<h3>MathML Previewer</h3>
Paste your MathML:<br/>
<textarea id="myMath" style="resize: none; height:250px; width:850px">
</textarea>
<button type="button" onclick="myclear()">Reset</button>
<p>Click the button to get output</p>
<button type="button" onclick="myFunction()">Output</button>
<div id="demo">
</div>
<script>
function myFunction() {
var x = document.getElementById("myMath").value;
document.getElementById("demo").innerHTML = x;
MathJax.Hub.Typeset("demo");
}
</script>
<script>
function myclear() {
var x = document.getElementById("myMath").value =' ';
//document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
数学:
命名空间不渲染
<m:math display="block" xmlns:m="http://www.w3.org/1998/Math/MathML"><m:mrow><m:mi>r</m:mi><m:mo>=</m:mo><m:mfrac><m:mrow><m:mstyle displaystyle='true'><m:mo>Σ</m:mo><m:mrow><m:mi>x</m:mi><m:mi>y</m:mi><m:mo>-</m:mo><m:mfrac><m:mrow><m:mo stretchy='false'>(</m:mo><m:mstyle displaystyle='true'><m:mo>Σ</m:mo><m:mi>x</m:mi></m:mstyle><m:mo stretchy='false'>)</m:mo><m:mo stretchy='false'>(</m:mo><m:mstyle displaystyle='true'><m:mo>Σ</m:mo><m:mi>y</m:mi></m:mstyle><m:mo stretchy='false'>)</m:mo></m:mrow><m:mi>n</m:mi></m:mfrac></m:mrow></m:mstyle></m:mrow><m:mrow><m:msqrt><m:mrow><m:mstyle displaystyle='true'><m:mo>Σ</m:mo><m:mrow><m:msup><m:mi>x</m:mi><m:mn>2</m:mn></m:msup><m:mo>-</m:mo><m:mfrac><m:mrow><m:msup><m:mrow><m:mo stretchy='false'>(</m:mo><m:mstyle displaystyle='true'><m:mo>Σ</m:mo><m:mi>x</m:mi></m:mstyle><m:mo stretchy='false'>)</m:mo></m:mrow><m:mn>2</m:mn></m:msup></m:mrow><m:mi>n</m:mi></m:mfrac></m:mrow></m:mstyle></m:mrow></m:msqrt></m:mrow></m:mfrac></m:mrow></m:math>
没有按要求渲染命名空间。
<math display="block" xmlns:m="http://www.w3.org/1998/Math/MathML"><mrow><mi>r</mi><mo>=</mo><mfrac><mrow><mstyle displaystyle='true'><mo>Σ</mo><mrow><mi>x</mi><mi>y</mi><mo>-</mo><mfrac><mrow><mo stretchy='false'>(</mo><mstyle displaystyle='true'><mo>Σ</mo><mi>x</mi></mstyle><mo stretchy='false'>)</mo><mo stretchy='false'>(</mo><mstyle displaystyle='true'><mo>Σ</mo><mi>y</mi></mstyle><mo stretchy='false'>)</mo></mrow><mi>n</mi></mfrac></mrow></mstyle></mrow><mrow><msqrt><mrow><mstyle displaystyle='true'><mo>Σ</mo><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>-</mo><mfrac><mrow><msup><mrow><mo stretchy='false'>(</mo><mstyle displaystyle='true'><mo>Σ</mo><mi>x</mi></mstyle><mo stretchy='false'>)</mo></mrow><mn>2</mn></msup></mrow><mi>n</mi></mfrac></mrow></mstyle></mrow></msqrt></mrow></mfrac></mrow></math>
最佳答案
为了正确处理命名空间,您需要在 <html>
中声明它们标签。例如,
<html xmlns:m="http://www.w3.org/1998/Math/MathML">
如果您想同时处理 m: 和 mml:,请将两者都添加为 namespace 。
<html xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:mml="http://www.w3.org/1998/Math/MathML">
这对于 XHTML 文档是必需的,但对于 HTML5 则不是。
关于javascript - 在 MathML 渲染中使用命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26093182/
我有一个 MATHML 公式(由 http://www.mathtoweb.com/cgi-bin/mathtoweb_online.pl 生成)。我想将其粘贴到 Libreoffice 中。我怎样才
我不明白什么? 下面的代码工作正常: from sympy.printing.mathml import print_mathml s = "x**2 + 8*x + 16" print_mathml
我有一些网页大量使用 MathJax(或 MathML?),我想将其转换成电子书并显示在我的 kindle 上,它不支持足够的 javascript,也不支持 MathML。所以我想预处理 .html
我的浏览器 Firefox 3.6 似乎可以很好地显示 W3C 测试套件中的 Mathml 方程。但是,如果我将代码复制到我的网页中,例如 here ,所有 Firefox 生成的都是类似于 x y
我今天发现 Windows 7 带有一个非常令人印象深刻的 MathPanel 实用程序,用于执行方程的手写识别: 这很好。 (这里我已经输入了 sRGB 颜色空间 Gamma 转换部分的公式) 但现
我们很快就会开始开发 TeX 到 MathML 的转换器。所以,我想知道哪些浏览器(从哪个版本开始)正式支持 MathML?谢谢 最佳答案 几乎没有,只有 Firefox 和 Safari 可以处理
我试图显示一个简单的方程式,但它不起作用。我的代码如下(html5): a i =
我有一个包含文本区域的页面。用户将在其中输入 mathML,当用户单击输出按钮时,MathML 应呈现并显示在文本区域下方。但是渲染没有发生。 Textarea 可能包含多个用于渲染的 mathml
我正在尝试构建与 this site 相同的功能用户将在文本区域中输入数学表达式并将其呈现为 MathML 格式。 例子: Input expression string: cos(x^3) Then
快速了解 MathML 及其在世界范围内的使用的最佳方法是什么? 我的意思是: 你用什么来渲染/编辑它 它是否用于您可以向我指出的任何商业/开源应用程序 它是否流行并被大量使用? 是否有可以在 C#、
我在使用我们的学习管理系统 (LMS) 中内置的 MathML 编辑器时发现了一些奇怪的东西。当我输入 float 时,它用 包裹小数点标签。 例如,我期望 1.2输出为: 1.2 但是,编辑器输出
我一直在努力为 ckeditor 添加 mathml 支持。我浏览了几个链接,但似乎没有一个起作用。我什至尝试过 ckeditor 的 WIRIS 插件,但它没有给我任何结果。对于WIRIS,我关注了
我在使用我们的学习管理系统 (LMS) 中内置的 MathML 编辑器时发现了一些奇怪的东西。当我输入 float 时,它用 包裹小数点标签。 例如,我期望 1.2输出为: 1.2 但是,编辑器输出
我使用 MathML 创建一些数据 block ,我需要通过 OpenXML SDK 将其插入到 docx 文件中。我听说这是可能的,但我没有做到。有人可以帮我解决这个问题吗? 最佳答案 据我所知,O
我正在使用 MathDox用于生成 MathML 的公式编辑器。现在我想将 MathDox 生成的 MathML 转换为表达式,稍后我可以使用它来评估以找到答案。 For eg: MathML:
我想像这样转换表达式: “a*x^2+b*x^2+c+d”…… “对数((a*x)/sin(x))”... “1/x”... 使用 JavaScript 进入 MathML。有什么建议么?我找到的最接
我有一个 PHP 脚本输出:((5^2x^2)^2+3)/(sqrt(sqrt(81))) 我希望它像您编写的那样正确格式化。 在哪里可以找到这样的 ASCII 到 MathML 转换器:http:/
我正在尝试为用户实现一种输入简化数学符号的方法,而不是传统的 LaTex 符号。然后将使用 MathJax 呈现表达式的结果。但我似乎找不到“简化的数学符号”或 ad-hoc ASCII 到 late
具体来说(MathJax 不是我要找的)我有一个网页,里面有一些 MathML。“FireFox”浏览器可以很好地解析它,但是当我尝试通过 javascript 添加相同的代码时,它没有'解析它。如何
MathML是一种编写数学的网络标准,可以轻松缩放而无需像素化(就像 SVG)、复制和粘贴以及屏幕阅读器阅读。 Chrome 拒绝在存在 JavaScript polyfill 的基础上实现它。 (I
我是一名优秀的程序员,十分优秀!