Latex常见用法
官方tutorial:
https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
(用于自己学习整理)
1.Greek letters
code | letter |
---|---|
\alpha | |
\beta | |
\omega | |
\Gamma | |
\Delta | |
Omega |
2.上下标 superscripts&subscripts
上标 | ^ |
---|---|
下标 | _ |
e.g.
x_i^2…………
{x_i}^2 ……..
3.分数
\frac ab | |
---|---|
\frac {\sqrt x} {a+1} | |
{a+1 \over b+1} |
4.求和符号
\sum_1^n | |
---|---|
\sum_{i=0}^\infty i^2 |
5.积分符号
\int_0^1 x^2 |
6.根号
\sqrt {x^3} | |
\sqrt [3] {x+3} |
7.极限
\lim\limits_{x\to 0} |
8.不等符号
\lt | \gt | \le | \ge | \neq | \not\lt |
---|---|---|---|---|---|
9.特殊符号
\subset | \subseteq | \supset | \supseteq | \in | \notin |
---|---|---|---|---|---|
\to | \leftarrow | \Rightarrow |
---|---|---|
10.其他符号
\cdot(点乘) | \pm | \mp |
---|---|---|
11.方程组
Code01:
f(n) =
\begin{cases}
n/2, & \text{if $n$ is even} \\[2ex]
3n+1, & \text{if $n$ is odd}
\end{cases}
\\………分隔每个方程
&………在这里相当于Tab键
显示:
Code02:
$$
\left\{
\begin{aligned}
a_1x+b_1y+c_1z&=d_1 \\
b_2y+c_2z&=d_2 \\
a_2x+b_3y+c_3z&=d_3
\end{aligned}
\right.
$$
显示:
Code03:
$$\begin{aligned}
a &= b + c \\
&= d + e + f + g \\
&= h + i
\end{aligned}\tag{2}$$
显示:
Code04:
$$\begin{align}
a &= b + c \tag{3} \\
x &= yz \tag{4}\\
l &= m - n \tag{5}
\end{align}$$
显示:
Code05:
\begin{alignat}{5}
\max \quad & z = & x_1 & + & 12 x_2 & & & && \\
\mbox{s.t.} \quad & & 13 x_1 & + & x_2 & + & 12x_3 & \geq 5 && \tag{constraint 1} \\
& & x_1 & & & + & x_3 & \leq 16 && \tag{constraint 2} \\
& & 15 x_1 & + & 201 x_2 & & & = 14 && \tag{constraint 3} \\
& & \rlap{x_i \ge 0, i = 1, 2, 3}
\end{alignat}
显示:
12.表格
Code:
$$
\begin{array}{c|lcr}
n & \text{Left} & \text{Center} & \text{Right} \\
\hline
1 & 0.24 & 1 & 125 \\
2 & -1 & 189 & -8 \\
3 & -20 & 2000 & 1+10i
\end{array}
$$
{c|lcr}………表示每一列对齐方式c(中心)lr(左右)|(分割线)
显示:
13.文字
Code:
$\color{silver}{yourtext}$
$\color{#f00}{yourtext}$
显示:
about颜色:
14.关系图
Code:
$$ \require{AMScd}
\begin{CD}
A @>>> B @>{\text{very long label}}>> C \\
@. @AAA @| \\
D @= E @<<< F
\end{CD}$$
显示: