hexo-theme-redefine
博客Github
中文
中文
  • 项目介绍
  • 开始
    • 安装
    • 使用
    • 更新
  • 配置
    • 创建主题配置文件
    • base_info
    • style
      • primary_color
      • avatar
      • favicon
      • article_img_align
      • left_side_width
      • content_max_width
      • nav_color
      • hover
      • first_screen
      • scroll
    • social_contact
    • menu
    • home_article
    • post
      • word_count
      • author_label
    • code_copy
    • toc
    • copyright_info
    • website_count
    • local_search
    • comment
      • use
      • Waline
      • Gitalk
      • Twikoo
    • rss
    • lazyload
    • cdn
    • pjax
    • footer
  • 进阶使用
    • 数学公式
    • 创建页面
    • 友链样式
    • 资源压缩
    • 笔记模块
    • 文件比对
    • 文章顶置
由 GitBook 提供支持
在本页
  1. 进阶使用

数学公式

上一页footer下一页创建页面

最后更新于2年前

如果要在文章中显示数学公式,可以使用插件 。

配置流程:

  1. 在 Hexo 项目根目录下安装插件 hexo-filter-mathjax。

    $ cd hexo-site
    $ npm install hexo-filter-mathjax
  2. 在 Hexo 配置文件 _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
  3. 在文章页添加 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
    $$

    效果图:

hexo-filter-mathjax