(8)Latex中的数学公式

目录

  • 行内公式
  • 上下标
  • 希腊字母
  • 数学函数
    • 分式
  • 行间公式
  • 矩阵的排版
    • 常规矩阵
    • 分块矩阵(矩阵嵌套)
    • 三角矩阵
    • 行内小矩阵
    • array排版矩阵
  • 多行公式

行内公式

  1. 美元符号
$1+2=3$

1 + 2 = 3 1 + 2 = 3 1+2=3

  1. 括号
\(1+2=3\)
  1. math环境进行排版
\begin{math}
1+2=3
\end{math}

上下标

  1. 下标_
    当有多个字符需要在一起的时候,用大括号{}进行处理
  2. 上标^

希腊字母

$\alpha$ α \alpha α
$\beta$ β \beta β
$\gamma$ γ \gamma γ
$\epsilon$ ϵ \epsilon ϵ
$\pi$ π \pi π
$\omega$ ω \omega ω

$\Gamma$ Γ \Gamma Γ
$\Delta$ Δ \Delta Δ
$\Theta$ Θ \Theta Θ
$\Pi$ Π \Pi Π
$\Omega$ Ω \Omega Ω

数学函数

$\log$ log ⁡ 2 1 = 0 \log_21=0 log21=0
$\sin$ sin ⁡ 2 + c o s 2 = 1 \sin^2+cos^2=1 sin2+cos2=1
$\cos$ cos ⁡ \cos cos
$\arcsin$ arcsin ⁡ \arcsin arcsin
$\arccos$ arccos ⁡ \arccos arccos
$\ln$ ln ⁡ \ln ln
$\sqrt$ 2 \sqrt{2} 2
a 2 4 \sqrt[4]{a^2} 4a2

分式

$3/4$ 3 / 4 3/4 3/4
$\frac{3}{4}$ 3 4 \frac{3}{4} 43

行间公式

  1. 可以使用$$排版行间公式
$$1+2 =3$$

1 + 2 = 3 1+2=3 1+2=3

  1. 可以使用中括号进行行间排版\[\]
\[1+2=3\]
  1. 还可以使用环境变量来排版行间公式
\begin{displaymath}
1+2=3
\end{displaymath}
  1. 带自动编号的equation环境
\ref{eq:commtative}
\begin{equation}
a+b = c \label{eq:commtative}
\end{equation}
  1. 不带自动编号的equation*环境
\begin{equation*}
\end{equation*}

公式的编号与引用也是自动实现的,在排版中要习惯采用自动化的方式实现处理图、表、公式的编号与交叉引用。

矩阵的排版

在LaTeX中可以使用matrix环境实现矩阵的排版,使用这个环境需要引入amsmath宏包,在matrix环境中使用&分割列,使用\\ 分割行

常规矩阵

$$
\begin{matrix}
0 & 1 \\
1 & 0 
\end{matrix}
$$

0 1 1 0 \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} 0110

$$
\begin{pmatrix}
0 & 1 \\
1 & 0 
\end{pmatrix}
$$

( 0 1 1 0 ) \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} (0110)

$$
\begin{bmatrix}
0 & 1 \\
1 & 0 
\end{bmatrix}
$$

[ 0 1 1 0 ] \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} [0110]

$$
\begin{Bmatrix}
0 & 1 \\
1 & 0 
\end{Bmatrix}
$$

{ 0 1 1 0 } \begin{Bmatrix} 0 & 1 \\ 1 & 0 \end{Bmatrix} {0110}

$$
\begin{vmatrix}
0 & 1 \\
1 & 0 
\end{vmatrix}
$$

∣ 0 1 1 0 ∣ \begin{vmatrix} 0 & 1 \\ 1 & 0 \end{vmatrix} 0110

$$
\begin{Vmatrix}
0 & 1 \\
1 & 0 
\end{Vmatrix}
$$

a = ∥ a 0 … ⋱ 0 d s e ∥ a= \begin{Vmatrix} a_0 & \dots \\ \ddots & 0 \\ ds & e \end{Vmatrix} a=a0ds0e
在矩阵中经常使用的省略符号可以使用\dots\vdots\ddots实现。例如

$$
A= \begin{bmatrix}
a_{11} & \dots & a_{1n} \\
& \ddots & \vdots \\
a_{n1}  &  \dots & a_{nn}
\end{bmatrix}_{n \times n}
$$

A = [ a 11 … a 1 n ⋱ ⋮ a n 1 … a n n ] n × n A= \begin{bmatrix} a_{11} & \dots & a_{1n} \\ & \ddots & \vdots \\ a_{n1} & \dots & a_{nn} \end{bmatrix}_{n \times n} A=a11an1a1nannn×n

分块矩阵(矩阵嵌套)

$$
\begin{pmatrix}
\begin{matrix}
1 & 0 \\
0 &1
\end{matrix} 
&\text{0} \\ %\text 命令用于在数学模式中切换为文本模式
\text{0} &
\begin{matrix}
 1 & 0 \\
0 &1
\end{matrix}
\end{pmatrix}
$$

( 1 0 0 1 0 0 1 0 0 1 ) \begin{pmatrix} \begin{matrix} 1 & 0 \\ 0 &1 \end{matrix} &\text{0} \\ \text{0} & \begin{matrix} 1 & 0 \\ 0 &1 \end{matrix} \end{pmatrix} 1001001001

三角矩阵

 $$
\begin{pmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
&a_{22} & \cdots & a_{2n} \\
& &\ddots & \vdots \\
\multicolumn{2}{c}{\raisebox{1.3ex}[0pt]{\Huge 0}} & & a_{nn}
\end{pmatrix}
$$

行内小矩阵

\begin{math}
\left(
\begin{smallmatrix}
x & y \\
y & x
\end{smallmatrix}
\right)
\end{math}

array排版矩阵

$$
\begin{array}{|r|r}
\frac{1}{2} & 0 \\
\hline
0 & -\frac1bc
\end{array}
$$

1 2 0 0 − 1 b c \begin{array}{|r|r} \frac{1}{2} & 0 \\ \hline 0 & -\frac1bc \end{array} 2100b1c

多行公式

首先需要引入amsmathamssymb宏包,可以使用gather环境实现多行的排版,使用双\\进行换行。

%带编号
\begin{gather}
a+b =c  \\
b = c - a \\
\end{gather}

% 不带编号
\begin{gather*}
a+b =c  \\
b = c - a \\
\end{gather*}

%不带编号
\begin{gather}
a+b =c  \notag \\
b = c - a \notag \\
\end{gather}

使用align环境在指定的位置对齐,对齐的位置是由&符号进行指定的。

%带编号
\begin{align}
x & = t +\cos t + 1 \\
y & = 2 \sin t
\end{align}
%不带编号
\begin{align*}
x & = t +\cos t + 1 \\
y & = 2 \sin t
\end{align*}

是用split环境在equation环境中实现一个公式的多行排版

\begin{equation}
	\begin{split}
	\cos 2x = & \cos^2 x - \sin^2 x \\
	& = 2\cos^2 x - 1 
	\end{split}
\end{equation}

对于分段函数的排版也可以使用case环境。

\begin{equation}
D(x) = \begin{case}
1, & \text{如果} x \in \mathbb{Q}; \\
0, & \text{如果} x \in \mathbb{R}; 
\end{case}
\end{equation}

你可能感兴趣的:(LaTeX)