0%
Edit
Markdown的书写工具多如牛毛,但是实现方式不尽相同,有些支持LaTex有些不支持。支持者如马克飞象,CMD工作站;不支持者如我正在用的MacDown。不过没关系,因为Markdown与HTML的天生联系,我们可以很好的内嵌MathJax来解决这个问题。
官方文档说要将下面这个标签加到网页的中,不过我们加到中使用效果也是一样
1.<script type="text/javascript"
2. src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js">
3.</script>
检验一下效果
- 行级:
$\daleth$
- Science of Programming中常用的符号,表示取反 - 块级
$$bla..bla..bla$$
另外一点还需要说明的是,Markdown中行内内嵌数学公式的标记是$...$
,而MathJax默认并不支持该标记,官方的说法是
That is because dollar signs appear too often in non-mathematical settings, which could cause some text to be treated as mathematics unexpectedly.
MathJax中默认的行内内嵌公式标记是\(...\)
,写作\\(...\\)
,例如\\(\daleth\\)
加上下面这段代码就能让MathJax支持$...$
了
1.<script type="text/x-mathjax-config"> MathJax.Hub.Config({
2. tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script>
3.<script type="text/javascript" src="path-to-mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
而马克飞象中的MathJax可能经过定制,是默认支持$...$
内嵌的
%3Cscript%20type%3D%22text/javascript%22%0A%09%20src%3D%22https%3A//cdn.mathjax.org/mathjax/latest/MathJax.js%3Fconfig%3DTeX-AMS-MML_HTMLorMML.js%22%3E%0A%3C/script%3E%0A%5BTOC%5D%0A%23Markdown%u5BF9%u6570%u5B66%u516C%u5F0F%u7684%u652F%u6301%0A@%28%u5B66%u4E60%u7B14%u8BB0%29%5BMarkdown%5D%0AMarkdown%u7684%u4E66%u5199%u5DE5%u5177%u591A%u5982%u725B%u6BDB%uFF0C%u4F46%u662F%u5B9E%u73B0%u65B9%u5F0F%u4E0D%u5C3D%u76F8%u540C%uFF0C%u6709%u4E9B%u652F%u6301LaTex%u6709%u4E9B%u4E0D%u652F%u6301%u3002%u652F%u6301%u8005%u5982%u9A6C%u514B%u98DE%u8C61%uFF0CCMD%u5DE5%u4F5C%u7AD9%uFF1B%u4E0D%u652F%u6301%u8005%u5982%u6211%u6B63%u5728%u7528%u7684MacDown%u3002%u4E0D%u8FC7%u6CA1%u5173%u7CFB%uFF0C%u56E0%u4E3AMarkdown%u4E0EHTML%u7684%u5929%u751F%u8054%u7CFB%uFF0C%u6211%u4EEC%u53EF%u4EE5%u5F88%u597D%u7684%u5185%u5D4C%5BMathJax%5D%28http%3A//docs.mathjax.org/en/latest/start.html%23mathjax-cdn%29%u6765%u89E3%u51B3%u8FD9%u4E2A%u95EE%u9898%u3002%0A%0A%23%23MathJax%0A%u5B98%u65B9%u6587%u6863%u8BF4%u8981%u5C06%u4E0B%u9762%u8FD9%u4E2A%u6807%u7B7E%u52A0%u5230%u7F51%u9875%u7684%3Chead%3E%u4E2D%uFF0C%u4E0D%u8FC7%u6211%u4EEC%u52A0%u5230%3Cbody%3E%u4E2D%u4F7F%u7528%u6548%u679C%u4E5F%u662F%u4E00%u6837%0A%09%0A%09%3Cscript%20type%3D%22text/javascript%22%0A%09%20%20src%3D%22https%3A//cdn.mathjax.org/mathjax/latest/MathJax.js%3Fconfig%3DTeX-AMS-MML_HTMLorMML.js%22%3E%0A%09%3C/script%3E%0A%09%0A%09%0A%u68C0%u9A8C%u4E00%u4E0B%u6548%u679C%0A%0A*%20%u884C%u7EA7%3A%20%0A%20%20%20%20%5C%24%5Cdaleth%5C%24%0A%24%5Cdaleth%24%20-%20Science%20of%20Programming%u4E2D%u5E38%u7528%u7684%u7B26%u53F7%uFF0C%u8868%u793A%u53D6%u53CD%0A*%20%u5757%u7EA7%0A%20%20%20%20%5C%24%5C%24bla..bla..bla%5C%24%5C%24%0A%24%24x%3D%5Cfrac%7B-b%5Cpm%5Csqrt%7Bb%5E2-4ac%7D%7D%7B2a%7D%24%24%0A%0A%u53E6%u5916%u4E00%u70B9%u8FD8%u9700%u8981%u8BF4%u660E%u7684%u662F%uFF0CMarkdown%u4E2D%u884C%u5185%u5185%u5D4C%u6570%u5B66%u516C%u5F0F%u7684%u6807%u8BB0%u662F%60%24...%24%60%uFF0C%u800CMathJax%u9ED8%u8BA4%u5E76%u4E0D%u652F%u6301%u8BE5%u6807%u8BB0%uFF0C%u5B98%u65B9%u7684%u8BF4%u6CD5%u662F%0A%3EThat%20is%20because%20dollar%20signs%20appear%20too%20often%20in%20non-mathematical%20settings%2C%20which%20could%20cause%20some%20text%20to%20be%20treated%20as%20mathematics%20unexpectedly.%0A%0AMathJax%u4E2D%u9ED8%u8BA4%u7684%u884C%u5185%u5185%u5D4C%u516C%u5F0F%u6807%u8BB0%u662F%60%5C%28...%5C%29%60%uFF0C%u5199%u4F5C%60%5C%5C%28...%5C%5C%29%60%uFF0C%u4F8B%u5982%60%5C%5C%28%5Cdaleth%5C%5C%29%60%u52A0%u4E0A%u4E0B%u9762%u8FD9%u6BB5%u4EE3%u7801%u5C31%u80FD%u8BA9MathJax%u652F%u6301%60%24...%24%60%u4E86%0A%60%60%60xml%0A%3Cscript%20type%3D%22text/x-mathjax-config%22%3E%20MathJax.Hub.Config%28%7B%20%0A%20%20%20%20tex2jax%3A%20%7BinlineMath%3A%20%5B%5B%27%24%27%2C%27%24%27%5D%2C%20%5B%27%5C%5C%28%27%2C%27%5C%5C%29%27%5D%5D%7D%20%7D%29%3B%20%3C/script%3E%20%0A%3Cscript%20type%3D%22text/javascript%22%20src%3D%22path-to-mathjax/MathJax.js%3Fconfig%3DTeX-AMS-MML_HTMLorMML%22%3E%3C/script%3E%0A%60%60%60%0A%0A%u800C%u9A6C%u514B%u98DE%u8C61%u4E2D%u7684MathJax%u53EF%u80FD%u7ECF%u8FC7%u5B9A%u5236%uFF0C%u662F%u9ED8%u8BA4%u652F%u6301%60%24...%24%60%u5185%u5D4C%u7684%0A