This is a sample sentence % this is a comment, this line will not be rendered!
This is another sample sentence % this is comment in a same sentence
This is a sample sentence
This is another sample sentence
数学模式
单纯的文字只会被正常渲染,若想要使用数学符号或者公式就得加上 $ 符号,以进入数学模式
Inline math mode(行内数学模式)
1
Let $A$ be some element in the set of $\mathcal{M}_{\mathbf{n} \times\mathbf{n}}(\mathbb{F})$
Let A be some element in the set of Mn×n(F)
双 $ 会强制把内容渲染为 Display math mode,也就是说会开启一个区域进行展示
1
Test $$A = B + C$$ test
Test
A=B+C
test
若想在数学模式区域写正常文字,空格会被忽略
1
$$The space will be ignored$$
Thespacewillbeignored
在数学区域使用 \text{} 指令即可正常展示文字
1
$$\text{Now text with space will render normally!}$$
Now text with space will render normally in math mode!
字体
1 2 3 4 5 6 7
\mathbf{bold} % or \textbf{bold}
\mathit{italic} % or \textit{italic}
\underline{underline}
bold
italic
underline
1 2 3 4 5
\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
列表
无序列表
1 2 3 4
\begin{itemize} \item This is one entry \item This is another entry \end{itemize}
This is one entry
This is another entry
注意,这里的缩进非必要,和众多编程语言一样(Python 除外),缩进并不会影响 LaTeX 渲染
有序列表
1 2 3 4
\begin{enumerate} \item This is the first entry \item This is the second entry \end{enumerate}
This is the first entry
This is the second entry
有序列表可以使用 \setcounter{enumi}{x} 来控制计数器
基于有序列表可以叠加的机制,\setcounter{enumi} 命令中的 i 的数量是指控制的层数
1 2 3 4 5 6 7 8 9
\begin{enumerate} \item This is the first item \begin{enumerate} \setcounter{enumii}{2} \item This should show item (c)! \end{enumerate} \setcounter{enumi}{5} \item this is the 6th item \end{enumerate}
This is the first item
c. This should show item c!
this is the 6th item
注意,enumerate 会用 1, a, i 以此类推来进行不同层级的计数,而并非全用数字
一些例子
Theorem.If n is an integer and n2 is even, then n is itself even.
Proof. Contrapositives are for cowards, so assume that n is an integer and n2 is even. Then n2=2k for some integer k, and thus n2−2k=0. Behold:
n=n+(n2−2k)=n(n+1)−2k
Both n(n+1) and 2k are even, so n is even too.
1 2 3 4 5 6 7 8 9
\begin{proof} Contrapositives are for cowards, so assume that $n$ is an integer and $n^2$ is even. Then $n^2 = 2k$ for some integer $k$, and thus $n^2 - 2k = 0$. Behold:
$$ n = n + (n^2 - 2k) = n (n + 1) - 2k $$
Both $n(n + 1)$ and $2k$ are even, so $n$ is even too. \end{proof}
个人语法收藏
基本数学
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
\sqrt{x}
\ln(x)
\sin(x) % 三角函数
x^n % superscript
x^{123} % 若 superscript 多于一个字符,就需要加上 `{}`
x_a % subscript
x_{abc} % subscript 同理
x^{abc}_{ijk} % 混用
\infty
x
ln(x)
sin(x)
xn
x123
xa
xabc
xijkabc
∞
分数
1 2 3
\frac{a}{b} % inline
\dfrac{a}{b} % dispaly
This is inline fraction ba
This is also inline but force into display mode ba