User Tools

Site Tools


wiki:latex_mathematics

This is an old revision of the document!


LaTeX/数学公式

本页参考:https://en.wikibooks.org/wiki/LaTeX/Mathematics,为使用方便在此重新编辑。

如果文档仅需要一些简单的数学公式,LaTeX 就可以满足需求;如果一个科技文档包含大量复杂公式, amsmath包引入一些新命令,比基础的LaTeX更强大和灵活;mathtools包修正了amsmath包的一些怪诞的地方,并增加了一些有用的设置、符号和环境。要使用这些包,需要在文档的导言中添加以下命令。

  \usepackage{amsmath}

  \usepackage{mathtools}

如果使用mathtools包,它会自动加载amsmath包。

数学环境

LaTeX 需要知道什么时候文本表示数学公式,为此需要声明一些特殊的环境。可分为两类:

  • text —— 文本公式(行内公式),显示在行内;
  • displayed—— 显示公式(行间公式),显示在独立的行。

数学环境及其快捷方式如下表所示:

类型 行内公式 行间公式 自动编号的行间公式
环境 mathdisplaymathequation
LaTeX 快捷方式\(…\) \[…\]
TeX 快捷方式$…$$$…$$

注意:数学环境与文本模式有所不同

  1. 所有空格与换行都会失去作用,要在数学模式里使用空格, 使用 \quad 输入一个标准宽度的空格,或者使用 \ 或 \; 或 \, 等输入宽度不同的空格;
  2. 不允许出现空行, 每个公式占一行;
  3. 所有字母都会按变量(var)格式排版, 如果需要排版普通文本, 请使用特定的命令。

在行内插入显示公式样式

一些算符,如$\lim$或$\sum$,在行内会被压缩,为使其能够在行内美观显示,需要在行内环境中使用\displaystyle类。 例如,使用$\displaystyle \sum$,显示行间样式的符号$\displaystyle \sum$。

符号

这些符号可以直接输入: + - = ! / ( ) [ ] < > | ' : *

其他的符号只能使用特定的命令输入,如希腊字母、集合、关系运算符、箭头等。

公式\forall x \in X, \quad \exists y \leq \epsilon 输出: $$ \forall x \in X, \quad \exists y \leq \epsilon $$

希腊字母

输入希腊字母:反斜杠+字母名称。如果首字母小写,输出小写字母;如果首字母(只有首字母)大写,输出大写字母。一些大写希腊字母与拉丁字母相似,所以 LaTeX 没有提供,如大写 Alpha and Beta 就是 A and B。小写的 epsilon, theta, kappa, phi, pi, rho, and sigma 提供了两个版本,另一个版本在名字前加var( variant)。

希腊字母 \alpha, \Alpha, \beta, \Beta, \gamma, \Gamma, \pi, \Pi, \phi, \varphi, \mu, \Phi输出:

$$ \alpha, \Alpha, \beta, \Beta, \gamma, \Gamma, \pi, \Pi, \phi, \varphi, \mu, \Phi $$

下面的 数学符号列表 可以获得完整的希腊字母列表。

运算符

运算符就是一个函数,如三角函数 (sin, cos, tan),对数和指数函数 (log, exp), 极限 (lim)。

例如 \cos (2\theta) = \cos^2 \theta - \sin^2 \theta 输出:

$$ \cos (2\theta) = \cos^2 \theta - \sin^2 \theta $$

某些运算符,如极限,其下标置于运算符下,如 \lim_{x \to \infty} \exp(-x) = 0 输出:

$$ \lim_{x \to \infty} \exp(-x) = 0 $$

对于求模运算符,有两种命令 \bmod \pmod,如 a \bmod b x \equiv a \pmod b,分别输出:

$$ a \, \bmod \, b $$

$$ x \equiv a \pmod b \,$$

指数和索引

指数和索引类似于文本模式的上标和下表。^符号用于指数,_符号用于索引,多个字符需要用花括号括起来。例如 k_{n+1} = n^2 + k_n^2 - k_{n-1} 输出:

$$ k_{n+1} = n^2 + k_n^2 - k_{n-1} \,$$

