fbpx
维基百科

数学置标语言

数学标记语言Mathematical Markup LanguageMathML),是一种基于XML的标准,用来描述数学符号和公式。它的目标是把数学公式集成到万维网和其他文档中。从2015年开始,MathML成为了HTML5的一部分和ISO标准。

数学标记语言(MathML)
互联网媒体类型application/mathml+xml、​application/mathml-presentation+xml、​application/mathml-content+xml、​math/mml
开发者万维网联盟(W3C)
格式类型标记语言
扩展自XML
标准Mathematical Markup Language (MathML) Version 3.0 2nd Edition
网站W3C MathML

由于数学符号和公式的结构复杂且符号与符号之间存在多种逻辑关系,MathML的格式十分繁琐。因此,大多数人都不会去手写MathML,而是利用其它的工具来编写,其中包括TeX到MathML的转换器。

历史 编辑

它是由W3C的数学工作组提出的。语言规格1.01版于1999年7月公布,2.0版于2001年2月出现。W3C的数学工作组在2003年10月发布了MathML 2.0的第二版, 之后又在2010年10月发布了MathML 3.0.

结构和语法 编辑

MathML十分类似HTML,但非常繁琐。它继承了角括号和双标签(<标签>内容</标签>)的用法。

MathML不但规定数学式子的表现,而且也规定数学数字的含义(前者叫做“Presentation MathML”,后者叫做“Content MathML”)。由于数学式子的意义与表现是分离开的,如何交流内容留给了用户。例如,内嵌MathML的网页可以让许多浏览器按照正常的网页一样浏览。但是视觉受损者也可以用相同的MathML,通过屏幕阅读器(例如IE浏览器的MathPlayer插件Opera浏览器9.50构建号9656+、火狐浏览器Fire Vox英语Fire Vox附加组件)有声朗读出来。

Presentation MathML 编辑

Presentation MathML 侧重于如何显示一个数学式子,大约有30个元素。元素名字全部以m开头。构建 Presentation MathML 表达式的记号是有一些更高层的元素组合而成的,这些元素控制它们的界面(大约有50个属性,基本很好地控制了细节)。

记号元素只包含文字(没有其他元素),它们有:

  • <mi>x</mi> —— 标识符
  • <mo>+</mo> —— 操作符
  • <mn>2</mn> —— 数字
  • <mtext>non zero</mtext> —— 文本

注意到尽管这些记号元素能用于表示扩展要点,允许用宿主语言来标记。HTML5的MathML几乎允许在mtext中内联HTML标记,可以把HTML标记放在MathML中来标记内嵌文本(在例子中使得第一个单词加粗)。并且

  • <mtext><b>non</b> zero</mtext>

是合格的。

这些是布局元素,它们都只能包含元素。它们有:

  • <mrow> —— 水平的一行
  • <msup> <munderover> 等等 —— 上标,规定上下操作符,就像求和号等等一样
  • <mfrac> —— 分数
  • <msqrt><mroot> —— 方根
  • <mfenced> —— 用栅隔离开内容,例如括号

与HTML和XML一样,有许多实体来指定特殊符号,例如&pi;&RightArrow;。有趣的是,通常不可见操作符也依然存在实体,例如 &InvisibleTimes; 用于表示乘法运算中被省略的乘号。这些不可见操作符是:

  • U+2061 函数应用
  • U+2062 不可见乘号
  • U+2063 不可见分隔符
  • U+2064 不可见加号

MathML的完整实体说明在标准的第七章,并且和HTML与XML的协调在 [1] (页面存档备份,存于互联网档案馆)。

所以,表达式 需要两个元素:一个是创建总体的水平行,另一个创建上标的指数。只有元素和(没有标记的)裸记号的布局的结构如下:

 <mrow>  a &InvisibleTimes; <msup>x 2</msup>  + b &InvisibleTimes; x  + c  </mrow> 

然而,单个记号也必须用标识符(mi)、操作符(mo)或数字(mn)表示。添加到记号标记,完整的形式如下:

 <mrow>  <mi>a</mi> <mo>&InvisibleTimes;</mo> <msup><mi>x</mi><mn>2</mn></msup>  <mo>+</mo><mi>b</mi><mo>&InvisibleTimes;</mo><mi>x</mi>  <mo>+</mo><mi>c</mi>  </mrow> 

