latex公式

Use $\Sigma$ in different mode

inline math

$\sum_{i=1}^{\infty}|x_i-y_i|$

$\sum_{i=1}^{\infty}|x_i-y_i|$

display math

$$
\sum_{i=1}^{\infty}|x_i-y_i|
$$

$$ \sum_{i=1}^{\infty}|x_i-y_i| $$

use \limits

$\sum\limits_{i=1}^{\infty}|x_i-y_i|$

$\sum\limits_{i=1}^{\infty}|x_i-y_i|$

use color

${\color{red}\eta}\frac{{\delta}L}{{\delta}W}|_{w=w^0}$

${\color{red}\eta}\frac{{\delta}L}{{\delta}W}|_{w=w^0}$

frac and sfrac

$ \frac{1}{2} = \sfrac{1}{2} $

$ \frac{1}{2} = \sfrac{1}{2} $

text and textcolor

$\textcolor{red}{\text{red curve}}\text{ will be}$

$\textcolor{red}{\text{red curve}}\text{ will be}$

cases

$$
\delta(x) = 
\begin{cases}  
    g(x) > 0 & \text{Output = class 1} \cr 
    else & \text{Output = class 2} 
\end{cases}
$$

$$ \delta(x) = \begin{cases}
g(x) > 0 & \text{Output = class 1} \cr else & \text{Output = class 2} \end{cases} $$

newline, space, align and tag

  • new line use \cr or \\\\
  • space use \\,, \quad
  • align use \begin{align}, \end{align} and &
  • tag use \tag{1}, or use ams automatic , equation-numbers
  • tag with ams automatic, will omit by \notag or block symbol end with *, for example: \begin{align*}, \end{align*}
  • use \begin{align} and \end{align} instead of $$ or $
\begin{align}
x&=y           &  w &=z              &  a&=b+c \\\\
2x&=-y         &  3w&=\frac{1}{2}z   &  a&=b \notag \cr
-4 + 5x&=2+y   &  w+2&=-1+w          &  a \quad b&=c\\,b\tag{xyz}
\end{align}

\begin{align} x&=y & w &=z & a&=b+c \\ 2x&=-y & 3w&=\frac{1}{2}z & a&=b \notag \cr -4 + 5x&=2+y & w+2&=-1+w & a \quad b&=c\,b\tag{xyz} \end{align}

\begin{align*}
x&=y           &  w &=z              &  a&=b+c \\\\
2x&=-y         &  3w&=\frac{1}{2}z   &  a&=b \notag \cr
-4 + 5x&=2+y   &  w+2&=-1+w          &  a \quad b&=c\\,b\tag{xyz}
\end{align*}

\begin{align*} x&=y & w &=z & a&=b+c \\ 2x&=-y & 3w&=\frac{1}{2}z & a&=b \notag \cr -4 + 5x&=2+y & w+2&=-1+w & a \quad b&=c\,b\tag{xyz} \end{align*}

matrices

TypeLatex markupRender as
Plain\begin{matrix}
1 & 2 & 3\cr
a & b & c
\end{matrix}
\begin{matrix} 1 & 2 & 3\cr a & b & c \end{matrix}
Parentheses;
round brackets
\begin{pmatrix}
1 & 2 & 3\cr
a & b & c
\end{pmatrix}
\begin{pmatrix} 1 & 2 & 3\cr a & b & c \end{pmatrix}
Brackets;
square brackets
\begin{bmatrix}
1 & 2 & 3\cr
a & b & c
\end{bmatrix}
\begin{bmatrix} 1 & 2 & 3\cr a & b & c \end{bmatrix}
Braces;
curly brackets
\begin{Bmatrix}
1 & 2 & 3\cr
a & b & c
\end{Bmatrix}
\begin{Bmatrix} 1 & 2 & 3\cr a & b & c \end{Bmatrix}
Pipes\begin{vmatrix}
1 & 2 & 3\cr
a & b & c
\end{vmatrix}
\begin{vmatrix} 1 & 2 & 3\cr a & b & c \end{vmatrix}
Double pipes\begin{Vmatrix}
1 & 2 & 3\cr
a & b & c
\end{Vmatrix}
\begin{Vmatrix} 1 & 2 & 3\cr a & b & c \end{Vmatrix}

block symbol: equation, split, multline, gather, align

equation

  • equation can only include one equation
  • or it will not render
\begin{equation}
x=y         
\end{equation}

\begin{equation} x=y \end{equation}

\begin{equation}
x=y \cr y=b         
\end{equation}

\begin{equation} x=y \cr y=b \end{equation}

split

  • split can use with equation
  • but the tag was only one
\begin{equation}
\begin{split}
x=y \cr y=b
\end{split}       
\end{equation} 

\begin{equation} \begin{split} x=y \cr y=b \end{split}
\end{equation}

multline

  • multline same as equation with split
  • but with different align
\begin{multline}
x=y \cr y=b
\end{multline} 

\begin{multline} x=y \cr y=b \end{multline}

gather

\begin{gather}
x=y \cr y=b
\end{gather} 

\begin{gather} x=y \cr y=b \end{gather}

align

\begin{align}
x=y \cr y=b
\end{align} 

\begin{align} x=y \cr y=b \end{align}

参考