_可以和|一起使用,如公式 f(n) = n^5 + 4n^2 + 2 |_{n=17} ,输出:

$$ f(n) = n^5 + 4n^2 + 2 |_{n=17} \,$$

分数和二项式

分数使用命令:\frac{numerator}{denominator},二项式使用命令:\binom{}{},例如, \frac{n!}{k!(n-k)!} = \binom{n}{k}输出:

$$ \frac{n!}{k!(n-k)!} = \binom{n}{k} $$

可以在分数中嵌套分数,例如, \frac{\frac{1}{x}+\frac{1}{y}{y-z} 输出:

$$ \frac{\frac{1}{x}+\frac{1}{y}}{y-z} $$

注意:嵌套分数或行内分数 $ \tfrac{a}{b} $会明显比行间分数小,\tfrac}}\dfrac 命令会强制使用 \textstyle\displaystyle,同样二项式也有\tbinom\dbinom命令。

对于简单公式,使用指数下标或许更美观,例如 ^3/_7,显示为 $ ^3/_7 $。

如果显得太松散,可以插入负空格,例如^3\!/_7,显示为 $^3\!/_7$。

繁分数

繁分数使用\cfrac命令,例如:

\begin{equation}
  x = a_0 + \cfrac{1}{a_1 
          + \cfrac{1}{a_2 
          + \cfrac{1}{a_3 + \cfrac{1}{a_4} } } }
\end{equation}

输出: $$ x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4}}}} $$

\sqrt 命令输出平方根,使用可选的参数(方括号)指定次数。例如 \sqrt[n]{1+x+x^2+x^3+\dots+x^n}输出:

$$ \sqrt[n]{1+x+x^2+x^3+\dots+x^n} $$

和与积分

\sum\int分别输出和号与积分号,使用^, _指示上下限。例如 \textstyle\sum_{i=1}^{10} t_i\displaystyle\sum_{i=1}^{10} t_i 分别输出:

$$\textstyle\sum_{i=1}^{10} t_i \,$$

$$\displaystyle\sum_{i=1}^{10} t_i $$

积分号的格式也类似,其中的积分变量d要直立显示,需要使用 \mathrm{}命令,并使用 \, 命令与积分表达式保持一个小间隔。例如: \int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x 输出:

$$\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x \,$$

下面的命令有类似的用法:

\sum $\sum \,$ \prod $\prod$ \coprod $\coprod$
\bigoplus $\bigoplus$ \bigotimes $\bigotimes$ \bigodot $\bigodot$
\bigcup $\bigcup$ \bigcap $\bigcap$ \biguplus $\biguplus$
\bigsqcup $\bigsqcup$ \bigvee $\bigvee$ \bigwedge $\bigwedge$
\int $\int$ \oint $\oint$ \iint $\iint$
\iiint $\iiint$ \iiiint $\iiiint$ \idotsint $\idotsint$

\substack命令可以使用\\将上下限写在多行中。如

 \sum_{\substack{
   0<i<m \\
   0<j<n
  } } 
 P(i,j)

输出: $$ \sum_{\overset{\scriptstyle 0<i<m} {\scriptstyle 0<j<n}} P(i,j) $$

如果要把上下限写在积分号上边和下边,使用\limits命令,如 \int\limits_a^b输出:

$$ \int\limits_a^b $$

括号与限定符

LaTeX中有许多限定符:( a ), [ b ], \{ c \}, | d |, \| e \|, \langle f \rangle, \lfloor g \rfloor, \lceil h \rceil, \ulcorner i \urcorner,分别输出:

$$ ( a ), [ b ], \{ c \}, | d |, \| e \|, \langle f \rangle, \lfloor g \rfloor, \lceil h \rceil, \ulcorner i \urcorner $$

其中 \lbrack , \rbrack可以代替 [, ]。

自适应大小

使用\left, \right, \middle命令可以使限定符随公式大小自动变化。例如, P\left(A=2\middle|\frac{A^2}{B}>4\right)输出:

$$P\left(A=2\middle|\frac{A^2}{B}>4\right)$$

花括号使用\left\{, \right\}

