简易MathJax指南
阅读
2025-08-14更新
最新编辑:glamcurrent
阅读:
更新日期:2025-08-14
最新编辑:glamcurrent
基本MathJax使用
想要书写数学公式时,须使用<math>
<math>
</math>
由于biligame的simple MathJax默认不开启ams自动编号,因此以下两种公式表达方法在外观上无任何区别:
示例代码 | 效果 | |
---|---|---|
不使用\begin{equation}
|
<math>
e=\lim_{n\to \infty}(1+\frac{1}{n})^n
</math>
|
[math]\displaystyle{ e=\lim_{n\to \infty}(1+\frac{1}{n})^n }[/math] |
使用\begin{equation}
|
<math>
\begin{equation}
e=\lim_{n\to \infty}(1+\frac{1}{n})^n
\end{equation}
</math>
|
[math]\displaystyle{ \begin{equation} e=\lim_{n\to \infty}(1+\frac{1}{n})^n \end{equation} }[/math] |
若有编号需求,须自行进行标记,\begin{equation}
不会自动进行编号,例如以下示例:
<math>
\begin{equation}
m=\frac{m_0}{\sqrt{1-v^2/c^2}}
\end{equation}
</math>
[math]\displaystyle{ \begin{equation} m=\frac{m_0}{\sqrt{1-v^2/c^2}} \end{equation} }[/math]
以下是带编号示例:
<math>
\begin{equation}
\label{first}
\tag{1}
e=\lim_{n\to \infty}(1+\frac{1}{n})^n
\end{equation}
</math>
[math]\displaystyle{ \begin{equation} \label{first} \tag{1} e=\lim_{1\to \infty}(1+\frac{1}{n})^n \end{equation} }[/math]
其中\tag{}
控制显示的公式编号,\label{}
控制在引用时的编号参数,若为\label{first}
,则引用时为\ref{first}
,例如引用上方的公式的效果:[math]\displaystyle{ \ref{first} }[/math](\ref{first}
)
数组示例
代码 | 渲染效果 |
---|---|
<math>
\begin{array}{lcl}
g(x) & = & (x+2)^2 & = (x+2)(x+2)\\ % This row triggers the error
& = & x^2+4x+4\\
\end{array}
</math>
|
[math]\displaystyle{ \begin{array}{lcl} g(x) & = & (x+2)^2 & = (x+2)(x+2)\\ % This row triggers the error & = & x^2+4x+4\\ \end{array} }[/math] |
矩阵示例
矩阵类型 | 代码 | 渲染效果 |
---|---|---|
matrix | <math>
\begin{matrix}
0 & 1 \\
1 & 0 \\
\end{matrix}
</math>
|
[math]\displaystyle{ \begin{matrix} 0 & 1 \\ 1 & 0 \\ \end{matrix} }[/math] |
bmatrix | <math>
\begin{bmatrix}
0 & 1 \\
1 & 0 \\
\end{matrix}
</math>
|
[math]\displaystyle{ \begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix} }[/math] |
pmatrix | <math>
\begin{pmatrix}
0 & 1 \\
1 & 0 \\
\end{pmatrix}
</math>
|
[math]\displaystyle{ \begin{pmatrix} 0 & 1 \\ 1 & 0 \\ \end{pmatrix} }[/math] |
vmatrix | <math>
\begin{vmatrix}
0 & 1 \\
1 & 0 \\
\end{vmatrix}
</math>
|
[math]\displaystyle{ \begin{vmatrix} 0 & 1 \\ 1 & 0 \\ \end{vmatrix} }[/math] |
Vmatrix | <math>
\begin{Vmatrix}
0 & 1 \\
1 & 0 \\
\end{Vmatrix}
</math>
|
[math]\displaystyle{ \begin{Vmatrix} 0 & 1 \\ 1 & 0 \\ \end{Vmatrix} }[/math] |
MathJax代码的展示
当展示带<math></math>
的[math]\displaystyle{ \LaTeX }[/math]代码时,请勿使用<code>
标签,优先考虑使用<syntaxhighlight>
,关于syntaxhighlight的更多介绍,参见Extension:SyntaxHighlight
MathJax中的TeX/[math]\displaystyle{ \LaTeX }[/math]拓展列表
- action
- ams
- amscd
- autoload
- bbox
- boldsymbol
- braket
- bussproofs
- cancel
- cases
- centernot
- color
- colortbl
- colorv2
- configmacros
- empheq
- enclose
- extpfeil
- gensymb
- html
- mathtools
- mhchem
- newcommand
- noerrors
- noundefined
- physics
- require
- setoptions
- tagformat
- textcomp
- textmacros
- unicode
- upgreek
- verb