本文基于 asciidoctor 1.5.7.13,其通过 mathjax 实现 LaTex
字体的显示,方法和 markdown 差不多,区别是
markdown(不同差距实现方法不同)使用 $$
或者 $``$
包围 LaTex
语法,而 asciidoctor 使用 stem:[]
包围 LaTex 语法。
渲染后 | 源码 |
stem:[\cdot] |
|
stem:[\times] |
|
stem:[a^{prime} a] |
|
stem:[a’’] |
|
stem:[a’’’] |
|
stem:[\pm] |
|
stem:[\mp] |
|
stem:[!] |
|
stem:[\dots] |
|
stem:[\ldots] |
|
stem:[\cdots] |
|
stem:[\vdots] |
|
stem:[\ddots] |
|
渲染后 | 源码 |
15\\ 7 \end{array}right) |
|
| |
|
hexo中集成asciidoctor后渲染latex的bug
hexo, asciidoctor, latex 三者在一起组成了一个很小众的东西。实际上使用
ruby 安装的 asciidoctor 在使用起来完全没有问题,但是 hexo 中因为使用的是
nodejs 中的一个
hexo-renderer-asciidoc
插件对 hexo 增强了 asciidoctor 的功能,并且该插件会对 {
}
进行
转义,因此会导致莫名其妙的
问题出现。
另外 hexo 的 theme\next 主题中有 mathjax 的配置,将其设置为 true 后所有的页面都会引用 mathjax 的 js。
themes/next/_config.yml.
mathjax:
enable: true
per_page: false
cdn: //cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML
因此开启此项配置后,结合插件,页面上的 LaTex 公式就可以正常显示了。