如果只在表达式一边有限定符,则另一边看不见的限定符使用句号声明。如 \left.\frac{x^3}{3}\right|_0^1输出:

$$ \left.\frac{x^3}{3}\right|_0^1 \,$$

手动指定大小

手动指定大小时,使用\big, \Big, \bigg, \Bigg修饰命令,分别输出:

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

这些命令对嵌套的限定符特别有用。如,\frac{\mathrm d}{\mathrm d x} \big( k g(x) \big)输出:

$$ \frac{\mathrm d}{\mathrm d x} \big( k g(x) \big) $$

矩阵与数列

一个基础的矩阵使用matrix环境:类似于表格,行使用\\分隔,列使用&分隔。例如:

\[
 \begin{matrix}
  a & b & c \\
  d & e & f \\
  g & h & i
 \end{matrix}
\]

输出:

$$ \begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix} $$

如果指定对齐方式,使用带*号的环境。缺省对齐为c,但是可以使用任何array环境中有效的对齐。

 \begin{matrix}
  -1 & 3 \\
  2 & -4
 \end{matrix}
 =
 \begin{matrix*}[r]
  -1 & 3 \\
  2 & -4
 \end{matrix*}

输出:

$$ \begin{matrix} -1 & 3 \\ 2 & -4 \end{matrix} = \begin{matrix} -1 & \,\;\;3 \\ \,\;\;2 & -4 \end{matrix} $$

矩阵一般会使用限定符,可以使用\left, \right命令,也可以使用预定义的环境。

环境名称 限定符
pmatrix $( \, ) $
bmatrix $[ \, ] $
Bmatrix $\{ \, \} $
vmatrix $| \, | $
Vmatrix $\| \, \| $

注:缺省为中间对齐,加星号的版本可以指定对齐方式。

当书写任意大小的矩阵时,会用到水平、垂直、对角的点号,分别有\cdots, \vdots, \ddots命令。例如

 A_{m,n} = 
 \begin{pmatrix}
  a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
  a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  a_{m,1} & a_{m,2} & \cdots & a_{m,n} 
 \end{pmatrix}

输出:

$$ A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} $$

如果需要单独控制每列的对齐,或在行、列间插入分隔线,可以使用array环境,实质上是一个数学模式的表格。例如

 \begin{array}{c|c}
  1 & 2 \\ 
  \hline
  3 & 4
 \end{array}

输出:

$$ \begin{array}{c|c} 1 & 2 \\ \hline 3 & 4 \end{array} $$

对于矩阵中包含分数的情况,AMS 的矩阵环境没有留下足够的空间,可以在\\命令后使用可选参数指定留空大小。例如

 M = \begin{bmatrix}
       \frac{5}{6} & \frac{1}{6} & 0           \\[0.3em]
       \frac{5}{6} & 0           & \frac{1}{6} \\[0.3em]
       0           & \frac{5}{6} & \frac{1}{6}
     \end{bmatrix}

输出:

$$ M = \begin{bmatrix} \frac{5}{6} & \frac{1}{6} & 0 \\[0.3em] \frac{5}{6} & 0 & \frac{1}{6} \\[0.3em] 0 & \frac{5}{6} & \frac{1}{6} \end{bmatrix} $$

文本行中插入矩阵

要在文本行中插入矩阵,又不会增加行间,使用smallmatrix环境。例如

A matrix in text must be set smaller: $\bigl(\begin{smallmatrix} a & b
c & d \end{smallmatrix} \bigr)$ to not increase leading in a portion of text.

在公式中插入文本

数学环境中直接输入文本会出现一些问题:空格被忽略;字母为斜体;字符间距过大等。一般的解决方法是使用\text{…}命令(数字和文本之间的空格最好加在文本命令内)。例如

 50 \text{ apples} \times 100 \text{ apples} = \text{lots of apples}^2

输出: $$ 50 \text{ apples} \times 100 \text{ apples} = \text{lots of apples}^2 $$

格式化文本

可以对文本进行简单的格式,使用\textrm输出罗马字体,\textit输出斜体,\textbf输出粗体。例如

 50 \textrm{ apples} \times 100 \textbf{ apples} = \textit{lots of apples}^2

输出:

$$ 50 \;\textrm{ apples} \times 100 \;\textbf{ apples} = \textit{lots of apples}^2 $$

格式化数学符号

与格式化文本类似,下面的命令可以格式化数学表达式。

LaTeX 命令 实例 描述 使用方式
\mathnormal{…}
(或者简单的不使用任何命令)
$ABCDEF~abcdef~123456\,$ 缺省的数学字体 大部分的数学表达式
\mathrm{…} $\mathrm{ABCDEF~abcdef~123456}\,$ 缺省的数学字体 单位符号,单词函数名
\mathit{…} $\mathit{ABCDEF~abcdef~123456}\,$ 斜体 多词函数名,变量名。相比\mathnormal,单词间排列更自然,数字也斜体。
\mathbf{…} $\mathbf{ABCDEF~abcdef~123456}\,$ 粗体 矢量
\mathsf{…} $\mathsf{ABCDEF~abcdef~123456}\,$ Sans-serif字体 类别
\mathtt{…} $\mathtt{ABCDEF~abcdef~123456}\,$ 固定宽度字体
\mathfrak{…} $\mathfrak{ABCDEF~abcdef~123456}\,$ Fraktur字体 李代数,环论
\mathcal{…} $\mathcal{ABCDEF}\,$ 书法字体(仅有大写) Often used for sheaves/schemes and categories
\mathbb{…} $\mathbb{ABCDEF}\,$ 黑边粗体(仅有大写) 特定集合(如,实数)
\mathscr{…} $\mathscr{ABCDEF}\,$ Script字体(仅有大写) An alternative font for categories and sheaves.

这些命令可以放在整个数学表达式里,他们只格式化字母、数字、大写希腊字母,对数学命令不起作用。

粗体的小写希腊字母或其他符号,使用\boldsymbol,这个命令只有在当前字符集中有粗体时显示粗体,另一个办法是使用\pmb,他会显示多个字符集中的粗体。例如 \boldsymbol{\beta} = (\beta_1,\beta_2,\dotsc,\beta_n) ,输出:

$$ \boldsymbol{\beta} = (\beta_1,\beta_2,\dotsc,\beta_n) $$

字母修饰符号

除了符号和字体,还有字母修饰符:

LaTeX 命令 实例 LaTeX 命令 实例
a' or a^{\prime}
$a'\,$
a''
$a''\,$
a'''
$a'''\,$
a''''
$a''''\,$
\hat{a}
$\hat{a} \,$
\bar{a}
$\bar{a} \,$
\grave{a}
$\grave{a} \,$
\acute{a}
$\acute{a} \,$
\dot{a}
$\dot{a} \,$
\ddot{a}
$\ddot{a} \,$
\dddot{a}
$\dddot{a} \,$
\ddddot{a}
$\ddddot{a} \,$
\not{a}
$\not{a} \,$
\mathring{a}
$\mathring{a} \,$
\overrightarrow{AB}
$\overrightarrow{AB} \,$
\overleftarrow{AB}
$\overleftarrow{AB} \,$
\overline{aaa}
$\overline{aaa} \,$
\check{a}
$\check{a} \,$
\breve{a}
$\breve{a} \,$
\vec{a}
$\vec{a} \,$
\tilde{a}
$\tilde{a} \,$
\underline{a}
$\underline{a} \,$
\widehat{AAA}
$\widehat{AAA} \,$
\widetilde{AAA}
$\widetilde{AAA}$
\stackrel\frown{AAA}
$\stackrel\frown{AAA}$

颜色

xcolor允许为公式添加颜色。例如 k = {\color{red}x}{\color{blue}-} 2 ,输出:

$$ k = {\color{red}x}{\color{blue}-} 2 $$

加减号

LaTeX 处理 + 、− 号有两种方式,一个二项运算符,符号两边都有数学元素,在运算符两边会留出一定的空间;二是正负号, 这种情况下符号与后边的元素更近一些。如果符号前边没有元素而希望作为二项运算符,则需在前面加一个不可见元素{}

正负号写作: \pm ,输出:$ \pm $。负正号写作: \mp ,输出:$ \mp $。