有效的MathML文档需要包含XML声明、DOCTYPE声明和文档元素。 文档体包含位于<math>元素内的MathML表达式。通常,MathML会被内嵌于多种通用文档中,例如HTMLDocBook,获知其它的XML模式。一个包含如上MathML的完整的文档显示如下:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN"  "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>a</mi> <mo>&InvisibleTimes;</mo> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>b</mi> <mo>&InvisibleTimes; </mo> <mi>x</mi> <mo>+</mo> <mi>c</mi> </mrow> </math> 

Content MathML 编辑

Content MathML 侧重于表达式的语义,而不是布局。中间的 Content MathML 是用<apply>元素来表示功能的具体应用。被应用的功能的长子元素放在<apply>下,并且它的操作数或参数是剩下来的子元素, Content MathML 只有少许属性。

标识符和数字之类的记号被单独标记,就像 Presentation MathML 一样,但是元素类似 cicn。不同于仅仅是另一个类型的记号,操作符表示具体的元素。它们的数学语义可以从MathML中的制鞋符号中看出来:timespower等等。为不同的功能和操作符超过100个不同的元素(见标准第四章)。

例如,<apply><sin/><ci>x</ci></apply>代表 ,而<apply><plus/><ci>x</ci><cn>5</cn></apply>代表 。表示操作符和功能的元素是空元素,因为它们的操作数是其它在下面包含有<apply>的元素。

表达式 可以被表示为:

<math>  <apply>  <plus/>  <apply>  <times/>  <ci>a</ci>  <apply>  <power/>  <ci>x</ci>  <cn>2</cn>  </apply>  </apply>  <apply>  <times/>  <ci>b</ci>  <ci>x</ci>  </apply>  <ci>c</ci>  </apply> </math> 

Content MathML 近乎是同构于一个功能语言(例如Scheme)中的表达式。<apply>...</apply>的数量就是Scheme的(...),而且许多操作符和功能元素的就是Scheme的函数。有了这些精细的文本转换,外加去标签的单独记号,上面的例子就成为:[1]

 (plus  (times a (power x 2))  (times b x)  c) 

这放映出XML元素结构和LISP或Scheme的S-表达式的长期的亲密关系。[2][3]

与其它格式的对比 编辑

例如,书写以下的二次方程求根公式:

 

若用LaTeX,则只需要一行代码:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} 

若用eqn,则也只需一行代码

x={-b +- sqrt{b sup 2 – 4ac}} over 2a 

若用Apache OpenOffice MathLibreOffice Math,则也只需要一行代码(以下三种均可):

x={-b plusminus sqrt {b^2 – 4 ac}} over {2 a} x={-b ± sqrt {b^2 – 4ac}} over 2a x={-b +- sqrt {b^2 – 4ac}} over 2a 

若用ASCIIMathML (页面存档备份,存于互联网档案馆),则也只需要一行代码

x = (-b +- sqrt(b^2 – 4ac)) / (2a) 

但用MathML,则需要:

<math mode="display" xmlns="http://www.w3.org/1998/Math/MathML">  <mrow>  <mi>x</mi>  <mo>=</mo>  <mfrac>  <mrow>  <mo form="prefix">&#x2212;<!-- − --></mo>  <mi>b</mi>  <mo>&#x00B1;<!-- &PlusMinus; --></mo>  <msqrt>  <msup>  <mi>b</mi>  <mn>2</mn>  </msup>  <mo>&#x2212;<!-- − --></mo>  <mn>4</mn>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>a</mi>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>c</mi>  </msqrt>  </mrow>  <mrow>  <mn>2</mn>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>a</mi>  </mrow>  </mfrac>  </mrow>  <annotation encoding="TeX">  x=\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}  </annotation>  <annotation encoding="StarMath 5.0">  x={-b plusminus sqrt {b^2 - 4 ac}} over {2 a}  </annotation> </math> 

虽然如此,由于MathML是严格遵守XML规范的语言,很多已经运用XML的软件可以轻易的读懂MathML。这也是这种语言的制作者W3C组织宁可选择复杂的句法也要和标准一致的一个重要原因。

