目录

HTML5 - MathML

HTML5的HTML语法允许使用<math> ... </math>标记在文档中使用MathML元素。

大多数Web浏览器都可以显示MathML标记。 如果您的浏览器不支持MathML,那么我建议您使用最新版本的Firefox。

MathML示例

以下是带有MathML的有效HTML5文档 -

<!doctype html>
<html>
   <head>
      <meta charset = "UTF-8">
      <title>Pythagorean theorem</title>
   </head>
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
         <mrow>
            <msup><mi>a</mi><mn>2</mn></msup>
            <mo>+</mo>
            <msup><mi>b</mi><mn>2</mn></msup>
            <mo> = </mo>
            <msup><mi>c</mi><mn>2</mn></msup>
         </mrow>
      </math>
   </body>
</html> 

这将产生以下结果 -

新页面打开

使用MathML字符

考虑以下是使用字符和InvisibleTimes的标记; -

<!doctype html>
<html>
   <head>
      <meta charset = "UTF-8">
      <title>MathML Examples</title>
   </head>
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
         <mrow>			
            <mrow>
               <msup>
                  <mi>x</mi>
                  <mn>2</mn>
               </msup>
               <mo>+</mo>
               <mrow>
                  <mn>4</mn>
                  <mo>⁢</mo>
                  <mi>x</mi>
               </mrow>
               <mo>+</mo>
               <mn>4</mn>
            </mrow>
            <mo>=</mo>
            <mn>0</mn>
         </mrow>
      </math>
   </body>
</html> 

这将产生以下结果。 如果您无法看到x 2 + 4x + 4 = 0等正确结果,请使用Firefox 3.5或更高版本。

这将产生以下结果 -

新页面打开

矩阵演示示例

考虑以下用于表示简单2x2矩阵的示例 -

<!doctype html>
<html>
   <head>
      <meta charset = "UTF-8">
      <title>MathML Examples</title>
   </head>
   <body>
      <math xmlns = "http://www.w3.org/1998/Math/MathML">
         <mrow>
            <mi>A</mi>
            <mo>=</mo>
            <mfenced open = "[" close="]">
               <mtable>
                  <mtr>
                     <mtd><mi>x</mi></mtd>
                     <mtd><mi>y</mi></mtd>
                  </mtr>
                  <mtr>
                     <mtd><mi>z</mi></mtd>
                     <mtd><mi>w</mi></mtd>
                  </mtr>
               </mtable>
            </mfenced>
         </mrow>
      </math>
   </body>
</html> 

这将产生以下结果 -

新页面打开

这将产生以下结果。 如果您无法看到正确的结果,请使用Firefox 3.5或更高版本。

MATHML
↑回到顶部↑
WIKI教程 @2018