公式输入:
美元符号$ 公式 $
分式: $\frac{分子}{分母} $
开方: $\sqrt[开几次方]{被开方数}$
上标: $ X^{2} + Y^2 = Z^2 $ %只对^后面第一个字符处理,高次方用{}包住
下标: $ x_1, x_2 $ %使用花括号阔住复杂的下标志
希腊字母:$\alpha $ $\beta $ $\gamma $ $\epsilon$ $\pi$ $\omega$
首字母大写则变成对应的大写希腊字母
数学函数:\sin \cos \arctan \log
交叉引用:\label{whatwhatwhat} \ref{whatwhatwhat}
注意equation需要调用amsmath宏包
公式输入:
\[
\begin{matrix)
0 & 1 & 2 \\
3 & 6 & 7 \\
\end{matrix}
\]
matrix:无定界符 pmatrix:小括号 bmatrix:中括号 Bmatrix:大括号 vmatrix:竖线 Vmatrix:双竖线
&分割列 \\分割行
\ots:省略号 \vdots:竖直省略号 \ddots:斜省略号
矩阵也可以嵌套,用\text{\Large 0}
多行公式:
多行公式的编辑离不开gather的使用,具体规则如下:
\begin{gather*}
3^2 + 4^2 = 5^2 \notag \\ % \notag强制去除标签
5^2 + 12^2 = 13^2 \notag \\
\end{gather*}
另一个很好用的就是align,可以实现默认对齐,由&指定对齐位置
单公式推导的多行编译:
\begin{equation}
\begin{split}
\cos 2X &= \cos^2 - \sin^2 \\
&= 2\cos^2 - 1
\end{split}
\end{equation}
分段函数多行编译:
\begin{equation}
D(x) = \begin{cases}
1 ,& \text{如果} x \in \mathbb{Q} %数学公式中处理中文需要\text{中文内容}且安装amssymb
2 ,& \text{其余}
\end{equation}