控制水平间距

LaTeX is obviously pretty good at typesetting maths—it was one of the chief aims of the core TeX system that LaTeX extends. However, it can't always be relied upon to accurately interpret formulas in the way you did. It has to make certain assumptions when there are ambiguous expressions. The result tends to be slightly incorrect horizontal spacing. In these events, the output is still satisfactory, yet any perfectionists will no doubt wish to fine-tune their formulas to ensure spacing is correct. These are generally very subtle adjustments.

There are other occasions where LaTeX has done its job correctly, but you just want to add some space, maybe to add a comment of some kind. For example, in the following equation, it is preferable to ensure there is a decent amount of space between the maths and the text.

code= \[ f(n) = \begin{cases} n/2 & \quad \text{if } n \text{ is even}\\ -(n+1)/2 & \quad \text{if } n \text{ is odd} \end{cases} \] |render= <math> f(n) = \begin{cases} n/2 & \quad \text{if } n \text{ is even}\\ -(n+1)/2 & \quad \text{if } n \text{ is odd} \end{cases} </math>

This code produces errors with Miktex 2.9 and does not yield the results seen on the right. Use \mathrm instead of just \text.

(Note that this particular example can be expressed in more elegant code by the cases construct provided by the amsmath package described in Advanced Mathematics chapter.)

LaTeX has defined two commands that can be used anywhere in documents (not just maths) to insert some horizontal space. They are code=\quad and code=\qquad

A code=\quad is a space equal to the current font size. So, if you are using an 11pt font, then the space provided by code=\quad will also be 11pt (horizontally, of course.) The code=\qquad gives twice that amount. As you can see from the code from the above example, code=\quads were used to add some separation between the maths and the text.

OK, so back to the fine tuning as mentioned at the beginning of the document. A good example would be displaying the simple equation for the indefinite integral of y with respect to x:

<math>\int y\, \mathrm{d}x</math>

If you were to try this, you may write:

code= \int y \mathrm{d}x |render= <math>\int y \mathrm{d}x</math>

However, this doesn't give the correct result. LaTeX doesn't respect the white-space left in the code to signify that the y and the dx are independent entities. Instead, it lumps them altogether. A code=\quad would clearly be overkill in this situation—what is needed are some small spaces to be utilized in this type of instance, and that's what LaTeX provides:

