{"id":1951,"date":"2025-02-23T14:41:38","date_gmt":"2025-02-23T06:41:38","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1951"},"modified":"2025-02-23T14:41:38","modified_gmt":"2025-02-23T06:41:38","slug":"html5-mathml","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/23\/html5-mathml\/","title":{"rendered":"HTML5 MathML"},"content":{"rendered":"\n<p><strong>MathML<\/strong>\uff08Mathematical Markup Language\uff09\u662f HTML5 \u4e2d\u7684\u4e00\u4e2a\u6807\u51c6\uff0c\u7528\u4e8e\u5728\u7f51\u9875\u4e0a\u8868\u793a\u6570\u5b66\u516c\u5f0f\u548c\u7b26\u53f7\u3002\u5b83\u662f\u4e00\u79cd\u57fa\u4e8e XML \u7684\u6807\u8bb0\u8bed\u8a00\uff0c\u53ef\u4ee5\u7528\u4e8e\u663e\u793a\u6570\u5b66\u8868\u8fbe\u5f0f\uff0c\u652f\u6301\u4ece\u7b80\u5355\u7684\u7b26\u53f7\u5230\u590d\u6742\u7684\u6570\u5b66\u516c\u5f0f\u3002MathML \u4f7f\u5f97\u6570\u5b66\u5185\u5bb9\u4e0d\u4ec5\u80fd\u5728\u7f51\u9875\u4e0a\u6b63\u786e\u663e\u793a\uff0c\u800c\u4e14\u4e5f\u53ef\u4ee5\u88ab\u5c4f\u5e55\u9605\u8bfb\u5668\u7b49\u8bbe\u5907\u7406\u89e3\uff0c\u589e\u5f3a\u4e86\u65e0\u969c\u788d\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>MathML \u57fa\u7840\u7ed3\u6784<\/strong><\/h3>\n\n\n\n<p>MathML \u57fa\u672c\u7ed3\u6784\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;math><\/code><\/strong> \u5143\u7d20\uff1a\u8fd9\u662f MathML \u7684\u6839\u5143\u7d20\uff0c\u5305\u542b\u6574\u4e2a\u6570\u5b66\u8868\u8fbe\u5f0f\u3002<\/li>\n\n\n\n<li><strong><code>&lt;mrow><\/code><\/strong> \u5143\u7d20\uff1a\u7528\u4e8e\u5c06\u591a\u4e2a MathML \u5143\u7d20\u6309\u884c\u7ec4\u5408\u8d77\u6765\u3002<\/li>\n\n\n\n<li><strong><code>&lt;mi><\/code><\/strong> \u5143\u7d20\uff1a\u8868\u793a\u6570\u5b66\u53d8\u91cf\u6216\u6807\u8bc6\u7b26\uff08\u4f8b\u5982 x, y\uff09\u3002<\/li>\n\n\n\n<li><strong><code>&lt;mn><\/code><\/strong> \u5143\u7d20\uff1a\u8868\u793a\u6570\u5b57\u6216\u5e38\u91cf\uff08\u4f8b\u5982 1, 2, 3\uff09\u3002<\/li>\n\n\n\n<li><strong><code>&lt;mo><\/code><\/strong> \u5143\u7d20\uff1a\u8868\u793a\u8fd0\u7b97\u7b26\uff08\u4f8b\u5982 +, -, *, \/\uff09\u3002<\/li>\n\n\n\n<li><strong><code>&lt;msup><\/code><\/strong> \u5143\u7d20\uff1a\u8868\u793a\u6307\u6570\uff08\u5982 <code>x^2<\/code>\uff09\u3002<\/li>\n\n\n\n<li><strong><code>&lt;msub><\/code><\/strong> \u5143\u7d20\uff1a\u8868\u793a\u4e0b\u6807\uff08\u5982 <code>a_1<\/code>\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>MathML \u793a\u4f8b<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. <strong>\u7b80\u5355\u7684\u6570\u5b66\u8868\u8fbe\u5f0f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;mi&gt;x&lt;\/mi&gt;\n    &lt;mo&gt;+&lt;\/mo&gt;\n    &lt;mi&gt;y&lt;\/mi&gt;\n    &lt;mo&gt;=&lt;\/mo&gt;\n    &lt;mi&gt;z&lt;\/mi&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;mi><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u53d8\u91cf <code>x<\/code>, <code>y<\/code>, \u548c <code>z<\/code>\u3002<\/li>\n\n\n\n<li><strong><code>&lt;mo><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u8fd0\u7b97\u7b26 <code>+<\/code> \u548c <code>=<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">2. <strong>\u5e26\u4e0a\u6807\u548c\u4e0b\u6807\u7684\u6570\u5b66\u8868\u8fbe\u5f0f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;msub&gt;\n        &lt;mi&gt;a&lt;\/mi&gt;\n        &lt;mn&gt;1&lt;\/mn&gt;\n    &lt;\/msub&gt;\n    &lt;mo&gt;+&lt;\/mo&gt;\n    &lt;msup&gt;\n        &lt;mi&gt;x&lt;\/mi&gt;\n        &lt;mn&gt;2&lt;\/mn&gt;\n    &lt;\/msup&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;msub><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u4e0b\u6807\uff1a<code>a_1<\/code>\u3002<\/li>\n\n\n\n<li><strong><code>&lt;msup><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u4e0a\u6807\uff1a<code>x^2<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">3. <strong>\u5206\u6570\u8868\u8fbe\u5f0f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;mfrac&gt;\n        &lt;mn&gt;1&lt;\/mn&gt;\n        &lt;mn&gt;2&lt;\/mn&gt;\n    &lt;\/mfrac&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;mfrac><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u5206\u6570\uff0c<code>&lt;mn><\/code> \u7528\u4e8e\u6570\u5b57 <code>1<\/code> \u548c <code>2<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">4. <strong>\u6839\u53f7\u8868\u8fbe\u5f0f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;msqrt&gt;\n        &lt;mn&gt;16&lt;\/mn&gt;\n    &lt;\/msqrt&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;msqrt><\/code><\/strong> \u7528\u4e8e\u8868\u793a\u5e73\u65b9\u6839\uff0c\u5185\u5bb9\u4e3a <code>16<\/code>\uff0c\u663e\u793a\u4e3a <code>\u221a16<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">5. <strong>\u77e9\u9635\u8868\u793a<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;mrow&gt;\n        &lt;mrow&gt;\n            &lt;mn&gt;1&lt;\/mn&gt;\n            &lt;mo&gt;&amp;#x2062;&lt;\/mo&gt;\n            &lt;mn&gt;2&lt;\/mn&gt;\n        &lt;\/mrow&gt;\n        &lt;mrow&gt;\n            &lt;mn&gt;3&lt;\/mn&gt;\n            &lt;mo&gt;&amp;#x2062;&lt;\/mo&gt;\n            &lt;mn&gt;4&lt;\/mn&gt;\n        &lt;\/mrow&gt;\n    &lt;\/mrow&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd9\u91cc\u901a\u8fc7 <code>&lt;mrow><\/code> \u6765\u7ec4\u5408\u77e9\u9635\u5143\u7d20\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>MathML \u5c5e\u6027<\/strong><\/h3>\n\n\n\n<p>MathML \u5143\u7d20\u53ef\u4ee5\u5305\u542b\u4e0d\u540c\u7684\u5c5e\u6027\u6765\u63a7\u5236\u6392\u7248\u3001\u5bf9\u9f50\u7b49\u7279\u6027\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. <strong><code>display<\/code> \u5c5e\u6027<\/strong><\/h4>\n\n\n\n<p><code>display<\/code> \u5c5e\u6027\u5b9a\u4e49\u6570\u5b66\u8868\u8fbe\u5f0f\u7684\u663e\u793a\u65b9\u5f0f\u3002\u5b83\u6709\u4e24\u4e2a\u4e3b\u8981\u503c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>block<\/code><\/strong>\uff1a\u4f7f\u6570\u5b66\u516c\u5f0f\u663e\u793a\u4e3a\u5757\u7ea7\u5143\u7d20\uff0c\u901a\u5e38\u7528\u4e8e\u590d\u6742\u7684\u6570\u5b66\u516c\u5f0f\u3002<\/li>\n\n\n\n<li><strong><code>inline<\/code><\/strong>\uff1a\u5c06\u6570\u5b66\u516c\u5f0f\u663e\u793a\u4e3a\u5185\u8054\u5143\u7d20\uff0c\u5d4c\u5165\u6587\u672c\u4e2d\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"&gt;\n    &lt;mi&gt;f&lt;\/mi&gt;\n    &lt;mo&gt;(&lt;\/mo&gt;\n    &lt;mi&gt;x&lt;\/mi&gt;\n    &lt;mo&gt;)&lt;\/mo&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">2. <strong><code>mathsize<\/code> \u5c5e\u6027<\/strong><\/h4>\n\n\n\n<p><code>mathsize<\/code> \u7528\u4e8e\u8bbe\u7f6e\u6570\u5b66\u8868\u8fbe\u5f0f\u7684\u5927\u5c0f\uff0c\u7c7b\u4f3c\u4e8e CSS \u4e2d\u7684 <code>font-size<\/code>\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" mathsize=\"24px\"&gt;\n    &lt;mi&gt;x&lt;\/mi&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>MathML \u4e0e CSS \u6837\u5f0f<\/strong><\/h3>\n\n\n\n<p>\u867d\u7136 MathML \u4e3b\u8981\u901a\u8fc7 XML \u6807\u7b7e\u8fdb\u884c\u6837\u5f0f\u63a7\u5236\uff0c\u4f46\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7 CSS \u8fdb\u4e00\u6b65\u63a7\u5236\u5b83\u7684\u5916\u89c2\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u793a\u4f8b\uff1a\u4f7f\u7528 CSS \u4fee\u6539 MathML \u6837\u5f0f<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;style&gt;\n    math {\n        font-family: \"Times New Roman\", serif;\n        font-size: 18px;\n    }\n    mi {\n        color: blue;\n    }\n    mo {\n        color: red;\n    }\n&lt;\/style&gt;\n\n&lt;math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"&gt;\n    &lt;mi&gt;x&lt;\/mi&gt;\n    &lt;mo&gt;+&lt;\/mo&gt;\n    &lt;mi&gt;y&lt;\/mi&gt;\n    &lt;mo&gt;=&lt;\/mo&gt;\n    &lt;mi&gt;z&lt;\/mi&gt;\n&lt;\/math&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>MathML \u7684\u6d4f\u89c8\u5668\u652f\u6301<\/strong><\/h3>\n\n\n\n<p>\u5c3d\u7ba1 MathML \u662f HTML5 \u7684\u4e00\u90e8\u5206\uff0c\u4f46\u5e76\u4e0d\u662f\u6240\u6709\u7684\u6d4f\u89c8\u5668\u90fd\u5b8c\u5168\u652f\u6301 MathML\u3002\u5927\u591a\u6570\u73b0\u4ee3\u6d4f\u89c8\u5668\uff08\u5982 Firefox\uff09\u90fd\u652f\u6301 MathML\uff0c\u7136\u800c\uff0c\u5176\u4ed6\u6d4f\u89c8\u5668\uff08\u5982 Chrome \u548c Safari\uff09\u53ef\u80fd\u9700\u8981\u989d\u5916\u7684\u63d2\u4ef6\u6216\u6269\u5c55\u6765\u6b63\u786e\u6e32\u67d3 MathML \u5185\u5bb9\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u89e3\u51b3\u65b9\u6848\uff1a<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>MathJax<\/strong>\uff1a\u4e00\u4e2a\u5f00\u6e90\u7684 JavaScript \u5e93\uff0c\u53ef\u4ee5\u5c06 MathML \u6216 LaTeX \u8f6c\u6362\u4e3a\u6d4f\u89c8\u5668\u53ef\u4ee5\u7406\u89e3\u7684\u683c\u5f0f\uff0c\u5f25\u8865\u6d4f\u89c8\u5668\u5bf9 MathML \u7684\u652f\u6301\u4e0d\u8db3\u3002<\/li>\n\n\n\n<li><strong>KaTeX<\/strong>\uff1a\u53e6\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u6570\u5b66\u516c\u5f0f\u6e32\u67d3\u5e93\uff0c\u53ef\u4ee5\u5728\u4e0d\u4f9d\u8d56 MathML \u7684\u60c5\u51b5\u4e0b\u652f\u6301\u9ad8\u8d28\u91cf\u7684\u6570\u5b66\u6e32\u67d3\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>MathML \u4e0e\u5176\u4ed6\u6570\u5b66\u6807\u8bb0\u8bed\u8a00<\/strong><\/h3>\n\n\n\n<p>\u9664\u4e86 MathML\uff0c\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u7684\u65b9\u5f0f\u53ef\u4ee5\u5728\u7f51\u9875\u4e2d\u5d4c\u5165\u6570\u5b66\u516c\u5f0f\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>LaTeX<\/strong>\uff1a\u901a\u8fc7\u4f7f\u7528 LaTeX \u8bed\u6cd5\uff0c\u4f60\u53ef\u4ee5\u5728\u6570\u5b66\u516c\u5f0f\u4e2d\u4f7f\u7528\u4e30\u5bcc\u7684\u7b26\u53f7\u548c\u6392\u7248\u65b9\u5f0f\u3002<\/li>\n\n\n\n<li><strong>MathJax<\/strong>\uff1a\u4e00\u4e2a\u652f\u6301 LaTeX \u548c MathML \u6e32\u67d3\u7684 JavaScript \u5e93\uff0c\u53ef\u4ee5\u5728\u4e0d\u652f\u6301 MathML \u7684\u6d4f\u89c8\u5668\u4e2d\u663e\u793a\u6570\u5b66\u516c\u5f0f\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u5c0f\u7ed3<\/h3>\n\n\n\n<p>MathML \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u4e13\u4e3a\u7f51\u9875\u4e2d\u5c55\u793a\u6570\u5b66\u516c\u5f0f\u800c\u8bbe\u8ba1\u3002\u5b83\u901a\u8fc7 XML \u6807\u7b7e\u7ed3\u6784\u63d0\u4f9b\u4e86\u826f\u597d\u7684\u8bed\u4e49\u5316\u8868\u8fbe\uff0c\u4f7f\u6570\u5b66\u516c\u5f0f\u4e0d\u4ec5\u80fd\u88ab\u4eba\u7c7b\u8bfb\u8005\u7406\u89e3\uff0c\u8fd8\u80fd\u88ab\u673a\u5668\u5904\u7406\u3002\u5c3d\u7ba1\u5b83\u5728\u4e0d\u540c\u6d4f\u89c8\u5668\u4e2d\u7684\u652f\u6301\u60c5\u51b5\u53ef\u80fd\u4e0d\u5b8c\u5168\u4e00\u81f4\uff0c\u4f46\u901a\u8fc7\u50cf MathJax \u6216 KaTeX \u8fd9\u6837\u7684\u5e93\uff0c\u53ef\u4ee5\u786e\u4fdd\u6570\u5b66\u516c\u5f0f\u5728\u6240\u6709\u73af\u5883\u4e2d\u7684\u517c\u5bb9\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MathML\uff08Mathematical Markup Language\uff09\u662f HTML5 \u4e2d\u7684\u4e00\u4e2a\u6807\u51c6\uff0c\u7528\u4e8e\u5728\u7f51 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[],"class_list":["post-1951","post","type-post","status-publish","format-standard","hentry","category-html5"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1951"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1951\/revisions"}],"predecessor-version":[{"id":1952,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1951\/revisions\/1952"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}