Hexo
操作方法
- 首先在电脑本地安装
Pandoc,并确保被添加在系统变量中。 - 卸载原有的渲染引擎
1
2npm uninstall hexo-math --save
npm uninstall hexo-renderer-marked --save - 安装渲染引擎和插件
1
2npm install hexo-renderer-pandoc --save
npm install hexo-filter-mathjax --save - 修改
Hexo 根目录的 _config.yml
配置文件 此配置是对插件1
2
3
4
5
6
7
8
9
10
11mathjax:
tags: none # or 'ams' or 'all'
single_dollars: true # enable single dollar signs as in-line math delimiters
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 # if true, every page will be rendered by MathJax regardless the `mathjax` setting in Front-matter
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 detailhexo-filter-mathjax 进行设置,详细设置可以参考该插件的主页。 - 如果在上一步配置了
every_page: false
,即默认不开启数学公式渲染功能,则只在需要渲染LaTeX 的 Markdown 文件前部添加 mathjax
选项 1
2
3
4
5
6---
title: Hexo LaTeX数学公式渲染
date: 2025-05-24 09:02:06
category: Hexo
mathjax: true
--- - 清除之前的渲染结果
hexo clean
- 重新编译
hexo g
问题
Pandoc 自动图注渲染
使用pandoc
_config.yml
1 | pandoc: |
LaTeX 行内数学公式渲染
按照$...$
)的起始$
$
$
$
$Ax=b$
:Ax = b$ Ax=b $
:
MathJax 包的使用
hexo-filter-mathjax
行间公式
1 | $$ \boldsymbol{Ax}=\color{red}\boldsymbol{b} $$ |
行内公式
1 | $ \\boldsymbol{Ax}=\\color{red}\\boldsymbol{b} $ |
备注
LaTeX
测试
1 | $$ |
1 | $$i\hbar\frac{\partial}{\partial t}\psi=-\frac{\hbar^2}{2m}\nabla^2\psi+V\psi$$ |
1 | $$ |