next-theme / hexo-filter-mathjax

💯 Server side MathJax renderer plugin for Hexo.
https://www.npmjs.com/package/hexo-filter-mathjax
MIT License
105 stars 6 forks source link

physics宏包支持 #52

Closed ZJY0516 closed 2 years ago

ZJY0516 commented 2 years ago
 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

我想加入physics宏包,但是我没有搞懂应该如何填写配置文件,请问能否给出一个示例。

stevenjoezhang commented 2 years ago

试试这样

mathjax:
  extension_options:
    packages: {'[+]': ['physics']}
ZJY0516 commented 2 years ago

按照上面所说加载了physics宏包后,默认加载的的那些宏包消失了。 $\LaTeX$代码如下:

$$
\dd{(x^2)}=2x \dd{x}
$$

$$
\bra{\psi} \quad \ket{\psi}
$$

$$
\laplacian{\Psi} \quad \curl{\vb{a}} \quad \div{\vb{a}} \quad \grad{\Psi}
$$

$$
\begin{vmatrix}
1 & 2\\
3 & 4\\
\end{vmatrix}
$$

$$
\verb|\sqrt|
$$

其中第一个和第三个为physics宏包支持的功能,第二个为braketphysics宏包共有的功能,第四个为ams宏包的功能,第五个为verb宏包的功能。 在没有修改extension_options时渲染结果如下 image 加载physics宏包后只有一、二、三行可以正常渲染。 image 我的猜测:是否应该同时加载physicsautoload。 如果是这样,请问能否给出一个同时加载两个宏包的示例。

stevenjoezhang commented 2 years ago

我修改了一下: https://github.com/next-theme/hexo-filter-mathjax/commit/c752ffacead3336c220a2b2d358713efeb0f5e09 您也照着这个 commit 改改 lib/filter.js (也就是 Hexo 目录下的 node_modules/hexo-filter-mathjax/lib/filter.js),然后这样设置

mathjax:
  packages:
    - physics
ZJY0516 commented 2 years ago

可以了!感谢!!Thanks♪(・ω・)ノ