7

使用MathJax时的注意事项

 2 years ago
source link: https://blog.xpgreat.com/p/mathjax_tips/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

记录一些在使用MathJax写公式时踩过的坑,持续更新。本来放在另一篇里的,内容越来越多,单独成篇。

用无法输入行内公式

MathJax默认禁用了这种方式,你可以使用\\( 你的公式 \\)的方法,也可以参考它的default.js自行配置(在295行)。行间公式默认可以用\\[ 你的公式 \\]或者传统的TeX写法$$ 你的公式 $$

输入下标出错

x_{abc}这样使用的时候会莫名其妙的报错,试了一下把_转义:x\_{abc},就能用了。

公式不能换行

因为md解析的时候把\\解析成了一个\,解决方法是用四根\\\\ 换行(最后要加一个半角空格)。(也是醉了)

直接上代码:

\begin{aligned}
&\nabla_{\mathbf x}A\mathbf x = A \\\\ 
&\frac{\partial \mathbf x^T \mathbf a}{\partial \mathbf x} = \frac{\partial \mathbf a^T \mathbf x}{\partial \mathbf x} = \mathbf a \\\\ 
\end{aligned}

效果: ∇xAx=A∂xTa∂x=∂aTx∂x=a \begin{aligned} &\nabla_{\mathbf x}A\mathbf x = A \\ &\frac{\partial \mathbf x^T \mathbf a}{\partial \mathbf x} = \frac{\partial \mathbf a^T \mathbf x}{\partial \mathbf x} = \mathbf a \\ \end{aligned} ​∇x​Ax=A∂x∂xTa​=∂x∂aTx​=a​

自定义运算名,比如argmax

\\underset{\mathbf w}{\operatorname{argmax}} \frac{\mathbf w^TS_B\mathbf w}{\mathbf w^TS_B\mathbf w} 

argmax⁡wwTSBwwTSBw \underset{\mathbf w}{\operatorname{argmax}} \frac{\mathbf w^TS_B\mathbf w}{\mathbf w^TS_B\mathbf w} wargmax​wTSB​wwTSB​w​


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK