Latex/MathJax/Katex数学公式手册

希腊字母

字母 Latex 字母 Latex 字母 Latex 字母 Latex
\alpha \alpha \beta \beta \gamma \gamma \delta \delta
\epsilon \epsilon \zeta \zeta \eta \eta \theta \theta
\iota \iota \kappa \kappa \lambda \lambda \mu \mu
\nu \nu \xi \xi \omicron \omicron \pi \pi
\rho \rho \sigma \sigma \tau \tau \upsilon \upsilon
\phi \phi \chi \chi \psi \psi \omega \omega
\varepsilon \varepsilon \varkappa \varkappa \vartheta \vartheta \digamma \digamma
\varpi \varpi \varrho \varrho \varsigma \varsigma \varphi \varphi
\Gamma \Gamma \Delta \Delta \Theta \Theta \Lambda \Lambda
\Xi \Xi \Pi \Pi \Sigma \Sigma \Upsilon \Upsilon
\Phi \Phi \Psi \Psi \varGamma \varGamma \varDelta \varDelta
\varTheta \varTheta \varLambda \varLambda \varXi \varXi \varPi \varPi
\varSigma \varSigma \varUpsilon \varUpsilon \varPhi \varPhi \varPsi \varPsi
\varOmega \varOmega \Omega \Omega

符号

符号 符号
\pm \pm \log \log
\times \times \lg \lg
\div \div \ln \ln
\infty \infty \bot \bot
\nabla \nabla \hat{a} \hat{a}
\overline X \overline X \angle \angle
\cdot \cdot 30^\circ 30^\circ
\bmod \bmod \pmod{n} \pmod{n}
\vert \vert \enclose{phasorangle}{a+b} \enclose{phasorangle}{a+b}

逻辑与集合

\because \quad
\therefore \quad
\exists \quad
\in \quad
\notin \quad 
\subset \quad
\supset \quad
\not\subset \quad
\subseteq \quad
\supseteq \quad 
\emptyset \quad 
\cup \quad 
\cap \quad 

\because \quad \therefore \quad \exists \quad \in \quad \notin \quad \subset \quad \supset \quad \not\subset \quad \subseteq \quad \supseteq \quad \emptyset \quad \cup \quad \cap \quad

三角函数

\sin 30^\circ \quad
\cos 30^\circ \quad 
\tan 30^\circ \quad 
\cot 30^\circ \quad 
\sec 30^\circ \quad 
\csc 30^\circ \quad 
\arcsin 1/2 \quad 
\arccos 1/2 \quad 
\arctan 1/2

\sin 30^\circ \quad \cos 30^\circ \quad \tan 30^\circ \quad \cot 30^\circ \quad \sec 30^\circ \quad \csc 30^\circ \quad \arcsin \frac{1}{2} \quad \arccos \frac{1}{2} \quad \arctan \frac{1}{2}

等号/不等号

= \quad
\neq \quad > \quad < \quad
\geqslant \quad
\leqslant \quad
\not> \quad
\not< \quad
\approx \quad
\equiv \quad
\gg  \quad 
\sim 

= \quad \neq \quad > \quad < \quad \geqslant \quad \leqslant \quad \not> \quad \not< \quad \approx \quad \equiv \quad \gg \quad \sim

箭头

\leftarrow \quad \Leftarrow \\
\longleftarrow \quad \Longleftarrow \\
\rightarrow \quad \Rightarrow \\
\longrightarrow \quad \Longrightarrow \\
\leftrightarrow \quad \Leftrightarrow \\
\longleftrightarrow \quad \Longleftrightarrow

\leftarrow \quad \Leftarrow \\ \longleftarrow \quad \Longleftarrow \\ \rightarrow \quad \Rightarrow \\ \longrightarrow \quad \Longrightarrow \\ \leftrightarrow \quad \Leftrightarrow \\ \longleftrightarrow \quad \Longleftrightarrow

垂直布局

\overset{\text{def}}{=} \quad \underset{x \to 0}{=} \quad \substack{0<i<m\\0<j<n} \quad \lim_{x=0 \atop y=2}

\overset{\text{def}}{=} \quad \underset{x \to 0}{=} \quad \substack{0<i<m\\0<j<n} \quad \lim_{x=0 \atop y=2}

长等号、箭头

A\xlongequal[sub-script]{super-script}B \qquad 
A\xleftarrow[sub-script]{super-script}B \qquad 
A\xrightarrow[sub-script]{super-script}B

A\xlongequal[sub-script]{super-script}B \qquad A\xleftarrow[sub-script]{super-script}B \qquad A\xrightarrow[sub-script]{super-script}B

空白间距

a~a ~
a\enspace a \enspace
a\quad a \quad
a\qquad a \qquad

上下标和根号

指数或上标用 ^ 表示,下标用 _ 表示,根号用 \sqrt 表示。
上下标如果多于一个字母或符号,需要用一对 {} 括起来。

x_{ij }^2\quad 
\sqrt{x}\quad 
\sqrt[3]{x}

x_{ij }^2\quad \sqrt{x}\quad \sqrt[3]{x}

分数

分数用 \frac 命令表示,它会根据环境自动调整字号,比如在行间公式中小一点,在独立公式中则大一点。

D(X) = D(\dfrac{X_1+X_2+X_3+...+X_n}{n})
\begin{array} {l}D(\frac{X_1+X_2+X_3+...+X_n}{n})\end{array}

D(X) = D(\dfrac{X_1+X_2+X_3+...+X_n}{n})
D(X) = \begin{array} {l}D(\frac{X_1+X_2+X_3+...+X_n}{n})\end{array}

array环境中的分数感觉被压扁了。

为了解决这个问题,我们可以主动设置分数大小,\dfrac是大分式,\tfrac 是小分式。

\dfrac {1}{2} \tfrac {1}{2}

\dfrac {1}{2} \tfrac {1}{2}

累加、累乘

\sum_{i=1}^n i\quad 
\prod_{i=1}^n

\sum_{i=1}^n i\quad \prod_{i=1}^n

极限、导数、偏导数、积分

