参考
在 CMD 中输入下面的命令可以打开《一份不太简短的latex介绍》
访问 lshort | github 可以获取这篇文章的 LaTex 源代码。
参考视频: latex中文教程-15集从入门到精通包含各种latex操作
视频由西北农林科技大学信息工程学院耿楠老师于2016年录制
LaTeX环境配置
安装 Texlive
使用 tex --version
命令查看环境变量是否配置成功, 如果没有则在环境变量中添加 D:\texlive\2021\bin\win32
安装 TeXstudio (可选)
Option -> Configure TeXstudio -> Build -> Default Compiler
中设置 TeXstudio 默认编译方式为 Xelatex
安装 VSCode + LaTex Workshop (可选, 推荐)
LaTeX源文件的基本结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 \documentclass {article} \title {Title Of My Article} \author {xiaophai} \date {\today } \begin {document} \maketitle Hello World! \end {document}
LaTeX处理中文的方法
1 2 3 4 5 6 7 8 \documentclass {article}\usepackage {ctex} \begin {document} 你好, \LaTeX \end {document}
1 2 \documentclass {article}\usepackage {ctex}
cmd中输入下面的命令可以打开<CTeX宏集手册>
LaTeX的字体字号设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 \textrm {Roman Family} \textsf {Sans Serif Family} \texttt {Typewriter Family} \rmfamily Roman Family\sffamily Sans Serif Family\ttfamily Typewriter Family{\rmfamily Roman Family} {\sffamily Sans Serif Family} {\ttfamily Typewriter Family}
1 2 3 4 5 6 7 8 9 10 11 \textup {Upright Shape} \textit {Italic Shape} \textsl {Slanted Shape} \textsc {Small Caps Shape} {\upshape Upright Shape} {\itshape Italic Shape} {\slshape Slanted Shape} {\scshape Small Capes Shape}
1 2 3 4 5 6 7 8 9 {\songti 宋体} {\heiti 黑体} {\fangsong 仿宋} {\kaishu 楷书} \textbf {粗体} \textit {斜体} {\bfseries 加粗}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 {\tiny Hello} {\scriptsize Hello} {\footnotesize Hello} {\small Hello} {\normalsize Hello} {\large Hello} {\Large Hello} {\LARGE Hello} {\huge Hello} {\Huge Hello} \documentclass [10pt]{article}\documentclass [11pt]{article}\documentclass [12pt]{article}
t i n y H e l l o s c r i p t s i z e H e l l o f o o t n o t e s i z e H e l l o s m a l l H e l l o n o r m a l s i z e H e l l o d e f a u l t H e l l o l a r g e H e l l o L a r g e H e l l o L A R G E H e l l o h u g e H e l l o H u g e H e l l o \begin{array}{rl}
\tiny tiny & \tiny Hello\\
\scriptsize scriptsize & \scriptsize Hello\\
\footnotesize footnotesize & \footnotesize Hello\\
\small small & \small Hello\\
\normalsize normalsize & \normalsize Hello\\
\textcolor{blue}{default} & \textcolor{blue}{Hello}\\
\large large & \large Hello\\
\Large Large & \Large Hello\\
\LARGE LARGE & \LARGE Hello\\
\huge huge & \huge Hello\\
\Huge Huge & \Huge Hello
\end{array}
t in y scr i pt s i ze f oo t n o t es i ze s ma ll n or ma l s i ze d e f a u lt l a r g e L a r g e L A RGE h ug e H ug e He ll o He ll o He ll o He ll o He ll o He ll o He ll o He ll o He ll o He ll o He ll o
当需要复杂且常用的字体命令时可以在导言区自定义命令
1 2 3 4 \newcommand {\newfont }{\textbf {\textsf {Fancy Text}}}\newfont
字号
初号
小初
一号
小一
二号
小二
三号
大小
42pt
36pt
26pt
24pt
22pt
18pt
16pt
字号
小三
四号
小四
五号
小五
六号
小六
大小
15pt
14pt
12pt
10pt
9pt
7.5pt
6.5pt
LaTeX文档的基本结构
1 2 3 4 5 6 7 8 9 10 11 12 \documentclass {ctexart}\begin {document} \section {实验方法} \section {实验结果} \subsection {数据获取} \subsubsection {实验条件} \subsubsection {实验过程} \subsection {结果分析} \section {结论} \end {document}
空行和"\\"的区别
"\\"只是换行, 行首不会缩进
空行是开启新的段落, 行首有缩进
1 2 3 4 5 6 7 8 9 \documentclass {ctexart}\begin {document} 多年以后,奥雷连诺上校站在行刑队面前,准会想起父亲带他去参观冰块的那个遥远的下午。 \\ 当时,马孔多是个二十户人家的村庄,一座座土房都盖在河岸上,河水清澈,沿着遍布石头的河床流去,河里的石头光滑、洁白,活象史前的巨蛋。 这块天地还是新开辟的,许多东西都叫不出名字,不得不用手指指点点。每年三月,衣衫褴楼的吉卜赛人都要在村边搭起帐篷,在笛鼓的喧嚣声中,向马孔多的居 民介绍科学家的最新发明。 \end {document}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 \ctexset { section={ format+ = \zihao {-3} \heiti \raggedright , name = {,、}, number = \chinese {section}, beforeskip = 1.0ex plus 0.2ex minus .2ex, afterskip = 1.0ex plus 0.2ex minus .2ex, aftername = \hspace {0pt} }, subsection={ format+ = \zihao {4} \kaishu \raggedright , number = \chinese {subsection}, name = {(,)}, beforeskip = 1.0ex plus 0.2ex minus .2ex, afterskip = 1.0ex plus 0.2ex minus .2ex, aftername = \hspace {0pt} }, subsubsection={ format+ = \zihao {-4} \fangsong \centering , number = \ttfamily \arabic {subsubsection}, name = {,.}, beforeskip = 1.0ex plus 0.2ex minus .2ex, afterskip = 1.0ex plus 0.2ex minus .2ex, aftername = \hspace {0pt} } }
LaTeX中的特殊字符
空白符号
空行分段, 多个空行等同一个空行
自动缩进, 绝对不能使用空格代替
英文中多个空格处理为一个空格, 中文中空格被忽略
汉字与其它字符的间距会自动由XeLaTeX处理
禁止使用中文全角空格
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a\quad b a\qquad b a\, b a\thinspace b a\enspace b a\ b a~b a\kern 1pc b a\kern -1em b a\hskip 1em b a\hspace {35pt}b a\hphantom {xyz}b a\hfill b
1 \# \$ \% \{ \} \~ {} \_ {} \^ {} \& \textbackslash
1 \S \P \dag \ddag \copyright \pounds
1 \TeX {} \LaTeX {} \LaTeXe {}
LaTeX中的插图
1 2 3 4 5 6 7 8 \usepackage {graphicx}\graphicspath {{figures/},{pics/}}\includegraphics [<选项>]{<图片名>}
1 2 3 4 5 6 7 8 9 \includegraphics [scale=0.3]{} \includegraphics [height=2cm]{} \includegraphics [width=2cm]{} \includegraphics [height=0.1\textheight ]{} \includegraphics [width=0.2\textwidth ]{} \includegraphics [angle=-45,width=0.2\textwidth ]{}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \begin {figure}[htbp]\centering \subfigure [标题1]{\includegraphics [width=0.4\textwidth ]{fig-1}} & \subfigure [标题2]{\includegraphics [width=0.4\textwidth ]{fig-2}} \\ \subfigure [标题3]{\includegraphics [width=0.4\textwidth ]{fig-3}} & \subfigure [标题4]{\includegraphics [width=0.4\textwidth ]{fig-4}} \caption {大标题}\end {figure}
1 2 3 4 5 6 \usepackage {multicol} \begin {multicols}{2} \end {multicols}
1 2 3 4 5 6 \begin {figure*}[htbp] \centering \includegraphics [width=\textwidth ]{...} \caption {...} \end {figure*}
效果如下
Latex的双栏环境是不支持浮动体的, 直接使用figure环境会导致图片丢失.
1 2 3 4 5 6 7 8 \usepackage {float}\begin {figure}[H]\label {...} \centering \includegraphics [width=0.5\textwidth ]{...} \caption {...} \end {figure}
LaTeX中的表格和列表
表格在线生成工具
Latex表格的绘制语法较为复杂, 建议使用表格生成工具
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \begin {tabular}{l||c|c|c|r} \hline 姓名 & 语文 & 数学 & 英语 & 备注 \\ \hline \hline 张三 & 87 & 100 & 93 & 优秀 \\ \hline 李四 & 75 & 64 & 52 & 补考 \\ \hline 王五 & 80 & 82 & 78 & \\ \hline \end {tabular}
1 2 3 4 5 6 7 8 9 10 11 \usepackage {booktabs} \begin {tabular}{ccccc}\toprule x & 0 & 1 & 2 & 3 \\ \midrule Pr & 1/8 & 3/8 & 3/8 & 1/8 \\ \bottomrule \end {tabular}
长表格分页排版
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 \begin {longtable}[h]{lcl} \caption {主要变量符号及意义}\\ \toprule [1.5pt] \makebox [0.03\textwidth ][l]{序号} & \makebox [0.1\textwidth ][c]{符号} & \makebox [0.7\textwidth ][c]{意义}\\ \midrule [1pt] \endfirsthead \endhead \bottomrule [1.5pt] \endlastfoot \endfoot 1 & $ x_ 1$ & 说明1 \\ 2 & $ x_ 2$ & 说明2 \\ 3 & $ x_ 3$ & 说明3 \\ 4 & $ x_ 4$ & 说明4 \\ 5 & $ x_ 5$ & 说明5 \\ 6 & $ x_ 6$ & 说明6 \\ 7 & $ x_ 7$ & 说明7 \\ 8 & $ x_ 8$ & 说明8 \\ 9 & $ x_ 9$ & 说明9 \label {tab:symbol1} \end {longtable}
使用\endfirstheader
和\endfoot
效果
使用\endheader
和\endfoot
效果
LaTeX 中常见的列表环境有 enumerate、itemize 和 description。这三种列表环境的主要区别是列表项标签的不同:
1.enumerate 是有序的列表
1 2 3 4 5 \begin {enumerate} \item This is the first item \item This is the second item \item This is the third item \end {enumerate}
1 2 3 4 5 6 7 \usepackage {enumitem}\begin {enumerate}[label={(\arabic *)}] ... \end {enumerate}
2.itemize 以圆点作为标签
1 2 3 4 5 \begin {itemize} \item This is the first item \item This is the second item \item This is the third item \end {itemize}
3.description 是解说列表,可以指定标签
1 2 3 4 5 6 \begin {description} \item [\ding {47}] This is the first item \item [\ding {47}] This is the second item \item [\ding {47}] This is the third item \end {description}
LaTeX中的浮动体
浮动体是为了排版更加紧密, 有的图片直接放文字下面会另起一页, 浮动体就避免了这个问题.
1 2 3 4 5 6 7 8 9 \LaTeX {}的吉祥物,小狮子见图\ref {fig-lion}\begin {figure}[htbp] \centering \includegraphics [scale=0.3]{lion} \caption {\LaTeX {}的吉祥物---小狮子} \label {fig-lion} \end {figure}
1 2 3 4 5 6 7 8 9 10 \begin {table}[!htbp] \centering \begin {tabular}{ccccc} \toprule x & 0 & 1 & 2 & 3 \\ \midrule Pr & 1/8 & 3/8 & 3/8 & 1/8 \\ \bottomrule \end {tabular} \end {table}
<允许位置>参数(默认tbp)
h
代表此处(here), 代码所在的上下文位置
t
代表页顶(top), 代码所在的页面或者之后页面的顶部
b
代表页底(bottom), 代码所在的页面或者之后页面的底部
p
代表独立一页(page), 浮动页面
!
表示忽略美观因素,尽可能按照参数指定的方式来处理表格浮动位置。
LaTeX数学公式初步
公式在线生成工具
TexStudio行内公式快捷键Ctrl
+Shift
+M
TexStudio行间公式快捷键Ctrl
+Shift
+N
1 2 3 4 $ x^ 2+y^ 2 = 1$ $ x^ 2+y^ 2 = 1$
x 2 + y 2 = 1 x^2+y^2 = 1 x 2 + y 2 = 1
1 2 3 4 5 6 7 8 9 10 11 12 $ $ \sin ^ 2(x)+\cos ^ 2(x)=1 $ $ \[ \sin ^ 2(x)+\cos ^ 2(x)=1 \] \begin {displaymath} \sin ^ 2(x)+\cos ^ 2(x)=1 \end {displyamath}
sin 2 ( x ) + cos 2 ( x ) = 1 \sin^2(x)+\cos^2(x)=1
sin 2 ( x ) + cos 2 ( x ) = 1
1 2 3 4 5 6 7 8 9 10 11 12 \begin {equation}\sin ^ 2(x)+\cos ^ 2(x)=1 \label {eq:identity1}\end {equation}\begin {equation*}\sin ^ 2(x)+\cos ^ 2(x)=1 \label {eq:identity2}\end {equation*}
\begin{equation}
\sin^2(x)+\cos^2(x)=1 \label{eq:identity1}
\end{equation}
1 $ a_ 1,a_ {22},a^ 3,a^ {44},a_ {5}^ {6}$
a 1 , a 22 , a 3 , a 44 , a 5 6 a_1,a_{22},a^3,a^{44},a_{5}^{6}
a 1 , a 22 , a 3 , a 44 , a 5 6
A \Alpha A
α \alpha α
alpha
N \Nu N
ν \nu ν
nu
B \Beta B
β \beta β
beta
Ξ \Xi Ξ
ξ \xi ξ
xi
Γ \Gamma Γ
γ \gamma γ
gamma
O \Omicron O
ο \omicron ο
omicron
Δ \Delta Δ
δ \delta δ
delta
Π \Pi Π
π \pi π
pi
E \Epsilon E
ϵ \epsilon ϵ
epsilon
P \Rho P
ρ \rho ρ
rho
Z \Zeta Z
ζ \zeta ζ
zeta
Σ \Sigma Σ
σ \sigma σ
sigma
H \Eta H
η \eta η
eta
T \Tau T
τ \tau τ
tau
Θ \Theta Θ
θ \theta θ
theta
Υ \Upsilon Υ
υ \upsilon υ
upsilon
I \Iota I
ι \iota ι
iota
Φ \Phi Φ
ϕ \phi ϕ
phi
K \Kappa K
κ \kappa κ
kappa
X \Chi X
χ \chi χ
chi
Λ \Lambda Λ
λ \lambda λ
lambda
Ψ \Psi Ψ
ψ \psi ψ
psi
M \Mu M
μ \mu μ
mu
Ω \Omega Ω
ω \omega ω
omega
ϵ θ π ρ σ ϕ ε ϑ ϖ ϱ ς φ varepsilon vartheta varpi varrho varsigma varphi \begin{array}{}
\epsilon & \theta & \pi & \rho & \sigma & \phi \\
\varepsilon & \vartheta & \varpi & \varrho & \varsigma & \varphi\\
\text{varepsilon} & \text{vartheta} & \text{varpi} & \text{varrho} & \text{varsigma} & \text{varphi}
\end{array}
ϵ ε varepsilon θ ϑ vartheta π ϖ varpi ρ ϱ varrho σ ς varsigma ϕ φ varphi
ı ȷ ℓ ℜ \imath \quad \jmath \quad \ell \quad \Re
ℓ ℜ
1 \log ,\ln ,\sin ,\cos ,\tan ,\arcsin ,\arccos ,\arctan ,\exp
log , ln , sin , cos , tan , arcsin , arccos , arctan , exp , ⋯ \log,\ln,\sin,\cos,\tan,\arcsin,\arccos,\arctan,\exp,\cdots
log , ln , sin , cos , tan , arcsin , arccos , arctan , exp , ⋯
x , x 3 \sqrt{x}, \sqrt[3]{x}
x , 3 x
3 / 4 , 3 4 3/4, \frac{3}{4}
3/4 , 4 3
1 2 范数符号: \Vert 或者 \| 绝对值符号: \lvert 或者 \rvert 或者 \vert
∥ a ∥ ∣ a ∣ \Vert a \| \quad \lvert a \rvert
∥ a ∥ ∣ a ∣
1 \big | \Big | \bigg | \Bigg |
x ∣ 0 1 x ∣ 0 1 x ∣ 0 1 x ∣ 0 1 x\big|_0^1 \qquad x\Big|_0^1 \qquad x\bigg|_0^1 \qquad x\Bigg|_0^1
x 0 1 x 0 1 x 0 1 x 0 1
≠ ≤ ≥ ≡ \neq \qquad \leq \qquad \geq \qquad \equiv
= ≤ ≥ ≡
1 \in \notin \ni (或者\owns ) \not \ni (或者\not \owns ) \ll \gg
∈ ∉ ∋ ∌ ≪ ≫ \in \qquad \notin \qquad \owns \qquad \not\owns \qquad \ll \qquad \gg
∈ ∈ / ∋ ∋ ≪ ≫
1 \subset \supset \subseteq \supseteq \cup \cap
⊂ ⊃ ⊆ ⊇ ∪ ∩ \subset \qquad \supset \qquad \subseteq \qquad \supseteq \qquad \cup \qquad \cap
⊂ ⊃ ⊆ ⊇ ∪ ∩
1 \propto \sim \approx \cong \perp
∝ ∼ ≈ ≅ ⊥ \propto \qquad \sim \qquad \approx \qquad \cong \qquad \perp
∝ ∼ ≈ ≅ ⊥
1 \because \therefore \forall \exists \nexists
∵ ∴ ∀ ∃ ∄ \because \qquad \therefore \qquad \forall \qquad \exists \qquad \nexists
∵ ∴ ∀ ∃ ∄
1 \lfloor \rfloor \lceil \rceil
⌊ ⌋ ⌈ ⌉ \lfloor \quad \rfloor \quad \lceil \quad \rceil
⌊ ⌋ ⌈ ⌉
1 \sum \prod \bigcup \bigcap
∑ ∏ ⋃ ⋂ \sum \qquad \prod \qquad \bigcup \qquad \bigcap
∑ ∏ ⋃ ⋂
∫ ∬ ∭ ∮ \int \qquad \iint \qquad \iiint \qquad \oint
∫ ∬ ∭ ∮
1 \partial \nabla \pm \mp \div \circ \bullet \star \dagger
∂ ∇ ± ∓ ÷ ∘ ∙ ⋆ † \partial \qquad \nabla \qquad \pm \qquad \mp \qquad \div \qquad \circ \qquad \bullet \qquad \star \qquad \dagger
∂ ∇ ± ∓ ÷ ∘ ∙ ⋆ †
1 \lim \varliminf \varlimsup \limsup \liminf
lim l i m ‾ l i m ‾ lim sup lim inf \lim \qquad \varliminf \qquad \varlimsup \qquad \limsup \qquad \liminf
lim lim lim lim sup lim inf
max min sup inf \max \qquad \min \qquad \sup \qquad \inf
max min sup inf
1 \bar {x} \tilde {x} \hat {x} \dot {x} \ddot {x}
x ~ x ^ x ˙ x ¨ x ˉ \tilde{x} \qquad \hat{x} \qquad \dot{x} \qquad \ddot{x} \qquad \bar{x}
x ~ x ^ x ˙ x ¨ x ˉ
1 2 3 4 5 6 \begin {array}{ll}rlap: & \xrightarrow {text} right \\ & \rlap {$ \xrightarrow {text}$ } right\\ llap: & left \xleftarrow {text}\\ & left \llap {$ \xleftarrow {text}$ }\\ \end {array}
r l a p : → t e x t r i g h t → t e x t r i g h t l l a p : l e f t ← t e x t l e f t ← t e x t \begin{array}{ll}
rlap: & \xrightarrow{text} right \\
& \rlap{$\xrightarrow{text}$} right\\
llap: & left \xleftarrow{text}\\
& left \llap{$\xleftarrow{text}$}\\
\end{array}
r l a p : ll a p : t e x t r i g h t t e x t r i g h t l e f t t e x t l e f t t e x t
1 \overline {xyz} \underline {xyz} \qquad \overbrace {xyz}^ {over} \underbrace {xyz}_ {under}
x y z ‾ x y z ‾ x y z ⏞ o v e r x y z ⏟ u n d e r \overline{xyz} \qquad \underline{xyz} \qquad \overbrace{xyz}^{over} \qquad \underbrace{xyz}_{under}
x yz x yz x yz o v er u n d er x yz
1 a+\rlap { $ \overbrace {\phantom {b+c+d}}^ {m} $ }b+\underbrace {c+d+e}_ {n}+f
a + b + c + d ⏞ m b + c + d + e ⏟ n + f a+\rlap{ $ \overbrace{\phantom{b+c+d}}^{m} $}b+\underbrace{c+d+e}_{n}+f
a + b + c + d m b + n c + d + e + f
1 \widehat {xyz} \widetilde {xyz} \overleftarrow {xyz} \overrightarrow {xyz} \underrightarrow {xyz} \underleftarrow {xyz}
x y z ^ x y z ~ x y z ← x y z → x y z → x y z ← \widehat{xyz} \qquad \widetilde{xyz} \qquad \overleftarrow{xyz} \qquad \overrightarrow{xyz} \qquad \underrightarrow{xyz} \qquad \underleftarrow{xyz}
x yz x yz x yz x yz x yz x yz
1 2 3 4 5 6 x \xrightarrow [below]{above} y x \xRightarrow [below]{above} y x \xhookrightarrow [below]{above} y x \xrightarrow [below]{above} y x \xrightharpoonup [below]{above} y x \xrightharpoonup [below]{above} y
x → b e l o w a b o v e y x ⇒ b e l o w a b o v e y x ↪ b e l o w a b o v e y x → b e l o w a b o v e y x ⇀ b e l o w a b o v e y x ⇀ b e l o w a b o v e y x \xrightarrow[below]{above} y \quad
x \xRightarrow[below]{above} y \quad
x \xhookrightarrow[below]{above} y \quad
x \xrightarrow[below]{above} y \quad
x \xrightharpoonup[below]{above} y \quad
x \xrightharpoonup[below]{above} y
x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y
1 2 3 4 5 6 x \xleftarrow [below]{above} y x \xLeftarrow [below]{above} y x \xhookleftarrow [below]{above} y x \xleftarrow [below]{above} y x \xleftharpoonup [below]{above} y x \xleftharpoonup [below]{above} y
x ← b e l o w a b o v e y x ⇐ b e l o w a b o v e y x ↩ b e l o w a b o v e y x ← b e l o w a b o v e y x ↼ b e l o w a b o v e y x ↼ b e l o w a b o v e y x \xleftarrow[below]{above} y \quad
x \xLeftarrow[below]{above} y \quad
x \xhookleftarrow[below]{above} y \quad
x \xleftarrow[below]{above} y \quad
x \xleftharpoonup[below]{above} y \quad
x \xleftharpoonup[below]{above} y
x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y
1 2 3 4 5 x \xmapsto [below]{above} y x \xleftrightarrow [below]{above} y x \xLeftrightarrow [below]{above} y x \xrightleftharpoons [below]{above} y x \xleftrightharpoons [below]{above} y
x ↦ b e l o w a b o v e y x ↔ b e l o w a b o v e y x ⇔ b e l o w a b o v e y x ⇌ b e l o w a b o v e y x ⇋ b e l o w a b o v e y x \xmapsto[below]{above} y \quad
x \xleftrightarrow[below]{above} y \quad
x \xLeftrightarrow[below]{above} y \quad
x \xrightleftharpoons[below]{above} y \quad
x \xleftrightharpoons[below]{above} y
x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y x ab o v e b e l o w y
□ ■ \square \qquad \blacksquare
□ ■
1 \frown \smile \overgroup {xyz} \undergroup {xyz}
⌢ ⌣ x y z ⏠ x y z ⏡ \frown \qquad \smile \qquad \overgroup{xyz} \qquad \undergroup{xyz}
⌢ ⌣ x yz x yz
1 \sharp \flat \natural \flat \kern -1.4pt\flat
♯ ♭ ♮ ♭ ♭ \sharp \quad \flat \quad \natural \quad \flat\kern-1.4pt\flat
♯ ♭ ♮ ♭ ♭
1 2 \otimes \oplus \ominus \odot \boxplus \boxminus \boxtimes \boxdot
⊕ ⊖ ⊗ ⊙ ⊞ ⊟ ⊠ ⊡ \oplus \qquad \ominus \qquad \otimes \qquad \odot \\
\boxplus \qquad \boxminus \qquad \boxtimes \qquad \boxdot
⊕ ⊖ ⊗ ⊙ ⊞ ⊟ ⊠ ⊡
1 \heartsuit \spadesuit \lozenge \clubsuit
♡ ♠ ◊ ♣ \heartsuit \qquad \spadesuit \qquad \lozenge \qquad \clubsuit
♡ ♠ ◊ ♣
1 \overset {note}{\rm normal} \overset {?}{=}
n o r m a l n o t e = ? = d e f \overset{note}{\rm normal} \qquad \overset{?}{=} \qquad \overset{def}{=}
normal n o t e = ? = d e f
1 \underset {note}{\rm normal} \underset {\alpha ,\beta }{\arg \min }
n o r m a l n o t e arg min α , β \underset{note}{\rm normal} \qquad \underset{\alpha,\beta}{\arg \min}
n o t e normal α , β arg min
{ [ ( ∫ 0 1 x 2 d x ) ] } ∣ \left.\left\{\left[\left(\int_0^1 x^2 dx \right)\right]\right\}\right|
{ [ ( ∫ 0 1 x 2 d x ) ] }
1 \tbinom {n}{k} {n \choose k} C_ n^ k
( n k ) ( n k ) ( n k ) C n k \binom{n}{k} \quad \tbinom{n}{k} \quad {n \choose k} \quad C_n^k
( k n ) ( k n ) ( k n ) C n k
1 {u \atop v} {a \below b}
u v {u \atop v}
v u
1 \cancel {xyz} \bcancel {xyz} \xcancel {xyz} \sout {xyz}
x y z x y z x y z x y z \cancel{xyz} \quad \bcancel{xyz} \quad \xcancel{xyz} \quad \sout{xyz}
x yz x yz x yz x yz
1 2 \rule [raise-height]{length}{thickness}X\rule [0.2em]{20em}{0.1em}X
X X X\rule[0.2em]{20em}{0.1em}X
X X
X X X\hspace{4cm}X
X X
1 2 \alpha ,\boldsymbol {\alpha }
α , α \alpha,\boldsymbol{\alpha}
α , α
1 2 \usepackage {amssymb} \mathbb {R},\mathbb {Q}
R , Q \mathbb{R},\mathbb{Q}
R , Q
数学公式默认字体中, 数字和中文为罗马体, 英文和希腊字母为意大利斜体
1 2 3 4 5 6 7 0默认字体:数字和中文为\mathrm {},英文和希腊字母为\mathit {} 1正粗体Boldface: \mathbf {...} 2意大利斜体Italic: \mathit {...} 3罗马正体Roma: \mathrm {...} 4德文哥特体Fraktur: \mathfrak {...} 李代数中常用 5花体Calligraphy: \mathcal {...} 6手写体Script: \mathscr {...} 线性变换的符号
0 默认字体 : 123 a b c A B C α β γ 甲乙丙 1 正粗体 : 123 a b c A B C α β γ 甲乙丙 2 意大利斜体 : 123 a b c A B C α β γ 甲乙丙 3 罗马正体 : 123 a b c A B C α β γ 甲乙丙 4 德国哥特体 : 123 a b c A B C α β γ 甲乙丙 5 花体 : 123 a b c A B C α β γ 甲乙丙 6 手写体 : 123 a b c A B C α β γ 甲乙丙 \begin{split}
0默认字体&:123abcABC\alpha\beta\gamma甲乙丙\\
1正粗体&:\mathbf{123abcABC\alpha\beta\gamma甲乙丙}\\
2意大利斜体&:\mathit{123abcABC\alpha\beta\gamma甲乙丙}\\
3罗马正体&:\mathrm{123abcABC\alpha\beta\gamma甲乙丙}\\
4德国哥特体&:\mathfrak{123abcABC\alpha\beta\gamma甲乙丙}\\
5花体&:\mathcal{123abcABC\alpha\beta\gamma甲乙丙}\\
6手写体&:\mathscr{123abcABC\alpha\beta\gamma甲乙丙}
\end{split}
0 默认字体 1 正粗体 2 意大利斜体 3 罗马正体 4 德国哥特体 5 花体 6 手写体 : 123 ab c A BC α β γ 甲乙丙 : 123abcABC α β γ 甲乙丙 : 123abcABC α β γ 甲乙丙 : 123abcABC α β γ 甲乙丙 : 123abcABC α β γ 甲乙丙 : 123 ab c A BC α β γ 甲乙丙 : 123 ab c ABC α β γ 甲乙丙
1 2 3 4 5 6 \usepackage {color}{未标色内容\color {<颜色>}标色内容} \textcolor {<颜色>}{<公式/文本>}\colorbox {<颜色>}{<$ 公式$ /文本>}
e x 的泰勒展开式 : e x = 1 + x + 1 2 x 2 + ⋯ + 1 n ! x n + o ( x n ) {\color{brown} e^x的泰勒展开式:}\quad
\textcolor{green}{e^x}=\textcolor{red}{1} + \textcolor{blue}{x} +\colorbox{yellow}{$\frac{1}{2}x^2$} + \cdots + \colorbox{red}{$\frac{1}{n!}x^n$} + o(x^n)
e x 的泰勒展开式 : e x = 1 + x + 2 1 x 2 + ⋯ + n ! 1 x n + o ( x n )
可以给整个矩阵标色
[ × × × × × × × × × × × × × × × × ] [ × × × × × × × × × × × × × × × × ] \textcolor{red}{
\begin{bmatrix}
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times
\end{bmatrix}
}
\quad
\colorbox{yellow}{$
\begin{bmatrix}
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times
\end{bmatrix}
$}
× × × × × × × × × × × × × × × × × × × × × × × × × × × × × × × ×
black
red
green
blue
white
cyan
magenta
yellow
$$\colorbox{black}{\quad }$$
$$\colorbox{red}{\quad }$$
$$\colorbox{green}{\quad }$$
$$\colorbox{blue}{\quad }$$
$$\fbox{\colorbox{white}{\quad }}$$
$$\colorbox{cyan}{\quad }$$
$$\colorbox{magenta}{\quad }$$
$$\colorbox{yellow}{\quad }$$
xcolor额外补充的一些基本色(这些在markdown的数学语法中都可以使用)
1 2 \usepackage [cmyk]{xcolor}
darkgray
gray
lightgray
brown
olive
orange
$$\colorbox{darkgray}{\quad }$$
$$\colorbox{gray}{\quad }$$
$$\colorbox{lightgray}{\quad }$$
$$\colorbox{brown}{\quad }$$
$$\colorbox{olive}{\quad }$$
$$\colorbox{orange}{\quad }$$
lime
purple
teal
violet
pink
gold
$$\colorbox{lime}{\quad }$$
$$\colorbox{purple}{\quad }$$
$$\colorbox{teal}{\quad }$$
$$\colorbox{violet}{\quad }$$
$$\colorbox{pink}{\quad }$$
$$\colorbox{gold}{\quad }$$
silver
maroon
teal
fuchsia
blueviolet
skyblue
$$\colorbox{silver}{\quad }$$
$$\colorbox{maroon}{\quad }$$
$$\colorbox{teal}{\quad }$$
$$\colorbox{fuchsia}{\quad }$$
$$\colorbox{blueviolet}{\quad }$$
$$\colorbox{skyblue}{\quad }$$
常用 RGB 颜色对照表
\colorbox{darkgray}{$\quad$}
等价无穷小: e x ∼ 1 + x , x → 0 \fbox{等价无穷小: $e^x \sim 1 + x,\quad x \rightarrow 0$}
等价无穷小 : e x ∼ 1 + x , x → 0
可以给矩阵画框
× × × × × × × × × × × × × × × × \fbox{$
\begin{matrix}
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times\\
\times & \times & \times & \times
\end{matrix}
$}
× × × × × × × × × × × × × × × ×
x 00 x 00 + x 01 x 01 x 00 + x 10 x 00 + x 01 + x 10 + x 11 x 01 + x 11 x 10 x 10 + x 11 x 11 \begin{array}{ccc}
x_{00} & \fbox{$\begin{matrix} x_{00}+x_{01} \end{matrix}$} & x_{01}\\
\fbox{$\begin{matrix} x_{00}\\+\\x_{10} \end{matrix}$} &
\fbox{$\begin{matrix} x_{00}+x_{01}\\+\\x_{10}+x_{11} \end{matrix}$} &
\fbox{$\begin{matrix} x_{01}\\+\\x_{11} \end{matrix}$}\\
x_{10} & \fbox{$\begin{matrix} x_{10}+x_{11} \end{matrix}$} & x_{11}\\
\end{array}
x 00 x 00 + x 10 x 10 x 00 + x 01 x 00 + x 01 + x 10 + x 11 x 10 + x 11 x 01 x 01 + x 11 x 11
符号
公式
符号
公式
← \leftarrow ←
\leftarrow或\gets
→ \rightarrow →
\rightarrow或\to
↚ \nleftarrow ↚
\nleftarrow
↛ \nrightarrow ↛
\nrightarrow
⇐ \Leftarrow ⇐
\Leftarrow
⇒ \Rightarrow ⇒
\Rightarrow
⇍ \nLeftarrow ⇍
\nLeftarrow
⇏ \nRightarrow ⇏
\nRightarrow
↔ \leftrightarrow ↔
\leftrightarrow
⇔ \Leftrightarrow ⇔
\Leftrightarrow
↮ \nleftrightarrow ↮
\nleftrightarrow
⇎ \nLeftrightarrow ⇎
\nLeftrightarrow
⟵ \longleftarrow ⟵
\longleftarrow
⟶ \longrightarrow ⟶
\longrightarrow
⟸ \Longleftarrow ⟸
\Longleftarrow
⟹ \Longrightarrow ⟹
\Longrightarrow
↩ \hookleftarrow ↩
\hookleftarrow
↪ \hookrightarrow ↪
\hookrightarrow
↼ \leftharpoonup ↼
\leftharpoonup
⇀ \rightharpoonup ⇀
\rightharpoonup
↽ \leftharpoondown ↽
\leftharpoondown
⇁ \rightharpoondown ⇁
\rightharpoondown
⇋ \leftrightharpoons ⇋
\leftrightharpoons
⇌ \rightleftharpoons ⇌
\rightleftharpoons
↫ \looparrowleft ↫
\looparrowleft
↬ \looparrowright ↬
\looparrowright
↞ \twoheadleftarrow ↞
\twoheadleftarrow
↠ \twoheadrightarrow ↠
\twoheadleftarrow
↢ \leftarrowtail ↢
\leftarrowtail
↣ \rightarrowtail ↣
\rightarrowtail
⇇ \leftleftarrows ⇇
\leftleftarrows
⇉ \rightrightarrows ⇉
\rightrightarrows
⇆ \leftrightarrows ⇆
\leftrightarrows
⇄ \rightleftarrows ⇄
\rightleftarrows
⇈ \upuparrows ⇈
\upuparrows
⇊ \downdownarrows ⇊
\downdownarrows
⇠ \dashleftarrow ⇠
\dashleftarrow
⇢ \dashrightarrow ⇢
\dashrightarrow
↶ \curvearrowleft ↶
\curvearrowleft
↷ \curvearrowright ↷
\curvearrowright
↭ \leftrightsquigarrow ↭
\leftrightsquigarrow
⇝ \rightsquigarrow ⇝
\rightsquigarrow
⟷ \longleftrightarrow ⟷
\longleftrightarrow
⟺ \Longleftrightarrow ⟺
\Longleftrightarrow
↑ \uparrow ↑
\uparrow
↓ \downarrow ↓
\downarrow
⇑ \Uparrow ⇑
\Uparrow
⇓ \Downarrow ⇓
\Downarrow
↕ \updownarrow ↕
\updownarrow
⇕ \Updownarrow ⇕
\Updownarrow
↖ \nwarrow ↖
\nwarrow
↗ \nearrow ↗
\nearrow
↙ \swarrow ↙
\swarrow
↘ \searrow ↘
\searrow
↰ \Lsh ↰
\Lsh
↱ \Rsh ↱
\Rsh
↦ \mapsto ↦
\mapsto
⟼ \longmapsto ⟼
\longmapsto
⊸ \multimap ⊸
\multimap
LaTeX数学公式----矩阵
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 $ $ \begin {matrix} 0 & 1 \\ 1 & 0 \end {matrix},\begin {pmatrix} 0 & 1 \\ 1 & 0 \end {pmatrix},\begin {bmatrix} 0 & 1 \\ 1 & 0 \end {bmatrix},\begin {Bmatrix} 0 & 1 \\ 1 & 0 \end {Bmatrix},\begin {vmatrix} 0 & 1 \\ 1 & 0 \end {vmatrix},\begin {Vmatrix} 0 & 1 \\ 1 & 0 \end {Vmatrix}$ $
0 1 1 0 , ( 0 1 1 0 ) , [ 0 1 1 0 ] , { 0 1 1 0 } , ∣ 0 1 1 0 ∣ , ∥ 0 1 1 0 ∥ \begin{matrix}
0 & 1 \\
1 & 0
\end{matrix},
\begin{pmatrix}
0 & 1 \\
1 & 0
\end{pmatrix},
\begin{bmatrix}
0 & 1 \\
1 & 0
\end{bmatrix},
\begin{Bmatrix}
0 & 1 \\
1 & 0
\end{Bmatrix},
\begin{vmatrix}
0 & 1 \\
1 & 0
\end{vmatrix},
\begin{Vmatrix}
0 & 1 \\
1 & 0
\end{Vmatrix}
0 1 1 0 , ( 0 1 1 0 ) , [ 0 1 1 0 ] , { 0 1 1 0 } , 0 1 1 0 , 0 1 1 0
1 2 3 4 5 6 \dots \cdots \vdots \ddots \iddots \newcommand \iddots {\mathinner { \kern 1mu\raise 1pt{.} \kern 2mu\raise 4pt{.} \kern 2mu\raise 7pt{\Rule {0pt}{7pt}{0pt}.} \kern 1mu}}
… ⋯ ⋮ ⋱ \dots \qquad \cdots \qquad \vdots \qquad \ddots \qquad
… ⋯ ⋮ ⋱
\newcommand\iddots{\mathinner{\kern1mu\raise1pt{.} \kern2mu\raise4pt{.} \kern2mu\raise7pt{\Rule{0pt}{7pt}{0pt}.} \kern1mu}}
\iddots
1 2 3 4 5 6 7 8 $ $ \begin {pmatrix}a_ {11} & a_ {12} & \cdots & a_ {1n} \\ \hdotsfor {4} \\ a_ {n1} & a_ {n2} & \cdots & a_ {nn} \end {pmatrix}$ $
1 2 3 4 5 6 7 8 9 $ $ \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}$ $
1 2 3 4 5 6 \left ( \begin {smallmatrix}x & -y \\ y & x \end {smallmatrix}\right )
例如矩阵( x − y y x ) \left(
\begin{smallmatrix}
x & -y \\ y & x
\end{smallmatrix}
\right) ( x y − y x ) 是排版在行内的
array环境可以对矩阵的元素进行居左|居中|居右的排版
1 2 3 4 5 6 7 $ $ \begin {array}{c|c|c} x & 0 & 1 \\ \hline p(x) & \frac {1}{4} & \frac {3}{4} \end {array}$ $
x 0 1 p ( x ) 1 4 3 4 \begin{array}{c|c|c}
x & 0 & 1 \\
\hline
p(x) & \frac{1}{4} & \frac{3}{4}
\end{array}
x p ( x ) 0 4 1 1 4 3
半音阶口琴音阶图
1 2 3 4 5 6 7 \begin {array}{|c|cccccccccccccccc|}\hline Blow & C & E & G & C & C & E & G & C & C & E & G & C & C & E & G & C\\ \hline Draw & D & F & A & B & D & F & A & B & D & F & A & B & D & F & A & B\\ \hline \end {array}
B l o w C E G C C E G C C E G C C E G C D r a w D F A B D F A B D F A B D F A B \begin{array}{|c|cccccccccccccccc|}
\hline
Blow & C & E & G & C & C & E & G & C & C & E & G & C & C & E & G & C\\
\hline
Draw & D & F & A & B & D & F & A & B & D & F & A & B & D & F & A & B\\
\hline
\end{array}
Bl o w Dr a w C D E F G A C B C D E F G A C B C D E F G A C B C D E F G A C B
1 2 3 4 5 6 \begin {array}{|c|c|c|c|c|c|c|c|}\rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{} & \rule {1cm}{}\end {array}\\ \rule {11cm}{}
\begin{array}{|c|c|c|c|c|c|c|c|}
\rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{} & \rule{1cm}{}
\end{array}
\\
\rule{11cm}{}
一个短线段为 1 c m 1cm 1 c m ,长线段为 11 c m 11cm 11 c m ,array 环境下 8 8 8 个短线段的长度等于 11 c m 11cm 11 c m ,计算出 ( 11 − 8 ) / 8 = 0.375 c m (11-8)/8=0.375cm ( 11 − 8 ) /8 = 0.375 c m ,即 array 环境每个单元格的宽度为 0.375 c m 0.375cm 0.375 c m
1 2 3 4 5 6 7 8 9 10 \left (\begin {array}{cc|cc}a_ {11} & a_ {12} & b_ {11} & b_ {12}\\ a_ {21} & a_ {22} & b_ {21} & b_ {22}\\ \hline & & c_ {11} & c_ {12}\\ & & c_ {21} & c_ {22} \end {array}\right )
( a 11 a 12 b 11 b 12 a 21 a 22 b 21 b 22 c 11 c 12 c 21 c 22 ) %第一行第一列: 大复合矩阵
\left(
\begin{array}{cc|cc}
a_{11} & a_{12} & b_{11} & b_{12}\\
a_{21} & a_{22} & b_{21} & b_{22}\\
\hline
& & c_{11} & c_{12}\\
& & c_{21} & c_{22}
\end{array}
\right)
a 11 a 21 a 12 a 22 b 11 b 21 c 11 c 21 b 12 b 22 c 12 c 22
1 2 3 4 5 \begin {array}{l}\left . \rule {0mm}{7mm} \right \} p \\ \left . \rule {0mm}{7mm} \right \} q\end {array}
} p } q %第一行第二列: 右侧大括号
\begin{array}{l}
\left. \rule{0mm}{7mm} \right\}p \\
\left. \rule{0mm}{7mm} \right\}q
\end{array}
⎭ ⎬ ⎫ p ⎭ ⎬ ⎫ q
1 2 3 4 5 \begin {array}{cc}\underbrace {\rule {17mm}{0mm}}_ m & \underbrace {\rule {17mm}{0mm}}_ m\end {array}
⏟ m ⏟ m %第二行第一列: 下侧大括号
\begin{array}{cc}
\underbrace{\rule{17mm}{0mm}}_m &
\underbrace{\rule{17mm}{0mm}}_m
\end{array}
m m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 $ $ \begin {array}{c@{\hspace {-5pt}}l}\left (\begin {array}{cc|cc}a_ {11} & a_ {12} & b_ {11} & b_ {12}\\ a_ {21} & a_ {22} & b_ {21} & b_ {22}\\ \hline & & c_ {11} & c_ {12}\\ & & c_ {21} & c_ {22} \end {array}\right )& \begin {array}{l}\left . \rule {0mm}{7mm} \right \} p \\ \left . \rule {0mm}{7mm} \right \} q\end {array}\\ \begin {array}{cc}\underbrace {\rule {17mm}{0mm}}_ m & \underbrace {\rule {17mm}{0mm}}_ m\end {array}& \end {array}$ $
( a 11 a 12 b 11 b 12 a 21 a 22 b 21 b 22 c 11 c 12 c 21 c 22 ) } p } q ⏟ m ⏟ m \begin{array}{cl}
%第一行第一列: 大复合矩阵
\left(
\begin{array}{cc|cc}
a_{11} & a_{12} & b_{11} & b_{12}\\
a_{21} & a_{22} & b_{21} & b_{22}\\
\hline
& & c_{11} & c_{12}\\
& & c_{21} & c_{22}
\end{array}
\right)
& %&符号连接行间元素
%第一行第二列: 右侧大括号
\begin{array}{l}
\left. \rule{0mm}{7mm} \right\}p \\
\left. \rule{0mm}{7mm} \right\}q
\end{array}
\\ %第一行结束
%第二行第一列: 下侧大括号
\begin{array}{cc}
\underbrace{\rule{17mm}{0mm}}_m &
\underbrace{\rule{17mm}{0mm}}_m
\end{array}
&
%第二行第二列: 空
\end{array}
a 11 a 21 a 12 a 22 b 11 b 21 c 11 c 21 b 12 b 22 c 12 c 22 m m ⎭ ⎬ ⎫ p ⎭ ⎬ ⎫ q
1 2 3 4 5 6 7 \begin {bmatrix}0 & 1/3 & 0 & \cdots & 0 \\ 2/3 & 0 & 1/3 & \cdots & 0 \\ 0 & 2/3 & 0 & \ddots & 0 \\ \vdots & \vdots & \ddots & \ddots & 1/3 \\ 0 & 0 & 0 & 2/3 & 0 \end {bmatrix}
[ 0 1 / 3 0 ⋯ 0 2 / 3 0 1 / 3 ⋯ 0 0 2 / 3 0 ⋱ 0 ⋮ ⋮ ⋱ ⋱ 1 / 3 0 0 0 2 / 3 0 ] \begin{bmatrix}
0 & 1/3 & 0 & \cdots & 0 \\
2/3 & 0 & 1/3 & \cdots & 0 \\
0 & 2/3 & 0 & \ddots & 0 \\
\vdots & \vdots & \ddots & \ddots & 1/3 \\
0 & 0 & 0 & 2/3 & 0
\end{bmatrix}
0 2/3 0 ⋮ 0 1/3 0 2/3 ⋮ 0 0 1/3 0 ⋱ 0 ⋯ ⋯ ⋱ ⋱ 2/3 0 0 0 1/3 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 \begin {array}{cl} & \begin {matrix}-1 & -2 & -3 & \cdots \end {matrix}\\ \begin {matrix}-1 \\ -2 \\ -3 \\ \vdots \end {matrix}& \begin {bmatrix}0 & 1/3 & 0 & \cdots \\ 2/3 & 0 & 1/3 & \cdots \\ 0 & 2/3 & 0 & \ddots \\ \vdots & \vdots & \ddots & \ddots \end {bmatrix}\end {array}
− 1 − 2 − 3 ⋯ − 1 − 2 − 3 ⋮ [ 0 1 / 3 0 ⋯ 2 / 3 0 1 / 3 ⋯ 0 2 / 3 0 ⋱ ⋮ ⋮ ⋱ ⋱ ] \begin{array}{cl}
&
\begin{matrix}
-1 & -2 & -3 & \cdots
\end{matrix}
\\
\begin{matrix}
-1 \\ -2 \\ -3 \\ \vdots
\end{matrix}
&
\begin{bmatrix}
0 & 1/3 & 0 & \cdots \\
2/3 & 0 & 1/3 & \cdots \\
0 & 2/3 & 0 & \ddots \\
\vdots & \vdots & \ddots & \ddots
\end{bmatrix}
\end{array}
− 1 − 2 − 3 ⋮ − 1 − 2 − 3 ⋯ 0 2/3 0 ⋮ 1/3 0 2/3 ⋮ 0 1/3 0 ⋱ ⋯ ⋯ ⋱ ⋱
LaTeX数学公式的多行公式
1 2 \usepackage {amsmath}\usepackage {amssymb}
gather环境默认多行公式居中对其(markdown中使用该环境可以居中对其多行公式)
1 2 3 4 \begin {gather} a + b = b + a \\ a \cdot b = b \cdot a \notag \end {gather}
a + b = b + a a ⋅ b = b ⋅ a \begin{gather}
a + b = b + a \\
a \cdot b = b \cdot a
\end{gather}
a + b = b + a a ⋅ b = b ⋅ a
align和align*环境按指定位置对齐
align和align* 按照 & 符号对内容进行右左右左右…交替对齐
1 2 3 4 \begin {align}x & = t + \cos (t) + 1 \\ y & = 2\sin (t) \end {align}
x = t + cos ( t ) + 1 y = 2 sin ( t ) \begin{align}
x &= t + \cos(t) + 1 \\
y &= 2\sin(t)
\end{align}
x y = t + cos ( t ) + 1 = 2 sin ( t )
1 2 3 4 \begin {align*}x & = t & x & = \cos (t) & x & = t \\ y & = 2t & y & = \sin (t+1) & y & = \sin (t) \end {align*}
x = t x = cos ( t ) x = t y = 2 t y = sin ( t + 1 ) y = sin ( t ) \begin{align*}
x &= t & x &= \cos(t) & x &= t \\
y &= 2t & y &= \sin(t+1) & y &= \sin(t)
\end{align*}
x y = t = 2 t x y = cos ( t ) = sin ( t + 1 ) x y = t = sin ( t )
上面 align* 实现的效果可以用 array 环境来实现
1 2 3 4 \begin {array}{rlrlrl}x & = t & x & = \cos (t) & x & = t \\ y & = 2t & y & = \sin (t+1) & y & = \sin (t) \end {array}
x = t x = cos ( t ) x = t y = 2 t y = sin ( t + 1 ) y = sin ( t ) \begin{array}{rlrlrl}
x &= t & x &= \cos(t) & x &= t \\
y &= 2t & y &= \sin(t+1) & y &= \sin(t)
\end{array}
x y = t = 2 t x y = cos ( t ) = sin ( t + 1 ) x y = t = sin ( t )
1 2 3 4 5 \begin {aligned}x |& = xyz\\ xy |& = xy\\ xyz |& = x \end {aligned}
x ∣ = x y z x y ∣ = x y x y z ∣ = x \begin{aligned}
x |&= xyz\\
xy |&= xy\\
xyz |&= x
\end{aligned}
x ∣ x y ∣ x yz ∣ = x yz = x y = x
split环境可以通过&
符号来自定义公式的对齐
注意split
环境本身不能单独使用, 需要放在equation
环境中才能使用
注意不能放在$$...$$
中, 会出问题.
1 2 3 4 5 6 \begin {equation}\begin {split}\cos 2x & = \cos ^ 2 x - \sin ^ 2 x \\ & = 2\cos ^ 2 x -1 \end {split}\end {equation}
cos 2 x = cos 2 x − sin 2 x = 2 cos 2 x − 1 \begin{split}
\cos 2x &= \cos^2 x - \sin^2 x \\
&= 2\cos^2 x -1
\end{split}
cos 2 x = cos 2 x − sin 2 x = 2 cos 2 x − 1
注意 split 环境只能使用一个 & 符号进行对齐, 当尝试像 align 环境那样多列对齐时会报错
\begin{split}
x &= t & x &= \cos(t) & x &= t \\
y &= 2t & y &= \sin(t+1) & y &= \sin(t)
\end{split}
1 2 3 4 5 6 7 \begin {equation}D(x) = \begin {cases} 1, & \text {如果} x \in \mathbb {Q}; \\ 0, & \text {如果} x \in \mathbb {R}\setminus \mathbb {Q}. \end {cases}\end {equation}
D ( x ) = { 1 , 如果 x ∈ Q ; 0 , 如果 x ∈ R ∖ Q . \begin{equation}
D(x) = \begin{cases}
1, & \text{如果} x \in \mathbb{Q}; \\
0, & \text{如果} x \in \mathbb{R}\setminus\mathbb{Q}.
\end{cases}
\end{equation}
D ( x ) = { 1 , 0 , 如果 x ∈ Q ; 如果 x ∈ R ∖ Q .
1 2 3 4 5 6 \usepackage {amsthm} \newtheorem {定理环境名}{标题}[主计数器]
1 2 3 4 5 \newtheorem {theorem}{定理}[section]\begin {theorem}\label {...} ... \end {theorem}
1 2 3 4 5 6 7 8 \begin {proof}[证明:] ... \end {proof}\renewcommand *{\qedsymbol }{[证毕]}
1 2 3 4 5 \usepackage {ntheorem}\theoremseparator {分隔符}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \usepackage {ntheorem}\theoremseparator {***} \newtheorem {theorem}{定理}[section]\begin {document} \begin {theorem} belabela的一个定理 \end {theorem} \end {document}
LaTeX中的参考文献BibTex
1 2 3 4 5 6 7 8 \begin {thebibliography}{9} \bibitem [记号]{引用标志} 文献条目1 \bibitem [记号]{引用标志} 文献条目2 ... \end {thebibliography}
1 2 3 4 \begin {thebibliography}{9} \bibitem {3-1} 王玉杰. 自动指纹分类算法的研究[D].南京邮电大学,2012. \bibitem {3-2} 杨利敏,杨杰,李钢.基于指纹分类的模式匹配[J].电子学报,2003(07):1030-1034. \end {thebibliography}
Latex中thebibliography后面的数字代表的是\bibitem标签的最大宽度
标签宽度其实就是数字位数,比如1,21,123,分别是1, 2, 3个宽度
如果参考文献数量在1-9,后面的数字可以用, 1,2,3,····,9,a,b,····都可以
如果参考文献数量在10-99,后面的数字可以用,10, 21, 33,····,19,ab,bc,b0····都可以
以此类推
1 2 3 4 5 6 7 \cite {引用标志1,引用标志2}\newcommand {\upcite }[1]{\textsuperscript {\cite {#1 }}}\upcite {引用标志}
1 2 3 4 5 6 \usepackage [option]{natbib}\usepackage [numbers,sort& compress]{natbib}\usepackage [numbers,sort& compress,super,square]{natbib}
option
功能
round
(default) 使用圆括号
square
使用方括号
curly
使用花括号
angle
使用尖括号
colon
(default) 用引号分隔多个引用
comma
用逗号分隔多个引用
authoryear
(default) 使用作者–年引用形式
numbers
使用编号引用形式
super
使用 Nature 那样的上标编号引用
sort
多个引用按照首字母排序
sort&compress
除排序外,多个引用可以合并 (如 3-6, 15)
longnamesfirst
多个作者的文献第一次被引用时列出所有作者,以后的引用可以缩写为 et al.
sectionbib
重定义了 \thebibliography 使用 \section* 而不是 \chapter*。这样使用 chapterbib 宏包时,参考文献名称为 section 一级
nonamebreak
在一行排版所有作者名字,这可能引起 overfull hbox 警告但是消除了跨行的 hyperref 问题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 \usepackage {hyperref}\hypersetup { colorlinks=true, linkcolor=cyan, filecolor=blue, urlcolor=red, citecolor=blue, } \usepackage [colorlinks=true, citecolor=blue, ]{hyperref}
使用BibTeX之前需要先在设置-构建中修改默认文献工具为BibTeX
新建.bib文件, 在.bib文件中记录参考文献信息
LaTeX中的自定义命令和环境
1 \newcommand <命令名称>[<参数个数>][<首参数默认值>]{<具体定义>}
1 2 3 \newcommand \PRC {People's Republic of \emph {China}}
1 2 3 4 \newcommand \loves [2]{#1 喜欢 #2 }\loves {我}{你}
我喜欢你 \newcommand \loves[2]{ #1 喜欢 #2 }
\loves{我}{你}
我喜欢你
1 2 3 4 5 6 \newcommand \loves [2][我]{#1 喜欢 #2 }\loves {你} \qquad \loves [他]{你}
我 ] \newcommand \loves[2][我] 我 ]