MathJax 数学公式

Mathjax 数学公式

使用插件 hexo-filter-mathjax (opens in a new tab) 可以在文章中使用 LaTeX 语法书写数学公式。

效果

image

配置方法

安装插件

在 Hexo 项目根目录下安装插件 hexo-filter-mathjax,请执行如下命令

npm install hexo-filter-mathjax

修改配置文件

在 Hexo 配置文件 _config.yml 最底下增加如下配置。

_config.yml
mathjax:
  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 every page
  every_page: false        # if true, every page will be rendered by mathjax regardless the `mathjax` setting in Front-matter of each article

在文章中使用

在文章页添加 mathjax: true 属性,至此,就可以在该页面中写公式了。

示例:

---
title: MathJax Test
date: 2020-09-12 16:02:07
tags: MathJax
categories: MathJax
mathjax: true
---
$$
i\hbar\frac{\partial}{\partial t}\psi=-\frac{\hbar^2}{2m}\nabla^2\psi+V\psi
$$

更多

实际体验欢迎前往 Redefine 演示站点 (opens in a new tab)