我选择的这个主题没有自带数学渲染器,(但写文章怎么能没有 latex 呢),所以就寻找安装 latex 办法这里给出一种简单方法。qwq
安装#
$ npm install hexo-filter-mathjax
$ hexo clean
配置#
在博客目录下的_config.yml 内添加
mathjax:
tags: none # or 'ams' or 'all'
single_dollars: true # 单个美元符号是否运用latex
cjk_width: 0.9 # relative CJK char width
normal_width: 0.6 # relative normal (monospace) width
append_css: true # add CSS to pages rendered by MathJax
every_page: false #如果设为true,每个页面都会加载mathjax 建议关闭
packages: # extra packages to load
extension_options: {}
# you can put your extension options here
# see http://docs.mathjax.org/en/latest/options/input/tex.html#tex-extension-options for more detail
在需要加载 latex 的 front-matter 写入mathjax: true
注意#
- 单个美元符号引入的公式美元符号,开头的 $ 后和结尾的 $ 前不能有空格
- 如果 latex 内符号和 markdown 语法有冲突 请用 \ 转义 如 * 要写成 \*
- this 可以将你的 latex 转义