Chapter 3 Mathematics in LaTeX (Markdown)
Inline formulas use $...$
Displayed formulas use $$...$$
https://www.jianshu.com/p/a0aa94ef8ab2
https://www.overleaf.com/learn/latex/Matrices
https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
3.1 Greek Letters
Letter | Command | Letter | Command |
---|---|---|---|
\(\alpha\) | \alpha |
\(\beta\) | \beta |
\(\gamma\) | \gamma |
\(\delta\) | \delta |
\(\epsilon\) | \epsilon |
\(\zeta\) | \zeta |
\(\eta\) | \eta |
\(\theta\) | \theta |
\(\iota\) | \iota |
\(\kappa\) | \kappa |
\(\lambda\) | \lambda |
\(\mu\) | \mu |
\(\nu\) | \nu |
\(\xi\) | \xi |
\(\pi\) | \pi |
\(\rho\) | \rho |
\(\sigma\) | \sigma |
\(\tau\) | \tau |
\(\upsilon\) | \upsilon |
\(\phi\) | \phi |
\(\chi\) | \chi |
\(\psi\) | \psi |
\(\omega\) | \omega |
For uppercase letters, use \Alpha
, \Beta
, …, \Gamma
.
3.2 Superscripts and Subscripts
Superscripts use ^
Subscripts use _
x_1^3
: \(x_1^3\)
log_2 8 = 3
: \(log_2 8 = 3\)
3.3 Group
A “group” is any formula surrounded by braces {…}
.
10^10
: \(10^10\) (not wanted)
10^{10}
: \(10^{10}\)
x_i^2
: \(x_i^2\)
x_{i^2}
: \(x_{i^2}\)
{x_i}^2
: \({x_i}^2\)
3.4 Parentheses, Brackets, and Braces
Parentheses use ()
Brackets use []
Braces use \{
and \}
These do not scale with the formula in between.
(\frac{\sqrt x}{y^3})
: \((\frac{\sqrt x}{y^3})\)
Using \left(
and \right)
will make the sizes adjust automatically to the formula they enclose.
\left(\frac{\sqrt x}{y^3}\right)
: \(\left(\frac{\sqrt x}{y^3}\right)\)
There are also invisible parentheses, denoted by .
.
\left.x^2\right\rvert_3^5 = 5^2-3^2
: \(\left.x^2\right\rvert_3^5 = 5^2-3^2\)
3.5 Sums and Integrals
Sums use: \sum
Integrals use: \int
\sum_1^n
: \(\sum_1^n\)
\sum_{i=0}^\infty i^2
: \(\sum_{i=0}^\infty i^2\)
\int_a^b f(x) \ dx
: \(\int_a^b f(x) \ dx\)
Similarly,
\prod
: \(\prod\)
\bigcup
: \(\bigcup\)
\bigcap
: \(\bigcap\)
\iint
: \(\iint\)
\iiint
: \(\iiint\)
\idotsint
: \(\idotsint\)
3.8 Special Functions
\sin x
: \(\sin x\)
\ln x
: \(\ln x\)
\max(A,B,C)
: \(\max(A,B,C)\)
\lim\limits_{x \to \infty}
: \(\lim\limits_{x \to \infty}\)
3.9 Special Symbols
Symbol | Command | Symbol | Command |
---|---|---|---|
\(\lt\) | \lt |
\(\gt\) | \gt |
\(\le\) | \le |
\(\ge\) | \ge |
\(\neq\) | \neq |
\(\times\) | \times |
\(\div\) | \div |
\(\pm\) | \pm |
\(\mp\) | \mp |
\(\dots\) | \dots |
\(\cap\) | \cap |
\(\cup\) | \cup |
\(\subset\) | \subset |
\(\supset\) | \supset |
\(\subseteq\) | \subseteq |
\(\supseteq\) | \supseteq |
\(\subsetneq\) | \supsetneq |
\(\supsetneq\) | \supsetneq |
\(\emptyset\) | \emptyset |
\(\varnothing\) | \varnothing |
\(\in\) | \in |
\(\notin\) | \notin |
\(\to\) | \to |
\(\gets\) | \gets |
\(\land\) | \land |
\(\lor\) | \lor |
\(\exists\) | \exists |
\(\forall\) | \forall |
\(\bot\) | \bot |
\(\top\) | \top |
\(\vdash\) | \vdash |
\(\vDash\) | \vDash |
\(\infty\) | \infty |
\(\approx\) | \approx |
3.10 Accents and Diacritical Marks
\hat x
: \(\hat x\)
\widehat {xy}
: \(\widehat {xy}\)
\bar x
: \(\bar x\)
\overline {xyz}
: \(\overline {xyz}\)
\vec x
: \(\vec x\)
\overrightarrow {xy}
: \(\overrightarrow {xy}\)
\overleftrightarrow {xy}
: \(\overleftrightarrow {xy}\)
3.11 Matrix
A plain matrix block begins with \begin{matrix}
and ends with \end{matrix}
.
&
uses for columns.
\\
uses for rows.
For example,
$$\begin{matrix}
1&0&0\\
0&1&0\\
0&0&1
\end{matrix}$$
\[\begin{matrix} 1&0&0\\ 0&1&0\\ 0&0&1 \end{matrix}\]
3.11.1 Matrix with Delimiters
Parentheses:
\begin{pmatrix}
1 & 2 & 3\\
a & b & c
\end{pmatrix}
\[\begin{pmatrix} 1 & 2 & 3\\ a & b & c \end{pmatrix}\]
Brackets:
\begin{bmatrix}
1 & 2 & 3\\
a & b & c
\end{bmatrix}
\[\begin{bmatrix} 1 & 2 & 3\\ a & b & c \end{bmatrix}\]
Braces:
\begin{Bmatrix}
1 & 2 & 3\\
a & b & c
\end{Bmatrix}
\[\begin{Bmatrix} 1 & 2 & 3\\ a & b & c \end{Bmatrix}\]
Pipes:
\begin{vmatrix}
1 & 2 & 3\\
a & b & c
\end{vmatrix}
\[\begin{vmatrix} 1 & 2 & 3\\ a & b & c \end{vmatrix}\]
Double pipes:
\begin{Vmatrix}
1 & 2 & 3\\
a & b & c
\end{Vmatrix}
\[\begin{Vmatrix} 1 & 2 & 3\\ a & b & c \end{Vmatrix}\]
3.11.2 Dots
\cdots
: \(\cdots\)
\vdots
: \(\vdots\)
\ddots
: \(\ddots\)
For example,
$$\begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}
\end{bmatrix}$$
\[\begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}} \end{bmatrix}\]
3.11.3 Array
left-align: l
center-align: c
right-align: r
vertical line: |
horizontal line: \hline
For example,
$$\begin{array}{c|lll}
{↓}&{a}&{b}&{c}\\
\hline
{R_1}&{c}&{b}&{a}\\
{R_2}&{b}&{c}&{c}
\end{array}$$
\[\begin{array}{c|lll} {↓}&{a}&{b}&{c}\\ \hline {R_1}&{c}&{b}&{a}\\ {R_2}&{b}&{c}&{c}\\ \end{array}\]