在XHTML或HTML5文件中内嵌MathML 编辑

MathML是一种XML,可以通过使用XML命名空间来嵌入XML文件中,例如XHTML文件。现代浏览器例如火狐浏览器版本3以上版本和Opera浏览器9.6以上版本(不完全支持)可以展示XHTML内嵌的MathML。

例如 math-test.xhtml:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">  <head>  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />  <title>Example of MathML embedded in an XHTML file</title>  <meta name="description" content="Example of MathML embedded in an XHTML file" />  <meta name="keywords" content="Example of MathML embedded in an XHTML file" />  </head>  <body>  <h1>Example of MathML embedded in an XHTML file</h1>  <p>  Given the quadratic equation  <math xmlns="http://www.w3.org/1998/Math/MathML">  <mrow>  <mi>a</mi>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <msup>  <mi>x</mi>  <mn>2</mn>  </msup>  <mo>+</mo>  <mi>b</mi>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>x</mi>  <mo>+</mo>  <mi>c</mi>  <mo>=</mo>  <mi>0</mi>  </mrow>  </math>  , the roots are given by  <math xmlns="http://www.w3.org/1998/Math/MathML">  <mrow>  <mi>x</mi>  <mo>=</mo>  <mfrac>  <mrow>  <mo form="prefix">&#x2212;<!-- − --></mo>  <mi>b</mi>  <mo>&#x00B1;<!-- &PlusMinus; --></mo>  <msqrt>  <msup>  <mi>b</mi>  <mn>2</mn>  </msup>  <mo>&#x2212;<!-- − --></mo>  <mn>4</mn>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>a</mi>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>c</mi>  </msqrt>  </mrow>  <mrow>  <mn>2</mn>  <mo>&#x2062;<!-- &InvisibleTimes; --></mo>  <mi>a</mi>  </mrow>  </mfrac>  </mrow>  </math>  .  </p>  </body> </html> 
 
使用带有 STIX英语STIX Fonts project Beta字体的 火狐浏览器3.5版显示MathML的图片例子 (math-test.xhtml)

而内联MathML同样被HTML5文件支持。支持的浏览器有当前版本的WebKitSafari)和GeckoFirefox)。

例如: math-test.htm

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example of MathML embedded in an HTML5 file</title> </head> <body> <h1>Example of <abbr title="Mathematical Markup Language">MathML</abbr> embedded in an <abbr title="HyperText Markup Language">HTML</abbr> 5 file </h1> <p> Given the quadratic equation <math> <mrow> <mi>a</mi> <mo>&InvisibleTimes;</mo> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>b</mi> <mo>&InvisibleTimes;</mo> <mi>x</mi> <mo>+</mo> <mi>c</mi> <mo>=</mo> <mi>0</mi> </mrow> </math> , the roots are given by <math> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo form="prefix">−</mo> <mi>b</mi> <mo>&PlusMinus;</mo> <msqrt> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>−</mo> <mn>4</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi> <mo>&InvisibleTimes;</mo> <mi>c</mi> </msqrt> </mrow> <mrow> <mn>2</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> . </p> </body> </html>

软件支持 编辑

浏览器 编辑

在现在几个主要的网页浏览器中,基于Gecko的浏览器(如Firefox)有最完备的原生支持。[4][5]

WebKit排版引擎有针对MathML的开发版,[6]这一特性只出现在Safari 5.1及更高版本、[7]Chrome 24,[8][9]但是不在后来的Chrome版本里面。[10]Google移除了MathML支持,宣称架构上的安全问题和低使用量不会证明他们的维护时间有理。[11]截至2013年10月年 (2013年10月-Missing required parameter 1=month!),WebKit/Safari的实现存在多个bug。[12]

Opera 9.5—12支持MathML CSS配置,[13][14]但不能使附加符号正确放置。[15]9.5之前需要用户脚本或样式以模拟MathML支持。[16]Opera 14开始,Opera通过迁移到Chromium 25引擎移除了MathML支持。[17]

