Letex常见用法

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
{x_i}^2 …….. x i 2

3.分数

\frac ab a b
\frac {\sqrt x} {a+1} x a + 1
{a+1 \over b+1} a + 1 b + 1

4.求和符号

\sum_1^n 1 n
\sum_{i=0}^\infty i^2 i = 0 i 2

5.积分符号

\int_0^1 x^2 0 1 x 2

6.根号

\sqrt {x^3} x 3
\sqrt [3] {x+3} x + 3 3

7.极限

\lim\limits_{x\to 0} lim x 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键

显示:

f ( n ) = { n / 2 , if  n  is even 3 n + 1 , if  n  is odd

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.
$$

显示:

{ a 1 x + b 1 y + c 1 z = d 1 b 2 y + c 2 z = d 2 a 2 x + b 3 y + c 3 z = d 3

Code03:

$$\begin{aligned}
a &= b + c \\
  &= d + e + f + g \\
  &= h + i
\end{aligned}\tag{2}$$

显示:

(2) a = b + c = d + e + f + g = h + i

Code04:

$$\begin{align}
a &= b + c \tag{3} \\
x &= yz \tag{4}\\
l &= m - n \tag{5}
\end{align}$$

显示:

(3) a = b + c (4) x = y z (5) l = m n

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}

显示:

(3) max z = x 1 + 12 x 2 (constraint 1) s.t. 13 x 1 + x 2 + 12 x 3 5 (constraint 2) x 1 + x 3 16 (constraint 3) 15 x 1 + 201 x 2 = 14 (4) x i 0 , i = 1 , 2 , 3

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(左右)|(分割线)

显示:

n Left Center Right 1 0.24 1 125 2 1 189 8 3 20 2000 1 + 10 i

13.文字

Code:

$\color{silver}{yourtext}$
$\color{#f00}{yourtext}$

显示:
y o u r t e x t
y o u r t e x t

about颜色:

color
color2

14.关系图

Code:

 $$   \require{AMScd}   
		\begin{CD}
        A @>>> B @>{\text{very long label}}>> C \\
        @. @AAA @| \\
        D @= E @<<< F
        \end{CD}$$

显示:

A B very long label C D = E F

猜你喜欢

转载自blog.csdn.net/weixin_42193804/article/details/82533405