{"id":2631,"date":"2015-10-27T15:22:33","date_gmt":"2015-10-27T07:22:33","guid":{"rendered":"http:\/\/blog.hoyo.idv.tw\/?p=2631"},"modified":"2017-05-08T13:34:36","modified_gmt":"2017-05-08T05:34:36","slug":"mathjax-%e4%bd%bf%e7%94%a8-javascript-%e9%a1%af%e7%a4%ba%e6%95%b8%e5%ad%b8%e5%85%ac%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=2631","title":{"rendered":"MathJax \u4f7f\u7528 JavaScript \u986f\u793a\u6578\u5b78\u516c\u5f0f"},"content":{"rendered":"<p>\u9019\u7bc7\u770b\u4e0d\u61c2\u5f88\u6b63\u5e38\uff0c\u6c92\u63a5\u89f8\u904e\u51fa\u7248\u3001\u6559\u80b2\u7684\u4eba\u61c9\u8a72\u5f88\u96e3\u60f3\u50cf\uff0c\u8981\u5728\u7db2\u9801\u4e0a\u986f\u793a\u512a\u7f8e\u7684\u6578\u5b78\u516c\u5f0f\u662f\u591a\u9ebc\u56f0\u96e3\u7684\u4e8b\u60c5\u3002<\/p>\n<p>\u63a5\u89f8\u904e\u7684\u4eba\uff0c\u5927\u6982\u6703\u8a8d\u8b58\u4e00\u500b\u53eb LaTeX \u7684\u50a2\u4f19\uff0c\u9019\u500b\u6642\u5019\u5c31\u6703\u77e5\u9053 MathJax \u7684\u5049\u5927\u4e4b\u8655\u4e86\u3002<\/p>\n<p>\u5b98\u7db2\uff1a\u00a0<a href=\"https:\/\/www.mathjax.org\/\">MathJax<\/a><\/p>\n<pre class=\"nums:false lang:default highlight:0 decode:true\">MathJax is a cross-browser JavaScript library that displays mathematical notation in web browsers, using MathML, LaTeX and ASCIIMathML markup. MathJax is released as open-source software under the Apache license.<\/pre>\n<p>\u55ae\u7d14\u5728\u700f\u89bd\u5668\u4e0a\u986f\u793a LaTeX \u6578\u5b78\u516c\u5f0f\u53ef\u4ee5\u4f7f\u7528\u6b64 JavaScript library\uff0c\u9700\u8981\u5e73\u9762 PDF \u8f38\u51fa\u624d\u4f7f\u7528 LaTeX \u57f7\u884c<\/p>\n<p>&nbsp;<\/p>\n<p>\u7bc4\u4f8b\u6f14\u793a\u5169\u500b\u529f\u80fd<\/p>\n<ol>\n<li>ajax \u8f09\u5165\u7684\u8cc7\u6599\u5982\u4f55\u5957\u7528 MathJax<\/li>\n<li>\u5982\u4f55\u628a\u6240\u6709\u7684 LaTeX \u5957\u7528\u00a0\\displaystyle \uff0c\u53c3\u8003\u81f3\uff1a<a href=\"http:\/\/www.28im.com\/javascript\/a997848.html\" target=\"_blank\">\u5982\u4f55\u5c06\u4e00\u4e9bhtml\u4e4b\u524d\u548c\u4e4b\u540e\u4f7f\u7528MathJax\u6570\u5b66\u65f6\u5448\u73b0How to put some html before and after math when rendering using MathJax<\/a>\u00a0(\u88e1\u9762\u6709\u539f\u51fa\u8655\uff0c\u6211\u6709\u67e5\u5230\u7d93\u904e\uff0c\u4e0d\u904e\u770b\u4e0d\u61c2)<\/li>\n<\/ol>\n<pre class=\"lang:default decode:true\">&lt;script&gt;\r\n    $(document).ajaxStop(function () {\r\n        MathJax.Hub.Queue([\"Typeset\",MathJax.Hub,\".Question\"]);\r\n    });\r\n\r\n    MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {\r\n        var TEX = MathJax.InputJax.TeX;\r\n        var PREFILTER = TEX.prefilterMath;\r\n        TEX.Augment({\r\n            prefilterMath: function (math,displaymode,script) {\r\n                math = \"\\\\displaystyle{\"+math+\"}\";\r\n                return PREFILTER.call(TEX,math,displaymode,script);\r\n            }\r\n        });\r\n    });\r\n&lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"2631\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,593&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u7bc7\u770b\u4e0d\u61c2\u5f88\u6b63\u5e38\uff0c\u6c92\u63a5\u89f8\u904e\u51fa\u7248...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"2631\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,593&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[262],"tags":[190,189,202],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2631"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2631"}],"version-history":[{"count":7,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2631\/revisions"}],"predecessor-version":[{"id":2695,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2631\/revisions\/2695"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}