Internet Explorer原生不支持MathML。IE6IE9在安装了MathPlayer插件后也可以识别MathML。[18]IE10使用MathPlayer时存在一些崩溃bug,并且微软决定在IE11完全禁止MathPlayer所需的二进制插件界面。[19]MathPlayer有协议条款会限制在商用页面或软件上面的使用或发行。使用或发行MathPlayer插件以通过商用软件中的WebBrowser控件显示HTML内容也有可能受到禁止。

基于KHTMLKonqueror不提供对MathML的支持。[20]

编辑器 编辑

MathML还得到了主要办公软件的支持,如Apache OpenOfficeLibreOfficeMicrosoft Office,以及数学软件的支持,如MathematicaMaple

Firemath英语Firemath火狐浏览器的附加组件,提供WYSIWYG的MathML编辑器。

手写识别 编辑

Windows 7自带工具名叫Math Input Panel。可以把手写输入转换为MathML。

参考文献 编辑

  1. ^ Calculadora Alicia. [2022-11-10]. 
  2. ^ Steven DeRose. The SGML FAQ Book: Understanding the Relationship of SGML and XML, Kluwer Academic Publishers, 1997. ISBN 978-0-7923-9943-8.
  3. ^ Canonical S-expressions#cite note-0英语Canonical S-expressions#cite note-0
  4. ^ Wang, Frédéric, Mozilla MathML Status, Mozilla, [2018-07-11], (原始内容于2013-04-09) 
  5. ^ Sidje, Roger B., Authoring MathML for Mozilla, Mozilla, [2018-07-11], (原始内容于2010-03-24) 
  6. ^ Bug 3251 – Implement MathML (master bug), WebKit, [2018-07-11], (原始内容于2018-07-11)  . . . (However, "see also") https://trac.webkit.org/wiki/MathML%20Status (页面存档备份,存于互联网档案馆
  7. ^ Safari 5.1 and math, [2018-07-11], (原始内容于2018-07-26) 
  8. ^ , BrowserFame, [16 October 2012], (原始内容存档于2012-10-14) 
  9. ^ Stable Chrome 24 supports MathML and closes security holes, The H Online, [11 January 2013], (原始内容于2017-04-21) 
  10. ^ Stable Channel Update, [7 April 2013], (原始内容于2016-11-04) 
  11. ^ Google subtracts MathML from Chrome, and anger multiplies. CNET. [22 November 2014]. (原始内容于2018-07-11). 
  12. ^ Frédéric Wang. . maths-informatique-jeux.com. [22 November 2014]. (原始内容存档于2014-12-14). 
  13. ^ McCathieNevile, Charles, Can Kestrels do Math? MathML support in Opera Kestrel, Opera, 27 September 2007 [2018-07-11], (原始内容存档于2012-03-12) 
  14. ^ Olsen, Tommy A., , Opera, 16 November 2007, (原始内容存档于18 November 2007) 
  15. ^ . My.opera.com (1 November 2007). Retrieved on 9 May 2012.
  16. ^ . My.opera.com. Retrieved on 9 May 2012.
  17. ^ , (原始内容存档于2013-03-08) 
  18. ^ MathPlayer – version history, [2018-07-11], (原始内容于2018-07-11) 
  19. ^ . dessci.com. [22 November 2014]. (原始内容存档于2014年7月1日). 
  20. ^ Bug 30526 – MathML support for Konqi, [2018-07-11], (原始内容于2018-06-10) 

外部链接 编辑

参见 编辑

