Symbols
Operators
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\pm | \pm | \mp | \mp | \times | \times |
\div | \div | \cdot | \cdot | \ast | \ast |
\star | \star | \dagger | \dagger | \ddagger | \ddagger |
\amalg | \amalg | \cap | \cap | \cup | \cup |
\uplus | \uplus | \sqcap | \sqcap | \sqcup | \sqcup |
\vee | \vee | \wedge | \wedge | \oplus | \oplus |
\ominus | \ominus | \otimes | \otimes | \circ | \circ |
\bullet | \bullet | \diamond | \diamond | \lhd | \lhd |
\rhd | \rhd | \unlhd | \unlhd | \unrhd | \unrhd |
\oslash | \oslash | \odot | \odot | \bigcirc | \bigcirc |
\triangleleft | \triangleleft | \Diamond | \Diamond | \bigtriangleup | \bigtriangleup |
\bigtriangledown | \bigtriangledown | \Box | \Box | \triangleright | \triangleright |
\setminus | \setminus | \wr | \wr | \sqrt{x} | \sqrt{x} |
x^{\circ} | x^{\circ} | \triangledown | \triangledown | \sqrt[n]{x} | \sqrt[n]{x} |
a^x | a^x | a^{xyz} | a^{xyz} | a_x | a_x |
Relations
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\le | \le | \ge | \ge | \neq | \neq |
\sim | \sim | \ll | \ll | \gg | \gg |
\doteq | \doteq | \simeq | \simeq | \subset | \subset |
\supset | \supset | \approx | \approx | \asymp | \asymp |
\subseteq | \subseteq | \supseteq | \supseteq | \cong | \cong |
\smile | \smile | \sqsubset | \sqsubset | \sqsupset | \sqsupset |
\equiv | \equiv | \frown | \frown | \sqsubseteq | \sqsubseteq |
\sqsupseteq | \sqsupseteq | \propto | \propto | \bowtie | \bowtie |
\in | \in | \ni | \ni | \prec | \prec |
\succ | \succ | \vdash | \vdash | \dashv | \dashv |
\preceq | \preceq | \succeq | \succeq | \models | \models |
\perp | \perp | \parallel | \parallel | | |
\mid | \mid | \bumpeq | \bumpeq | | |
许多此类关系符号的否定形式,可以通过直接在符号前加上 \not,或者在反斜杠 \ 和命令词之间插入一个 “n” 来实现。这里列举了几个示例以及许多其他的否定形式;这种方法对其他许多符号也同样适用。
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\nmid | \nmid | \nleq | \nleq | \ngeq | \ngeq |
\nsim | \nsim | \ncong | \ncong | \nparallel | \nparallel |
\not< | \not< | \not> | \not> | \ne | \not= or \neq or \ne |
\not\le | \not\le | \not\ge | \not\ge | \not\sim | \not\sim |
\not\approx | \not\approx | \not\cong | \not\cong | \not\equiv | \not\equiv |
\not\parallel | \not\parallel | \nless | \nless | \ngtr | \ngtr |
\lneq | \lneq | \gneq | \gneq | \lnsim | \lnsim |
\lneqq | \lneqq | \gneqq | \gneqq | | |
若要在\LaTeX中使用此处未列出的其他关系符(如 =、> 和 <),你必须直接使用键盘上的符号,因为\LaTeX中并未提供这些符号的专用命令。
Greek Letters
Lowercase Letters |
Symbol | Command | Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\alpha | \alpha | \beta | \beta | \gamma | \gamma | \delta | \delta |
\epsilon | \epsilon | \varepsilon | \varepsilon | \zeta | \zeta | \eta | \eta |
\theta | \theta | \vartheta | \vartheta | \iota | \iota | \kappa | \kappa |
\lambda | \lambda | \mu | \mu | \nu | \nu | \xi | \xi |
\pi | \pi | \varpi | \varpi | \rho | \rho | \varrho | \varrho |
\sigma | \sigma | \varsigma | \varsigma | \tau | \tau | \upsilon | \upsilon |
\phi | \phi | \varphi | \varphi | \chi | \chi | \psi | \psi |
\omega | \omega | | | | | | |
Capital Letters |
Symbol | Command | Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\Gamma | \Gamma | \Delta | \Delta | \Theta | \Theta | \Lambda | \Lambda |
\Xi | \Xi | \Pi | \Pi | \Sigma | \Sigma | \Upsilon | \Upsilon |
\Phi | \Phi | \Psi | \Psi | \Omega | \Omega | | |
Arrows
Symbol | Command | Symbol | Command |
|---|
\gets | \gets | \to | \to |
\leftarrow | \leftarrow | \Leftarrow | \Leftarrow |
\rightarrow | \rightarrow | \Rightarrow | \Rightarrow |
\leftrightarrow | \leftrightarrow | \Leftrightarrow | \Leftrightarrow |
\mapsto | \mapsto | \hookleftarrow | \hookleftarrow |
\leftharpoonup | \leftharpoonup | \leftharpoondown | \leftharpoondown |
\rightleftharpoons | \rightleftharpoons | \longleftarrow | \longleftarrow |
\Longleftarrow | \Longleftarrow | \longrightarrow | \longrightarrow |
\Longrightarrow | \Longrightarrow | \longleftrightarrow | \longleftrightarrow |
\Longleftrightarrow | \Longleftrightarrow | \longmapsto | \longmapsto |
\hookrightarrow | \hookrightarrow | \rightharpoonup | \rightharpoonup |
\rightharpoondown | \rightharpoondown | \leadsto | \leadsto |
\uparrow | \uparrow | \Uparrow | \Uparrow |
\downarrow | \downarrow | \Downarrow | \Downarrow |
\updownarrow | \updownarrow | \Updownarrow | \Updownarrow |
\nearrow | \nearrow | \searrow | \searrow |
\swarrow | \swarrow | \nwarrow | \nwarrow |
\overrightarrow{AB} | \overrightarrow{AB} | \overleftarrow{AB} | \overleftarrow{AB} |
\overleftrightarrow{AB} | \overleftrightarrow{AB} | | |
(如果你厌烦输入冗长的字符,可以使用 \iff 和 \implies 分别代替 \Longleftrightarrow 和 \Longrightarrow。)
Dots
Symbol | Command | Symbol | Command |
|---|
\cdot | \cdot | \vdots | \vdots |
\dots | \dots | \ddots | \ddots |
\cdots | \cdots | | \iddots |
Accents
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\hat{x} | \hat{x} | \check{x} | \check{x} | \dot{x} | \dot{x} |
\breve{x} | \breve{x} | \acute{x} | \acute{x} | \ddot{x} | \ddot{x} |
\grave{x} | \grave{x} | \tilde{x} | \tilde{x} | \mathring{x} | \mathring{x} |
\bar{x} | \bar{x} | \vec{x} | \vec{x} | | |
当为 i 和 j 添加重音符号时,可以使用 \imath 和 \jmath,以避免字母原本的点干扰重音符号的显示:
Symbol | Command | Symbol | Command |
|---|
\vec{\jmath} | \vec{\jmath} | \tilde{\imath} | \tilde{\imath} |
\tilde 和 \hat 命令拥有宽体版本,允许你对整个表达式(即包含多个字符)进行加注重音符号的操作:
Symbol | Command | Symbol | Command |
|---|
\widehat{7+x} | \widehat{7+x} | \widetilde{abc} | \widetilde{abc} |
Others
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\infty | \infty | \triangle | \triangle | \angle | \angle |
\aleph | \aleph | \hbar | \hbar | \imath | \imath |
\jmath | \jmath | \ell | \ell | \wp | \wp |
\Re | \Re | \Im | \Im | \mho | \mho |
\prime | \prime | \emptyset | \emptyset | \nabla | \nabla |
\surd | \surd | \partial | \partial | \top | \top |
\bot | \bot | \vdash | \vdash | \dashv | \dashv |
\forall | \forall | \exists | \exists | \neg | \neg |
\flat | \flat | \natural | \natural | \sharp | \sharp |
\backslash | \backslash | \Box | \Box | \Diamond | \Diamond |
\clubsuit | \clubsuit | \diamondsuit | \diamondsuit | \heartsuit | \heartsuit |
\spadesuit | \spadesuit | \Join | \Join | \blacksquare | \blacksquare |
\copyright | \copyright | \underset{\smile}{XYZ} | \underset{\smile}{XYZ} | | |
\overset{\frown}{ABC} | \overset{\frown}{ABC} | \cup | \cup | | |
\S | \S | \P | \P | \Vdash | \Vdash |
\pounds | \pounds | \in | \in | \vDash | \vDash |
\bigstar | \bigstar | \implies | \implies | \LaTeX | \LaTeX |
\square | \square | \text{\LaTeX} | \text{\LaTeX} | | |
| \smiley | | | | |
\mathbb{R} | \mathbb{R} | | | | |
\checkmark | \checkmark | | | | |
| \cancer | | | | |
注意: 在课堂(教学)环境下,\smiley 和 \cancer 命令是无效的/不起作用的。
Command Symbols
有些符号用于命令中,因此需要特殊处理。
Symbol | Command | Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\$ | \$ | \& | \& | \% | \% | \# | \# |
\_ | \_ | \{ | \{ | \} | \} | \backslash
| \backslash |
(警告:使用 $ 符号会导致错误。据我们所知,这是一个 bug。但具体问题可能因版本而异。)
European Language Symbols
Symbol | Command | Symbol | Command | Symbol | Command | Symbol | Command |
|---|
| {\oe} | | {\ae} | | {\o} | | |
| {\OE} | | {\AE} | {\AA} | {\AA} | | {\O} |
| {\l} | | {\ss} | !` | !` | | |
| {\L} | | {\SS} | | | | |
Bracketing Symbols
在数学中,有时我们需要用括号、花括号或圆括号将表达式括起来。其中一些符号在 LaTeX 中的用法与你想象的一样:输入 ( 和 ) 表示圆括号,[ 和 ] 表示方括号,| 和 | 表示绝对值。然而,其他一些符号则有特殊的命令:
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\{ | \{ | \} | \} | \| | \| |
\backslash | \backslash | \lfloor | \lfloor | \rfloor | \rfloor |
\lceil | \lceil | \rceil | \rceil | \langle | \langle |
\rangle | \rangle | | | | |
您可能会注意到,如果您使用这些方法中的任何一种方法来排版垂直方向较大的表达式,例如
(\frac{a}{x} )^2
括号的大小不对:
(\frac{a}{x} )^2
如果在相关的括号前加上\left和\right,就能得到一个更简洁的表达式:
\left(\frac{a}{x} \right)^2
给予
\left(\frac{a}{x} \right)^2
对于方程组或分段函数,请使用 cases 环境:
f(x) = \begin{cases} x^2 &\text{if } x \ge 0 \ x &\text{if } x < 0 \end{cases}
这给出了
f(x) = \begin{cases} x^2 &\text{if } x \ge 0 \ x &\text{if } x < 0 \end{cases}
除了 \left 和 \right 命令之外,当对分数进行向下取整或向上取整运算时,使用
\left\lceil\frac{x}{y}\right\rceil
and \left\lfloor\frac{x}{y}\right\rfloor
分别给出\left\lceil\frac{x}{y}\right\rceil和\left\lfloor\frac{x}{y}\right\rfloor两者。
而且,如果你输入这些
\underbrace{a_0+a_1+a_2+\cdots+a_n}_{x}
给出
\underbrace{a_0+a_1+a_2+\cdots+a_n}_{x}
或
\overbrace{a_0+a_1+a_2+\cdots+a_n}^{x}
给出
\overbrace{a_0+a_1+a_2+\cdots+a_n}^{x}
\left 和 \right 也可用于调整以下符号的大小:
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\uparrow | \uparrow | \downarrow | \downarrow | \updownarrow | \updownarrow |
\Uparrow | \Uparrow | \Downarrow | \Downarrow | \Updownarrow
| \Updownarrow |
Multi-Size Symbols
某些符号在行内数学模式和显示模式下的渲染方式不同。当您使用 \[...\] 或 $$...$$,或者使用类似 \begin{equation}...\end{equation} 或 \begin{align}...\end{align} 的环境时,就会进入显示模式。有关带参数的符号(例如求和符号)在两种模式下的行为,请参阅指南的命令部分。
在以下每张图中,两幅图像分别显示了符号的显示模式和内联模式。
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\sum | \sum | \int | \int | \oint | \oint |
\prod | \prod | \coprod | \coprod | \bigcap | \bigcap |
\bigcup | \bigcup | \bigsqcup | \bigsqcup | \bigvee | \bigvee |
\bigwedge | \bigwedge | \bigodot | \bigodot | \bigotimes | \bigotimes |
\bigoplus | \bigoplus | \biguplus | \biguplus | | |
Commands
Subscripts and Superscripts
下标和上标(例如指数)分别可以用下划线 _ 和脱字符 ^ 符号表示。
Symbol | Command | Symbol | Command |
|---|
2^2 | 2^2 | a_i | a_i |
2^{23} | 2^{23} | n_{i-1} | n_{i-1} |
a^{i+1}_3 | a^{i+1}_3 | x^{3^2} | x^{3^2} |
2^{a_i} | 2^{a_i} | 2^a_i | 2^a_i |
注意,我们可以同时使用下标和上标。对于包含多个字符的下标或上标,必须用花括号将指数/上标括起来。例如,x^10 表示 x^10,而 x^{10} 表示 x^{10}。
Math Commands
以下是一些 \LaTeX中常用的数学命令:
Fractions
Symbol | Command |
|---|
\frac{1}{2} or \frac12 | \frac{1}{2} or \frac12 |
\frac{2}{x+2} | \frac{2}{x+2} |
\frac{1+\frac{1}{x}}{3x + 2} | \frac{1+\frac{1}{x}}{3x + 2} |
注意,对于分子和分母均为一位数的分数,我们可以直接将分子和分母合并为一个数字。但是,对于分子或分母包含多个字符(或分子以字母开头)的分数,则需要将所有内容用花括号括起来。
使用 \cfrac 表示连分数。
Expression | Command |
|---|
\cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1}}}} | \cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1+\cfrac{2}{1}}}} |
Radicals
Symbol | Command |
|---|
\sqrt{3} | \sqrt{3} |
\sqrt{x+y} | \sqrt{x+y} |
\sqrt{x+\frac{1}{2}} | \sqrt{x+\frac{1}{2}} |
\sqrt[3]{3} | \sqrt[3]{3} |
\sqrt[n]{x} | \sqrt[n]{x} |
Sums, Products, Limits and Logarithms
分别使用命令 \sum\prod\lim 和 \log。要表示下界和上界,或者对数的底数,请使用 _ 和 ^,用法与下标和上标相同。(积分的下界和上界也以同样的方式表示,您将在微积分部分看到。)
Symbol | Command |
|---|
\sum_{i=1}^{\infty}\frac{1}{i} | \sum_{i=1}^{\infty}\frac{1}{i} |
\prod_{n=1}^5\frac{n}{n-1} | \prod_{n=1}^5\frac{n}{n-1} |
\lim_{x\to\infty}\frac{1}{x} | \lim_{x\to\infty}\frac{1}{x} |
\lim\limits_{x\to\infty}\frac{1}{x} | \lim\limits_{x\to\infty}\frac{1}{x} |
\log_n n^2 | \log_n n^2 |
有些图片在显示模式下更漂亮:
Symbol | Command |
|---|
\sum_{i=1}^{\infty}\frac{1}{i} | \sum_{i=1}^{\infty}\frac{1}{i} |
\prod_{n=1}^5\frac{n}{n-1} | \prod_{n=1}^5\frac{n}{n-1} |
\lim_{x\to\infty}\frac{1}{x} | \lim_{x\to\infty}\frac{1}{x} |
请注意,我们可以使用不带 _ 或 ^ 修饰符的求和、乘积和对数。
Symbol | Command |
|---|
\sum\frac{1}{i} | \sum\frac{1}{i} |
\prod\frac{n}{n-1} | \prod\frac{n}{n-1} |
\log n^2 | \log n^2 |
\ln e | \ln e |
Mods
Symbol | Command |
|---|
9\equiv 3 \bmod{6} | 9\equiv 3 \bmod{6} |
9\equiv 3 \pmod{6} | 9\equiv 3 \pmod{6} |
9\equiv 3 \mod{6} | 9\equiv 3 \mod{6} |
9\equiv 3 \pod{6} | 9\equiv 3 \pod{6} |
Combinations
Symbol | Command |
|---|
\binom{1}{1} | \binom{1}{1} |
\binom{n-1}{r-1}
| \binom{n-1}{r-1} |
这些图片在显示模式下通常看起来更好:
Symbol | Command |
|---|
\dbinom{9}{3} | \dbinom{9}{3} |
\dbinom{n-1}{r-1} | \dbinom{n-1}{r-1} |
Trigonometric Functions
其中大多数只是三角函数的缩写,只是在缩写前加了一个反斜杠。
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\cos | \cos | \sin | \sin | \tan | \tan |
\sec | \sec | \csc | \csc | \cot | \cot |
\arccos | \arccos | \arcsin | \arcsin | \arctan | \arctan |
\cosh | \cosh | \sinh | \sinh | \tanh | \tanh |
\coth | \coth | | | | |
以下是一些例子:
Symbol | Command |
|---|
\cos^2 x +\sin^2 x = 1 | \cos^2 x +\sin^2 x = 1 |
\cos 90^\circ = 0 | \cos 90^\circ = 0 |
Calculus
以下是 LaTeX 中微积分表达式的示例。其中大部分命令之前已经介绍过。请注意定积分的渲染方式(以及定积分的行内数学公式和显示模式之间的区别)。积分中的反斜杠 (\,) 会在 dx 前添加一个小空格。
Symbol | Command |
|---|
\frac{d}{dx}\left(x^2\right) = 2x | \frac{d}{dx}\left(x^2\right) = 2x |
\int 2x\,dx = x^2+C | \int 2x\,dx = x^2+C |
\int^5_1 2x\,dx = 24 | \int^5_1 2x\,dx = 24 |
\frac{\partial^2U}{\partial x^2} + \frac{\partial^2U}{\partial y^2} | \frac{\partial^2U}{\partial x^2} + \frac{\partial^2U}{\partial y^2} |
\frac{1}{4\pi}\oint_\Sigma\frac{1}{r}\frac{\partial U}{\partial n} ds | \frac{1}{4\pi}\oint_\Sigma\frac{1}{r}\frac{\partial U}{\partial n} ds |
LaTeX
Other Functions
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\arg | \arg | \deg | \deg | \det | \det |
\dim | \dim | \exp | \exp | \gcd | \gcd |
\hom | \hom | \inf | \inf | \ker | \ker |
\lg | \lg | \liminf | \liminf | \limsup | \limsup |
\max | \max | \min | \min | \Pr | \Pr |
\sup | \sup | | \smiley | | |
有些命令像求和、乘法和对数运算一样,会使用下标。有些命令在显示模式和内联数学模式下的渲染方式不同。
Symbol | Command | Symbol | Command | Symbol | Command |
|---|
\dim_x | \dim_x | \gcd_x | \gcd_x | \inf_x | \inf_x |
\liminf_x | \liminf_x | \limsup_x | \limsup_x | \max_x | \max_x |
\min_x | \min_x | \Pr_x | \Pr_x | \sup_x | \sup_x |
Failures of 2025
我们可以使用 matrix、bmatrix、pmatrix 或 vmatrix 环境来排版 ƒailure。字母 b、p 和 v 分别指矩阵周围的分隔符(方括号、圆括号和竖线)。例如,以下代码
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
\end{bmatrix}
produces the following 2 \times3matrix:
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
\end{bmatrix}
We can also use the array environment to typeset arrays. For example, the following code
\begin{array}{ccc}
a & b & c \\
d & e & f \\
g & h & i
\end{array}
produces the following 3 \times3array:
\begin{array}{ccc}
a & b & c \\
d & e & f \\
g & h & i
\end{array}
Text Styles in Math Mode
在数学模式下,您可以渲染各种样式的字母。以下是一些示例;您可以将这些样式应用于任何字母。使用 \mathbb 命令需要将 amsfonts 宏包添加到文档的导言区。请勿尝试使用 \mathbb{year},否则会得到一个完全不同的结果!
So
n^2 + 5 = 30\text{ so we have }n=\pm5
gives
n^2 + 5 = 30\text{ so we have }n=\pm5
How to Build Your Own Commands
命令 \newcommand 用于创建自定义命令。我们先来看一个例子:
\documentclass[11pt]{article}
\usepackage{amsmath}
\pdfpagewidth 8.5in
\pdfpageheight 11in
\newcommand{\reci}[1]{\frac{1}{#1}}
\newcommand{\hypot}[2]{\sqrt{#1^2+#2^2}}
\newcommand{\cbrt}[1]{\sqrt[3]{#1}}
\begin{document}
The reciprocal of 2 is $\reci{2}$.
The hypotenuse has length $\hypot{3}{4}$.
I'm sick of writing `$\backslash$sqrt[3]{2}$' all the time, just to get $\cbrt{2}$.
\end{document}
\newcommand 声明位于导言区。每个声明的形式为:
\newcommand{name of new command}[number of arguments]{definition}
新命令的名称必须以反斜杠 (\) 开头,这是您在文档中使用该命令时所用的名称。参数数量表示将要传递给该命令的输入参数的数量。定义部分是普通的 LaTeX 代码,其中包含 #1、#2、#3 等,用于指定调用新命令时输入参数的放置位置。
新命令用途广泛,不仅仅可以用来简化数学命令的调用。例如,试试这个:
\documentclass[11pt]{article}
\usepackage{amsmath}
\pdfpagewidth 8.5in
\pdfpageheight 11in
\newcounter{prob_num}
\setcounter{prob_num}{1}
\newcommand{\prob}[5]{\bigskip \bigskip\arabic{prob_num}.\stepcounter{prob_num} #1
\par\nopagebreak[4]\medskip A.\ #2\hfill B.\ #3\hfill
C.\ #4\hfill D.\ #5\hfill E.\ NOTA}
\begin{document}
\prob{What is $2+2$?}{4}{5}{6}{7}
\prob{What is $\sqrt{100}$?}{81}{10}{9}{1}
\prob{Evaluate $\sum_{n=1}^\infty \frac{1}{n^2}$.}
{$\frac{1}{e}$} {$\frac{2}{\pi}$}
{$\frac{\pi^3}{8}$} {$\frac{\pi^2}{6}$}
\end{document}
在上面的例子中,我们创建了一个名为 \prob 的新命令。每次调用 \prob 时,我们都会提供 5 个参数,一个用于问题,每个用于多个选项。
在导言区和 \prob 的定义中,你会看到一些新的 LaTeX 命令:
\newcounter{prob_num} creates a counter variable called prob_num
\setcounter{prob_num}{1} setsprob_num to equal 1.
在 \prob 的定义中,\bigskip 和 \medskip 命令创建垂直空间。
\arabic{prob_num} prints out the current value of the counter prob_num as an arabic numeral.
\stepcounter{prob_num} increments the counter prob_num by 1.
\nopagebreak[4] tells LaTeX not to break the page between the problem and the choices unless it really, really, really has to.
\hfill 命令会在选项之间添加大致相等的间距。
一旦你建立了一套将在许多 LaTeX 文档中使用的自定义命令,你就应该学习如何创建自己的宏包,这样你就不必将所有自定义命令从一个文档复制到另一个文档。