\lim_{x\rightarrow+\infty} x^2 \quad
f^{'}(x) \quad
f^{''}(x) \quad
f^{'''}(x) \quad
\frac{\partial^2 y}{\partial x^2} \quad
\int_a^b x^2 dx \quad
\iint x^2 dx \quad
\iiint x^2 dx \quad
\oint x^2 dx

\lim_{x\rightarrow+\infty} x^2 \quad f^{'}(x) \quad f^{''}(x) \quad f^{'''}(x) \quad \frac{\partial^2 y}{\partial x^2} \quad \int_a^b x^2 dx \quad \iint x^2 dx \quad \iiint x^2 dx \quad \oint x^2 dx

矢量/向量

\vec{a} \cdot \vec{b}=0

\vec{a} \cdot \vec{b}=0

公式编号

M = EC^2 \tag{1.1}

M = EC^2 \tag{1.1}

小括号、中括号、大括号、角括号

(\dfrac{a}{b})
[\dfrac{a}{b}]
\{ \dfrac{a}{b} \}
 \langle \dfrac{a}{b}  \rangle

(\dfrac{a}{b}) \quad [\dfrac{a}{b}] \quad \{ \dfrac{a}{b} \} \quad \langle\dfrac{a}{b}\rangle \quad

括号的大小

( \big( \Big( \bigg( \Bigg(

( \big( \Big( \bigg( \Bigg(

如果括号比较多,可以使用\left与\right指定使用左括号还是右括号

对齐等号

\begin{aligned}
\frac{\partial}{\partial\theta_j}J(\theta) &= \frac{\partial}{\partial\theta_j}\frac{1}{2}(h_\theta(x) - y)^2 \\
&= 2\frac{1}{2}(h_\theta(x) - y)\frac{\partial}{\partial\theta_j}(h_\theta(x) - y) \\
&= (h_\theta(x) - y)\frac{\partial}{\partial\theta_j}(\sum_{i=1}^n \theta_ix_i - y) \\
&= (h_\theta(x) - y)x_j
\end{aligned}

\begin{aligned} \frac{\partial}{\partial\theta_j}J(\theta) &= \frac{\partial}{\partial\theta_j}\frac{1}{2}(h_\theta(x) - y)^2 \\ &= 2\frac{1}{2}(h_\theta(x) - y)\frac{\partial}{\partial\theta_j}(h_\theta(x) - y) \\ &= (h_\theta(x) - y)\frac{\partial}{\partial\theta_j}(\sum_{i=1}^n \theta_ix_i - y) \\ &= (h_\theta(x) - y)x_j \end{aligned}

函数

\begin{array}{ll}  Repeat \quad \{ \\
\qquad \theta_j := \theta_j - \alpha(h_\theta(x^{(i)}) - y^{(i)}) x_j^{(i)} \\
\} \end{array}

\begin{array}{ll} Repeat \quad \{ \\ \qquad \theta_j := \theta_j - \alpha(h_\theta(x^{(i)}) - y^{(i)}) x_j^{(i)} \\ \} \end{array}

f(n)=\left \{
\begin{array}{1}
\text{if n is even:}&n/2 \\
\text{if n is odd:}&3n+1
\end{array}
\right.

f(n)=\left \{ \begin{array}{1} \text{if n is even:}&n/2 \\ \text{if n is odd:}&3n+1 \end{array} \right.

\left.
\begin{array}{1}
\text{if n is even:}&n/2 \\
\text{if n is odd:}&3n+1
\end{array}
\right\}=f(n)

\left. \begin{array}{1} \text{if n is even:}&n/2 \\ \text{if n is odd:}&3n+1 \end{array} \right\}=f(n)

矩阵

\left(\begin{array}{}
 1&\alpha_1&\alpha_1^2&\cdots&\alpha_1^n\\
 1&\alpha_2&\alpha_2^2&\cdots&\alpha_2^n\\
 \vdots&\vdots&\vdots&\ddots&\vdots\\
 1&\alpha_n&\alpha_n^2&\cdots&\alpha_n^n
 \end{array}\right)

\left(\begin{array}{} 1&\alpha_1&\alpha_1^2&\cdots&\alpha_1^n\\ 1&\alpha_2&\alpha_2^2&\cdots&\alpha_2^n\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 1&\alpha_n&\alpha_n^2&\cdots&\alpha_n^n \end{array}\right)

\newcommand\iddots{\mathinner{
  \kern1mu\raise1pt{.}
  \kern2mu\raise4pt{.}
  \kern2mu\raise7pt{\Rule{0pt}{7pt}{0pt}.}
  \kern1mu
}} 
\left[\begin{array}{ccc} & & & \boldsymbol{A}_{1} \\
& & \boldsymbol{A}_{2} & \\ & \iddots & & \\
\boldsymbol{A}_{s} & & & \end{array}\right]

\newcommand\iddots{\mathinner{ \kern1mu\raise1pt{.} \kern2mu\raise4pt{.} \kern2mu\raise7pt{\Rule{0pt}{7pt}{0pt}.} \kern1mu }} \left[\begin{array}{ccc} & & & \boldsymbol{A}_{1} \\ & & \boldsymbol{A}_{2} & \\ & \iddots & & \\ \boldsymbol{A}_{s} & & & \end{array}\right]

\left ( \begin{array}{} a&b\\c&d \end{array} \right ) \quad
\left [ \begin{array}{} a&b\\c&d \end{array} \right ] \quad
\left \{ \begin{array}{} a&b\\c&d \end{array} \right \} \quad
\left | \begin{array}{} a&b\\c&d \end{array} \right | \quad
\left | \left| \begin{array}{} a&b\\c&d \end{array} \right | \right| \quad
\left[\begin{array}{l}A \\ \hdashline B\end{array}\right]

\left ( \begin{array}{} a&b\\c&d \end{array} \right ) \quad \left [ \begin{array}{} a&b\\c&d \end{array} \right ] \quad \left \{ \begin{array}{} a&b\\c&d \end{array} \right \} \quad \left | \begin{array}{} a&b\\c&d \end{array} \right | \quad \left | \left| \begin{array}{} a&b\\c&d \end{array} \right | \right| \quad \left[\begin{array}{l}A \\ \hdashline B\end{array}\right]

表格与颜色

\begin{array} {|c|c|c|}
\hline 
\color{black}{黑色(\text{black})} & \color{red}{红色(\text{red})} & \color{yellow}{黄色(\text{yellow})} \\
\hline 
\color{blue}{蓝色(\text{blue})} & \color{grey}{灰色(\text{grey})} & \color{navy}{藏青色(\text{navy})} \\
\hline
\color{green}{绿色(\text{green})} & \color{purple}{紫色(\text{purple})} & \color{maroon}{紫红色(\text{maroon})} \\
\hline 
\color{olive}{橄榄绿(\text{olive})} & \color{teal}{蓝绿色(\text{teal})} & \color{silver}{银色(\text{silver})} \\
\hline 
\color{lime}{浅绿色(\text{lime})} &  &  \\
\hline  
\end{array}

\begin{array} {|c|c|c|} \hline \color{black}{黑色(\text{black})} & \color{red}{红色(\text{red})} & \color{yellow}{黄色(\text{yellow})} \\ \hline \color{blue}{蓝色(\text{blue})} & \color{grey}{灰色(\text{grey})} & \color{navy}{藏青色(\text{navy})} \\ \hline \color{green}{绿色(\text{green})} & \color{purple}{紫色(\text{purple})} & \color{maroon}{紫红色(\text{maroon})} \\ \hline \color{olive}{橄榄绿(\text{olive})} & \color{teal}{蓝绿色(\text{teal})} & \color{silver}{银色(\text{silver})} \\ \hline \color{lime}{浅绿色(\text{lime})} & & \\ \hline \end{array}

增加行高

\vspace{1ex}
\\[1em]

array环境 vs aligned环境

array环境中必须用\dfrac,否则分数会变小。aligned环境不会变小。

\begin{array} {l}D(\frac{X_1+X_2+X_3+...+X_n}{n})\end{array}

\begin{aligned} D(\frac{X_1+X_2+X_3+...+X_n}{n})\end{aligned}


https://katex.org/docs/supported.html

posted @ 2018-06-09 21:26:05
评论加载中...
发表评论