数学置标语言, 数学标记语言, mathematical, markup, language, mathml, 是一种基于xml的标准, 用来描述数学符号和公式, 它的目标是把数学公式集成到万维网和其他文档中, 从2015年开始, mathml成为了html5的一部分和iso标准, 数学标记语言, mathml, 互联网, 媒体类型application, mathml, application, mathml, presentation, application, mathml, content, math, m. 数学标记语言 Mathematical Markup Language MathML 是一种基于XML的标准 用来描述数学符号和公式 它的目标是把数学公式集成到万维网和其他文档中 从2015年开始 MathML成为了HTML5的一部分和ISO标准 数学标记语言 MathML 互联网 媒体类型application mathml xml application mathml presentation xml application mathml content xml math mml开发者万维网联盟 W3C 格式类型标记语言扩展自XML标准Mathematical Markup Language MathML Version 3 0 2nd Edition网站W3C MathML由于数学符号和公式的结构复杂且符号与符号之间存在多种逻辑关系 MathML的格式十分繁琐 因此 大多数人都不会去手写MathML 而是利用其它的工具来编写 其中包括Te X到MathML的转换器 目录 1 历史 2 结构和语法 2 1 Presentation MathML 2 2 Content MathML 3 与其它格式的对比 4 在XHTML或HTML5文件中内嵌MathML 5 软件支持 5 1 浏览器 5 2 编辑器 5 3 手写识别 6 参考文献 7 外部链接 8 参见历史 编辑它是由W3C的数学工作组提出的 语言规格1 01版于1999年7月公布 2 0版于2001年2月出现 W3C的数学工作组在2003年10月发布了MathML 2 0的第二版 之后又在2010年10月发布了MathML 3 0 结构和语法 编辑MathML十分类似HTML 但非常繁琐 它继承了角括号和双标签 lt 标签 gt 内容 lt 标签 gt 的用法 MathML不但规定数学式子的表现 而且也规定数学数字的含义 前者叫做 Presentation MathML 后者叫做 Content MathML 由于数学式子的意义与表现是分离开的 如何交流内容留给了用户 例如 内嵌MathML的网页可以让许多浏览器按照正常的网页一样浏览 但是视觉受损者也可以用相同的MathML 通过屏幕阅读器 例如IE浏览器的MathPlayer插件 Opera浏览器9 50构建号9656 火狐浏览器的Fire Vox 英语 Fire Vox 附加组件 有声朗读出来 Presentation MathML 编辑 Presentation MathML 侧重于如何显示一个数学式子 大约有30个元素 元素名字全部以m开头 构建 Presentation MathML 表达式的记号是有一些更高层的元素组合而成的 这些元素控制它们的界面 大约有50个属性 基本很好地控制了细节 记号元素只包含文字 没有其他元素 它们有 lt mi gt x lt mi gt 标识符 lt mo gt lt mo gt 操作符 lt mn gt 2 lt mn gt 数字 lt mtext gt non zero lt mtext gt 文本注意到尽管这些记号元素能用于表示扩展要点 允许用宿主语言来标记 HTML5的MathML几乎允许在mtext中内联HTML标记 可以把HTML标记放在MathML中来标记内嵌文本 在例子中使得第一个单词加粗 并且 lt mtext gt lt b gt non lt b gt zero lt mtext gt 是合格的 这些是布局元素 它们都只能包含元素 它们有 lt mrow gt 水平的一行 lt msup gt lt munderover gt 等等 上标 规定上下操作符 就像求和号等等一样 lt mfrac gt 分数 lt msqrt gt 和 lt mroot gt 方根 lt mfenced gt 用栅隔离开内容 例如括号与HTML和XML一样 有许多实体来指定特殊符号 例如 amp pi 和 amp RightArrow 有趣的是 通常不可见操作符也依然存在实体 例如 amp InvisibleTimes 用于表示乘法运算中被省略的乘号 这些不可见操作符是 U 2061 函数应用 U 2062 不可见乘号 U 2063 不可见分隔符 U 2064 不可见加号MathML的完整实体说明在标准的第七章 并且和HTML与XML的协调在 1 页面存档备份 存于互联网档案馆 所以 表达式a x 2 b x c displaystyle ax 2 bx c nbsp 需要两个元素 一个是创建总体的水平行 另一个创建上标的指数 只有元素和 没有标记的 裸记号的布局的结构如下 lt mrow gt a amp InvisibleTimes lt msup gt x 2 lt msup gt b amp InvisibleTimes x c lt mrow gt 然而 单个记号也必须用标识符 mi 操作符 mo 或数字 mn 表示 添加到记号标记 完整的形式如下 lt mrow gt lt mi gt a lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt msup gt lt mi gt x lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt lt mo gt lt mi gt b lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mi gt c lt mi gt lt mrow gt 有效的MathML文档需要包含XML声明 DOCTYPE声明和文档元素 文档体包含位于 lt math gt 元素内的MathML表达式 通常 MathML会被内嵌于多种通用文档中 例如HTML DocBook 获知其它的XML模式 一个包含如上MathML的完整的文档显示如下 lt xml version 1 0 encoding UTF 8 gt lt DOCTYPE math PUBLIC W3C DTD MathML 2 0 EN http www w3 org Math DTD mathml2 mathml2 dtd gt lt math xmlns http www w3 org 1998 Math MathML gt lt mrow gt lt mi gt a lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt msup gt lt mi gt x lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt lt mo gt lt mi gt b lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mi gt c lt mi gt lt mrow gt lt math gt Content MathML 编辑 Content MathML 侧重于表达式的语义 而不是布局 中间的 Content MathML 是用 lt apply gt 元素来表示功能的具体应用 被应用的功能的长子元素放在 lt apply gt 下 并且它的操作数或参数是剩下来的子元素 Content MathML 只有少许属性 标识符和数字之类的记号被单独标记 就像 Presentation MathML 一样 但是元素类似 ci 和 cn 不同于仅仅是另一个类型的记号 操作符表示具体的元素 它们的数学语义可以从MathML中的制鞋符号中看出来 times power等等 为不同的功能和操作符超过100个不同的元素 见标准第四章 例如 lt apply gt lt sin gt lt ci gt x lt ci gt lt apply gt 代表sin x displaystyle sin x nbsp 而 lt apply gt lt plus gt lt ci gt x lt ci gt lt cn gt 5 lt cn gt lt apply gt 代表x 5 displaystyle x 5 nbsp 表示操作符和功能的元素是空元素 因为它们的操作数是其它在下面包含有 lt apply gt 的元素 表达式a x 2 b x c displaystyle ax 2 bx c nbsp 可以被表示为 lt math gt lt apply gt lt plus gt lt apply gt lt times gt lt ci gt a lt ci gt lt apply gt lt power gt lt ci gt x lt ci gt lt cn gt 2 lt cn gt lt apply gt lt apply gt lt apply gt lt times gt lt ci gt b lt ci gt lt ci gt x lt ci gt lt apply gt lt ci gt c lt ci gt lt apply gt lt math gt Content MathML 近乎是同构于一个功能语言 例如Scheme 中的表达式 lt apply gt lt apply gt 的数量就是Scheme的 而且许多操作符和功能元素的就是Scheme的函数 有了这些精细的文本转换 外加去标签的单独记号 上面的例子就成为 1 plus times a power x 2 times b x c 这放映出XML元素结构和LISP或Scheme的S 表达式的长期的亲密关系 2 3 与其它格式的对比 编辑例如 书写以下的二次方程求根公式 x b b 2 4 a c 2 a displaystyle x frac b pm sqrt b 2 4ac 2a nbsp 若用LaTeX 则只需要一行代码 x frac b pm sqrt b 2 4ac 2a 若用eqn 则也只需一行代码 x b sqrt b sup 2 4ac over 2a 若用Apache OpenOffice Math和LibreOffice Math 则也只需要一行代码 以下三种均可 x b plusminus sqrt b 2 4 ac over 2 a x b sqrt b 2 4ac over 2a x b sqrt b 2 4ac over 2a 若用ASCIIMathML 页面存档备份 存于互联网档案馆 则也只需要一行代码 x b sqrt b 2 4ac 2a 但用MathML 则需要 lt math mode display xmlns http www w3 org 1998 Math MathML gt lt mrow gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mfrac gt lt mrow gt lt mo form prefix gt amp x2212 lt gt lt mo gt lt mi gt b lt mi gt lt mo gt amp x00B1 lt amp PlusMinus gt lt mo gt lt msqrt gt lt msup gt lt mi gt b lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt amp x2212 lt gt lt mo gt lt mn gt 4 lt mn gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt a lt mi gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt c lt mi gt lt msqrt gt lt mrow gt lt mrow gt lt mn gt 2 lt mn gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt a lt mi gt lt mrow gt lt mfrac gt lt mrow gt lt annotation encoding TeX gt x frac b pm sqrt b 2 4ac 2a lt annotation gt lt annotation encoding StarMath 5 0 gt x b plusminus sqrt b 2 4 ac over 2 a lt annotation gt lt math gt 虽然如此 由于MathML是严格遵守XML规范的语言 很多已经运用XML的软件可以轻易的读懂MathML 这也是这种语言的制作者W3C组织宁可选择复杂的句法也要和标准一致的一个重要原因 在XHTML或HTML5文件中内嵌MathML 编辑MathML是一种XML 可以通过使用XML命名空间来嵌入XML文件中 例如XHTML文件 现代浏览器例如火狐浏览器版本3以上版本和Opera浏览器9 6以上版本 不完全支持 可以展示XHTML内嵌的MathML 例如 math test xhtml lt xml version 1 0 encoding UTF 8 gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 1 plus MathML 2 0 EN http www w3 org Math DTD mathml2 xhtml math11 f dtd gt lt html xmlns http www w3 org 1999 xhtml xml lang en gt lt head gt lt meta http equiv content type content text html charset UTF 8 gt lt title gt Example of MathML embedded in an XHTML file lt title gt lt meta name description content Example of MathML embedded in an XHTML file gt lt meta name keywords content Example of MathML embedded in an XHTML file gt lt head gt lt body gt lt h1 gt Example of MathML embedded in an XHTML file lt h1 gt lt p gt Given the quadratic equation lt math xmlns http www w3 org 1998 Math MathML gt lt mrow gt lt mi gt a lt mi gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt msup gt lt mi gt x lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt lt mo gt lt mi gt b lt mi gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mi gt c lt mi gt lt mo gt lt mo gt lt mi gt 0 lt mi gt lt mrow gt lt math gt the roots are given by lt math xmlns http www w3 org 1998 Math MathML gt lt mrow gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mfrac gt lt mrow gt lt mo form prefix gt amp x2212 lt gt lt mo gt lt mi gt b lt mi gt lt mo gt amp x00B1 lt amp PlusMinus gt lt mo gt lt msqrt gt lt msup gt lt mi gt b lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt amp x2212 lt gt lt mo gt lt mn gt 4 lt mn gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt a lt mi gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt c lt mi gt lt msqrt gt lt mrow gt lt mrow gt lt mn gt 2 lt mn gt lt mo gt amp x2062 lt amp InvisibleTimes gt lt mo gt lt mi gt a lt mi gt lt mrow gt lt mfrac gt lt mrow gt lt math gt lt p gt lt body gt lt html gt nbsp 使用带有 STIX 英语 STIX Fonts project Beta字体的 火狐浏览器3 5版显示MathML的图片例子 math test xhtml 而内联MathML同样被HTML5文件支持 支持的浏览器有当前版本的WebKit Safari 和Gecko Firefox 例如 math test htm lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF 8 gt lt title gt Example of MathML embedded in an HTML5 file lt title gt lt head gt lt body gt lt h1 gt Example of lt abbr title Mathematical Markup Language gt MathML lt abbr gt embedded in an lt abbr title HyperText Markup Language gt HTML lt abbr gt 5 file lt h1 gt lt p gt Given the quadratic equation lt math gt lt mrow gt lt mi gt a lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt msup gt lt mi gt x lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt lt mo gt lt mi gt b lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mi gt c lt mi gt lt mo gt lt mo gt lt mi gt 0 lt mi gt lt mrow gt lt math gt the roots are given by lt math gt lt mrow gt lt mi gt x lt mi gt lt mo gt lt mo gt lt mfrac gt lt mrow gt lt mo form prefix gt lt mo gt lt mi gt b lt mi gt lt mo gt amp PlusMinus lt mo gt lt msqrt gt lt msup gt lt mi gt b lt mi gt lt mn gt 2 lt mn gt lt msup gt lt mo gt lt mo gt lt mn gt 4 lt mn gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt a lt mi gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt c lt mi gt lt msqrt gt lt mrow gt lt mrow gt lt mn gt 2 lt mn gt lt mo gt amp InvisibleTimes lt mo gt lt mi gt a lt mi gt lt mrow gt lt mfrac gt lt mrow gt lt math gt lt p gt lt body gt lt html gt 软件支持 编辑浏览器 编辑 在现在几个主要的网页浏览器中 基于Gecko的浏览器 如Firefox 有最完备的原生支持 4 5 而WebKit排版引擎有针对MathML的开发版 6 这一特性只出现在Safari 5 1及更高版本 7 Chrome 24 8 9 但是不在后来的Chrome版本里面 10 Google移除了MathML支持 宣称架构上的安全问题和低使用量不会证明他们的维护时间有理 11 截至2013年10月年 2013年10月 Missing required parameter 1 month update WebKit Safari的实现存在多个bug 12 Opera 9 5 12支持MathML CSS配置 13 14 但不能使附加符号正确放置 15 9 5之前需要用户脚本或样式以模拟MathML支持 16 从Opera 14开始 Opera通过迁移到Chromium 25引擎移除了MathML支持 17 Internet Explorer原生不支持MathML IE6到IE9在安装了MathPlayer插件后也可以识别MathML 18 IE10使用MathPlayer时存在一些崩溃bug 并且微软决定在IE11完全禁止MathPlayer所需的二进制插件界面 19 MathPlayer有协议条款会限制在商用页面或软件上面的使用或发行 使用或发行MathPlayer插件以通过商用软件中的WebBrowser控件显示HTML内容也有可能受到禁止 基于KHTML的Konqueror不提供对MathML的支持 20 编辑器 编辑 MathML还得到了主要办公软件的支持 如Apache OpenOffice LibreOffice Microsoft Office 以及数学软件的支持 如Mathematica Maple Firemath 英语 Firemath 是火狐浏览器的附加组件 提供WYSIWYG的MathML编辑器 手写识别 编辑 Windows 7自带工具名叫Math Input Panel 可以把手写输入转换为MathML 参考文献 编辑 Calculadora Alicia 2022 11 10 Steven DeRose The SGML FAQ Book Understanding the Relationship of SGML and XML Kluwer Academic Publishers 1997 ISBN 978 0 7923 9943 8 Canonical S expressions cite note 0 英语 Canonical S expressions cite note 0 Wang Frederic Mozilla MathML Status Mozilla 2018 07 11 原始内容存档于2013 04 09 Sidje Roger B Authoring MathML for Mozilla Mozilla 2018 07 11 原始内容存档于2010 03 24 Bug 3251 Implement MathML master bug WebKit 2018 07 11 原始内容存档于2018 07 11 However see also https trac webkit org wiki MathML 20Status 页面存档备份 存于互联网档案馆 Safari 5 1 and math 2018 07 11 原始内容存档于2018 07 26 MathML Support Coming To Chrome BrowserFame 16 October 2012 原始内容存档于2012 10 14 Stable Chrome 24 supports MathML and closes security holes The H Online 11 January 2013 原始内容存档于2017 04 21 Stable Channel Update 7 April 2013 原始内容存档于2016 11 04 Google subtracts MathML from Chrome and anger multiplies CNET 22 November 2014 原始内容存档于2018 07 11 Frederic Wang Funding MathML Developments in Gecko and WebKit Blog de Frederic maths informatique jeux com 22 November 2014 原始内容存档于2014 12 14 McCathieNevile Charles Can Kestrels do Math MathML support in Opera Kestrel Opera 27 September 2007 2018 07 11 原始内容存档于2012 03 12 Olsen Tommy A Even more work Opera 16 November 2007 原始内容存档于18 November 2007 MathML The Opera MathML blog My opera com 1 November 2007 Retrieved on 9 May 2012 UserJS for MathML 2 0 My opera com Retrieved on 9 May 2012 Opera 14 beta for Android is out 原始内容存档于2013 03 08 MathPlayer version history 2018 07 11 原始内容存档于2018 07 11 Microsoft cripples the display of math in IE10 amp 11 dessci com 22 November 2014 原始内容存档于2014年7月1日 Bug 30526 MathML support for Konqi 2018 07 11 原始内容存档于2018 06 10 外部链接 编辑W3C MathML 页面存档备份 存于互联网档案馆 英文 MathPlayer 页面存档备份 存于互联网档案馆 英文 Internet Explorer的插件 MathML in Mozilla 页面存档备份 存于互联网档案馆 英文 Mozilla的MathML计划 WYSIWYG Equation editor 页面存档备份 存于互联网档案馆 英文 Pavi Sandhu The Mathml Handbook Charles River Media December 12 2002 2015 11 05 原始内容存档于2015 11 07 参见 编辑HTML XML TeX LaTeX W3C 取自 https zh wikipedia org w index php title 数学置标语言 amp oldid 80018369, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。