问题简介
通过MathJax渲染LateX公式在markdown中显示
以前Github博客markdown文章中插入公式都是用word写好公式,然后截图放入github page的文件夹,然后通过

输出图片的形式显示公式的。
能不能通过Late形式输出公示,搜集了网上资料可以通过MathJax渲染在markdown输出LateX公式。
实现方式
添加MathJax渲染
首先在github page的_includes/header.html的head中增加MathJax渲染Latex公式的引擎,代码如下
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
inlineMath: [['$','$']]
}
});
</script>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
生成LateX公式
生成Latex公式可以使用word自带的公式编辑器、MathType、或者Latex公式在线编辑器等,这里以word为例。
- Microsoft Word2016以上或者Office365.
- 输入你想转换的公式.
- 在Word 2016中选择该公式,上面的选项卡在“设计”一栏。
- 在选项卡中选择 “{}LaTeX” 选项:
- 复制这个公式:
2.3 拷贝公式到markdown
公式两边需要加$或$$,粘贴到markdown中,最后公式效果如下:
\[{|\left|x\right||}_p={(\sum_{i}{|x_i|}_p)}^\frac{1}{p}\] \[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\]参考
How to support latex in github-pages?
您的打赏是对我最大的鼓励!