{| class=“wikitable” ! Command ! Description ! Size

NB you can use more than one command in a sequence to achieve a greater space if necessary.

So, to rectify the current problem:

code= \int y\, \mathrm{d}x |render= <math>\int y\, \mathrm{d}x</math> code= \int y\: \mathrm{d}x |render= <math>\int y\;\;\!\! \mathrm{d}x</math> code= \int y\; \mathrm{d}x |render= <math>\int y\; \mathrm{d}x</math>

The negative space may seem like an odd thing to use, however, it wouldn't be there if it didn't have some use! Take the following example:

code= \left( \begin{array}{c} n \\ r \end{array} \right) = \frac{n!}{r!(n-r)!} |render= <math>\left( \begin{matrix} n \\ r \end{matrix} \right) = \frac{n!}{r!(n-r)!}</math>

The matrix-like expression for representing binomial coefficients is too padded. There is too much space between the brackets and the actual contents within. This can easily be corrected by adding a few negative spaces after the left bracket and before the right bracket.

code= \left(\! \begin{array}{c} n \\ r \end{array} \!\right) = \frac{n!}{r!(n-r)!} |render= <math>\left(\! \begin{matrix} n \\ r \end{matrix} \!\right) = \frac{n!}{r!(n-r)!} </math>

In any case, adding some spaces manually should be avoided whenever possible: it makes the source code more complex and it's against the basic principles of a What You See is What You Mean approach. The best thing to do is to define some commands using all the spaces you want and then, when you use your command, you don't have to add any other space. Later, if you change your mind about the length of the horizontal space, you can easily change it modifying only the command you defined before. Let us use an example: you want the d of a dx in an integral to be in roman font and a small space away from the rest. If you want to type an integral like code=\int x \, \mathrm{d} x, you can define a command like this: code= \newcommand{\dd}{\mathop{}\,\mathrm{d}<!---->} in the preamble of your document. We have chosen code=\dd just because it reminds the “d” it replaces and it is fast to type. Doing so, the code for your integral becomes code=\int x \dd x. Now, whenever you write an integral, you just have to use the code=\dd instead of the “d”, and all your integrals will have the same style. If you change your mind, you just have to change the definition in the preamble, and all your integrals will be changed accordingly.

Manually Specifying Formula Style

To manually display a fragment of a formula using text style, surround the fragment with curly braces and prefix the fragment with code=\textstyle. The braces are required because the code=\textstyle macro changes the state of the renderer, rendering all subsequent mathematics in text style. The braces limit this change of state to just the fragment enclosed within. For example, to use text style for just the summation symbol in a sum, one would enter code= \begin{equation} C^i_j = {\textstyle \sum_k} A^i_k B^k_j \end{equation} The same thing as a command would look like this: code= \newcommand{\tsum}[1]{{\textstyle \sum_{#1} }} Note the extra braces. Just one set around the expression won't be enough. That would cause all math after code=\tsum k to be displayed using text style.

To display part of a formula using display style, do the same thing, but use code=\displaystyle instead.

高级数学: AMS 数学包

The AMS (American Mathematical Society) mathematics package is a powerful package that creates a higher layer of abstraction over mathematical LaTeX language; if you use it it will make your life easier. Some commands amsmath introduces will make other plain LaTeX commands obsolete: in order to keep consistency in the final output you'd better use amsmath commands whenever possible. If you do so, you will get an elegant output without worrying about alignment and other details, keeping your source code readable. If you want to use it, you have to add this in the preamble: code= \usepackage{amsmath}

Introducing dots in formulas

amsmath defines also the code=\dots command, that is a generalization of the existing code=\ldots. You can use code=\dots in both text and math mode and LaTeX will replace it with three dots “…” but it will decide according to the context whether to put it on the bottom (like code=\ldots) or centered (like code=\cdots).

LaTeX gives you several commands to insert dots (ellipses) in your formulae. This can be particularly useful if you have to type big matrices omitting elements. First of all, here are the main dots-related commands LaTeX provides:

{| class=“wikitable” ! Code !! Output !! Comment

code=\dots <math>\dots</math>
code=\ldots <math>\ldots</math>
code=\cdots <math>\cdots</math>
code=\vdots <math>\vdots</math>
code=\ddots <math>\ddots</math>
code=\iddots
code=\hdotsfor{n}<!----> <math>\ldots \ldots</math>

Instead of using code=\ldots and code=\cdots, you should use the semantically oriented commands. It makes it possible to adapt your document to different conventions on the fly, in case (for example) you have to submit it to a publisher who insists on following house tradition in this respect. The default treatment for the various kinds follows American Mathematical Society conventions.

{| class=“wikitable” ! Code !! Output !! Comment

Write an equation with the align environment

How to write an equation with the align environment with the amsmath package is described in Advanced Mathematics.

数学符号列表

All the pre-defined mathematical symbols from the \TeX\ package are listed below. More symbols are available from extra packages.

{| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“10”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“10”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“10”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“10”

!scope=“col”| Symbol !!scope=“col”| Script

<math><\,</math>
<math»\,</math>
<math>=\,</math>
<math>\parallel\,</math>
<math>\nparallel\,</math>
<math>\leq\,</math>
<math>\geq\,</math>
<math>\doteq\,</math>
<math>\asymp\,</math>
<math>\bowtie\,</math>
<math>\ll\,</math>
<math>\gg\,</math>
<math>\equiv\,</math>
<math>\vdash\,</math>
<math>\dashv\,</math>
<math>\subset\,</math>
<math>\supset\,</math>
<math>\approx\,</math>
<math>\in\,</math>
<math>\ni\,</math>
<math>\subseteq\,</math>
<math>\supseteq\,</math>
<math>\cong\,</math>
<math>\smile\,</math>
<math>\frown\,</math>
<math>\nsubseteq\,</math>
<math>\nsupseteq\,</math>
<math>\simeq\,</math>
<math>\models\,</math>
<math>\notin\,</math>
<math>\sqsubset\,</math>
<math>\sqsupset\,</math>
<math>\sim\,</math>
<math>\perp\,</math>
<math>\mid\,</math>
<math>\sqsubseteq\,</math>
<math>\sqsupseteq\,</math>
<math>\propto\,</math>
<math>\prec\,</math>
<math>\succ\,</math>
<math>\preceq\,</math>
<math>\succeq\,</math>
<math>\neq\,</math>
<math>\sphericalangle\,</math>
<math>\measuredangle\,</math>

{| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“9”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“9”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“9”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\pm\,</math>
<math>\cap\,</math>
<math>\diamond\,</math>
<math>\oplus\,</math>
<math>\mp\,</math>
<math>\cup\,</math>
<math>\bigtriangleup\,</math>
<math>\ominus\,</math>
<math>\times\,</math>
<math>\uplus\,</math>
<math>\bigtriangledown\,</math>
<math>\otimes\,</math>
<math>\div\,</math>
<math>\sqcap\,</math>
<math>\triangleleft\,</math>
<math>\oslash\,</math>
<math>\ast\,</math>
<math>\sqcup\,</math>
<math>\triangleright\,</math>
<math>\odot\,</math>
<math>\star\,</math>
<math>\vee\,</math>
<math>\bigcirc\,</math>
<math>\circ\,</math>
<math>\dagger\,</math>
<math>\wedge\,</math>
<math>\bullet\,</math>
<math>\setminus\,</math>
<math>\ddagger\,</math>
<math>\cdot\,</math>
<math>\wr\,</math>
<math>\amalg\,</math>

{| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“12”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\exists\,</math>
<math>\rightarrow\,</math>
<math>\nexists\,</math>
<math>\leftarrow\,</math>
<math>\forall\,</math>
<math>\mapsto\,</math>
<math>\neg\,</math>
<math>\implies\,</math>
<math>\subset\,</math>
<math>\Rightarrow\,</math>
<math>\supset\,</math>
<math>\leftrightarrow\,</math>
<math>\in</math>
<math>\iff\,</math>
<math>\notin\,</math>
<math>\Leftrightarrow\,</math>
<math>\ni\,</math>
<math>\top\,</math>
<math>\land\,</math>
<math>\bot\,</math>
<math>\lor\,</math>
<math>\emptyset\,</math> and <math>\varnothing\,</math>

{| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\,</math>
<math>\\,</math>
<math>/\,</math>
<math>\backslash\,</math>
<math>\{\,</math>
<math>\}\,</math>
<math>\langle\,</math>
<math>\rangle\,</math>
<math>\uparrow\,</math>
<math>\Uparrow\,</math>
<math>\lceil\,</math>
<math>\rceil\,</math>
<math>\downarrow\,</math>
<math>\Downarrow\,</math>
<math>\lfloor\,</math>
<math>\rfloor\,</math>

Note: To use the Greek Letters in LaTeX that have the same appearance in the Latin alphabet, just use Latin: e.g., A instead of Alpha, B instead of Beta, etc. {| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“13”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\Alpha\,</math> and <math>\alpha\,</math>
<math>\Nu\,</math> and <math>\nu\,</math>
<math>\Beta\,</math> and <math>\beta\,</math>
<math>\Xi\,</math> and <math>\xi\,</math>
<math>\Gamma\,</math> and <math>\gamma\,</math>
<math>\Omicron\,</math> and <math>\omicron\,</math>
<math>\Delta\,</math> and <math>\delta\,</math>
<math>\Pi\,</math>, <math>\pi\,</math> and <math>\varpi</math>
<math>\Epsilon\,</math>, <math>\epsilon\,</math> and <math>\varepsilon\,</math>
<math>\Rho\,</math>, <math>\rho\,</math> and <math>\varrho\,</math>
<math>\Zeta\,</math> and <math>\zeta\,</math>
<math>\Sigma\,</math>, <math>\sigma\,</math> and <math>\varsigma\,</math>
<math>\Eta\,</math> and <math>\eta\,</math>
<math>\Tau\,</math> and <math>\tau\,</math>
<math>\Theta\,</math>, <math>\theta\,</math> and <math>\vartheta\,</math>
<math>\Upsilon\,</math> and <math>\upsilon\,</math>
<math>\Iota\,</math> and <math>\iota\,</math>
<math>\Phi\,</math>, <math>\phi\,</math>, and <math>\varphi\,</math>
<math>\Kappa\,</math>, <math>\kappa\,</math> and <math>\varkappa\,</math>
<math>\Chi\,</math> and <math>\chi\,</math>
<math>\Lambda\,</math> and <math>\lambda\,</math>
<math>\Psi\,</math> and <math>\psi\,</math>
<math>\Mu\,</math> and <math>\mu\,</math>
<math>\Omega\,</math> and <math>\omega\,</math>

{| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“4”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“4”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“4”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“4”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\partial\,</math>
<math>\imath\,</math>
<math>\Re\,</math>
<math>\nabla\,</math>
<math>\aleph\,</math>
<math>\eth\,</math>
<math>\jmath\,</math>
<math>\Im\,</math>
<math>\Box\,</math>
<math>\beth\,</math>
<math>\hbar\,</math>
<math>\ell\,</math>
<math>\wp\,</math>
<math>\infty\,</math>
<math>\gimel\,</math>

*Not predefined in LATEX 2. Use one of the packages latexsym, amsfonts, amssymb, txfonts, pxfonts, or wasysym {| class=“wikitable” latexfontsize=“scriptsize”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

rowspan=“5”

!scope=“col”| Symbol !!scope=“col”| Script

<math>\sin\,</math>
<math>\arcsin\,</math>
<math>\sinh\,</math>
<math>\sec\,</math>
<math>\cos\,</math>
<math>\arccos\,</math>
<math>\cosh\,</math>
<math>\csc\,</math>
<math>\tan\,</math>
<math>\arctan\,</math>
<math>\tanh\,</math>
<math>\cot\,</math>
<math>\arccot\,</math>
<math>\coth\,</math>

If LaTeX does not include a command for the mathematical operator you want to use, for example

\cis

(<strong>c</strong>osine plus <strong>i</strong> times <strong>s</strong>ine), add to your preamble: \DeclareMathOperator\cis{cis}

You can then use

\cis

in the document just like

\cos

or any other mathematical operator.

<!– Sections remaining: Table 3 onwards from symbols.pdf –>

clear

总结

As you begin to see, typesetting math can be tricky at times. However, because LaTeX provides so much control, you can get professional quality mathematics typesetting with relatively little effort (once you've had a bit of practice, of course!). It would be possible to keep going and going with math topics because it seems potentially limitless. However, with this tutorial, you should be able to get along sufficiently.

* introduce symbols from [http://www.andy-roberts.net/res/writing/latex/symbols.pdf] * add symbols from [http://www.ctan.org/tex-archive/macros/latex/contrib/wasysym/wasysym.pdf] * consider adding symbols from [http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-letter.pdf] -- the list of nearly all symbols available for LaTeX * Consider, instead of using the symbols from the above mentioned, using what has already been introduced in [http://en.wikipedia.org/wiki/Math_markup] instead of retyping the tables * How to box an equation within an align environment * Color in equations

Notes

<references/>

Further reading

* Displaying a formula: Wikimedia uses a subset of LaTeX commands.

* [http://detexify.kirelabs.org detexify]: applet for looking up LaTeX symbols by drawing them * [http://mirrors.ctan.org/macros/latex/required/amsmath/amsmath.pdf <tt>amsmath</tt> documentation] * [http://www.thestudentroom.co.uk/wiki/LaTeX LaTeX - The Student Room] * [http://www.ctan.org/tex-archive/info/symbols/comprehensive The Comprehensive LaTeX Symbol List] * [http://mathlex.org/latex MathLex - LaTeX math translator and equation builder]

<noinclude> Rules and Struts|Advanced Mathematics </noinclude>

LaTeX/Matematyka

wiki/latex_mathematics.1553912693.txt.gz · Last modified: 2019/03/29 22:24 by zhwiki