添加Mathjax
新建load-mathjax.js
文件,然后在html中文件引入使用。
1window.MathJax = {2 tex: {3 inlineMath: [['$', '$'], ['\\(', '\\)']]4 },5 svg: {6 fontCache: 'global'7 }8};9
10(function () {11 var script = document.createElement('script');12 script.src = 'https://cdn.bootcdn.net/ajax/libs/mathjax/3.2.2/es5/tex-svg.js';13 script.async = true;14 document.head.appendChild(script);15})();
1<script async type="text/javascript" src="/load-mathjax.js"></script>
测试展示1
1$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
测试展示2
1- $ \mathbf{x}\_{0} $: the orignal image2- $ \mathbf{x}\_{T} $: the latent variable. We want $ \mathbf{x}_{T}\sim \mathcal{N}(0,\mathbf{I}) $.3- $ \mathbf{x}\_{1},\dots,\mathbf{x}\_{T-1}$: the intermediate states.
- $ \mathbf{x}_{0} $: the orignal image
- $ \mathbf{x}_{T} $: the latent variable. We want $ \mathbf{x}_{T}\sim \mathcal{N}(0,\mathbf{I}) $.
- $ \mathbf{x}_{1},\dots,\mathbf{x}_{T-1}$: the intermediate states.
优点:不需要添加其他插件即可在页面上直接显示公式。
缺点:添加了mathjax支持之后,网页加载会变慢。