如何在支持 MathJax 的编辑器中使用 LaTeX 编辑数学公式

MathJax是什么?

MathJax是一个开源JavaScript库。它支持LaTeX、MathML、AsciiMath符号,可以运行于所有流行浏览器上。

LaTeX是什么?

LaTeX(LATEX,音译“拉泰赫”)是一种基于ΤΕΧ的排版系统。

如何使用LaTeX公式?(这里列出的是本人常用的,更多可以查看最后的“参考链接”)

  1. To see how any formula was written, right-click on the expression it and choose "Show Math As > TeX Commands"(When you do this, the '$' will not display.)

  2. For inline formulas, enclose the formula in $...$. For displayed formulas, use $$...$$.

  3. For superscripts and subscripts, use ^ and _. Don't forget {…} if the superscripts or subscripts are more than a single symbol。

  4. Sums and integrals \sum and \int; the subscript is the lower limit and the superscript is the upper limit, so for example \sum_1^n \(\sum_1^n\).

Matrices

矩阵语法:\begin{matrix}…\end{matrix} 同一行的元素之间使用 & 分割,每行以 \\ 结尾。如:

$$
    \begin{matrix}
    1 & x & x^2 \\
    1 & y & y^2 \\
    1 & z & z^2 \\
    \end{matrix}
$$

EX01. matrix 关键字可以替换成一下其他关键字。

关键字 显示
matrix \(\begin{matrix}1&2\\3&4\end{matrix}\)
pmatrix \(\begin{pmatrix}1&2\\3&4\end{pmatrix}\)
bmatrix \(\begin{bmatrix}1&2\\3&4\end{bmatrix}\)
Bmatrix \(\begin{Bmatrix}1&2\\3&4\end{Bmatrix}\)
vmatrix \(\begin{vmatrix}1&2\\3&4\end{vmatrix}\)
Vmatrix \(\begin{Vmatrix}1&2\\3&4\end{Vmatrix}\)

EX02. 不同方向的省略号。 \cdots -> \(\cdots\) \ddots -> \(\ddots\) \vdots -> \(\vdots\)

\[ \begin{pmatrix} 1 & a_1 & a_1^2 & \cdots & a_1^n \\ 1 & a_2 & a_2^2 & \cdots & a_2^n \\ \vdots & \vdots& \vdots & \ddots & \vdots \\ 1 & a_m & a_m^2 & \cdots & a_m^n \end{pmatrix} \]

EX03. 行中的小矩阵。 \bigl( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \bigr) -> \(\bigl( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \bigr)\)

参考:

MathJax basic tutorial and quick reference

猜你喜欢

转载自www.cnblogs.com/zdfffg/p/10136800.html