1. 1. 安装
  2. 2. 配置
  3. 3. 注意

我选择的这个主题没有自带数学渲染器,(但写文章怎么能没有latex呢),所以就寻找安装latex办法这里给出一种简单方法。qwq

安装

1
2
$ npm install hexo-filter-mathjax
$ hexo clean

配置

在博客目录下的_config.yml内添加

1
2
3
4
5
6
7
8
9
10
11
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

注意

  1. 单个美元符号引入的公式美元符号,开头的$后和结尾的$前不能有空格
  2. 如果latex内符号和markdown语法有冲突 请用\转义 如* 要写成\*
  3. this 可以将你的latex转义