132 lines
3.9 KiB
TeX
132 lines
3.9 KiB
TeX
\section{Math}
|
|
|
|
\subsection{Equation}
|
|
|
|
This is an equation
|
|
|
|
\begin{equation}
|
|
% A lonesome ( will have a fixed size
|
|
% But a \left( will be scaled to contain whatever it has to
|
|
\langle f, g \rangle_{\left[a, b\right]}
|
|
=
|
|
\int_a^b f(x)\overline{g(x)} dx
|
|
% \\ % The equation env ignores \\
|
|
% a^2 + b^2 = c^2
|
|
\label{eq:inner_product} % You may label equations for referencing later
|
|
\end{equation}
|
|
|
|
\subsection{Gather}
|
|
|
|
This is the gather environment
|
|
|
|
\begin{gather*}
|
|
E = mc^2
|
|
\\
|
|
E^2 =
|
|
\frac{ % You
|
|
mc^2 % May
|
|
} % Use
|
|
{ % As
|
|
\sqrt{ % Many
|
|
1 % Lines
|
|
- % As
|
|
\frac{ % You
|
|
v^2 % Want
|
|
}
|
|
{ % Sometimes
|
|
c^2 % It makes
|
|
} % Things more
|
|
} % Structured
|
|
} % ...though not always...
|
|
\end{gather*}
|
|
|
|
\subsection{Align}
|
|
|
|
This is an \emph{anonymous} align environment
|
|
|
|
\begin{align*}
|
|
24 &= 8 \cdot 3 \\ % Allows aligning glyphs by using &
|
|
&= 4 \cdot 6 \\ % The glyph marked with & on each line
|
|
&= 2 \cdot 2 \cdot 2 \cdot 3 % Will be aligned
|
|
\end{align*}
|
|
|
|
\subsection{Inlined math}
|
|
|
|
% Math can be inlined with \( ..my math.. \) or $..also my math..$
|
|
% $_$ is the old TeX way and is not advisable to use
|
|
% \(_\) is the more modern LaTeX way and is more robust
|
|
A \(\sum_n^k\) sum! And a $\frac{1}{n}$.
|
|
|
|
% The \[\] is a \displaystyle math environment
|
|
% There is no real reason to use it over the \begin syntax, but it's there. This env is displayed on its own line and is not a part of the paragraph in the same way $_$ and \(\) are.
|
|
You can also: \[\alpha\] do this.
|
|
|
|
\subsection{Some symbols}
|
|
|
|
Greek
|
|
|
|
\begin{gather*}
|
|
\psi,\ \Psi % The "\ " thing forces the insert of a space, otherwise whitespace is ignored
|
|
\\
|
|
\alpha, \beta, \gamma, \delta % Lower case with _small_ letters
|
|
\\
|
|
\Gamma, \Delta % Upper case with _Capital_ letter
|
|
\\
|
|
\epsilon, \varepsilon % Variants with _var_
|
|
\end{gather*}
|
|
|
|
Other things
|
|
|
|
% If you want a glyph, but don't know what it's called
|
|
% Either try something (most glyphs have sensible names)
|
|
% Or just search it up online, after a while you'll remember
|
|
\begin{gather*}
|
|
\nabla, \partial
|
|
\\
|
|
\int, \iint, \oint
|
|
\\
|
|
\sum_{i = 1}^{n}, \prod_{1 \leq i \leq n}
|
|
\\
|
|
\frac{a + ib}{c + id}, i = 1, \dots, n
|
|
\\
|
|
\bar{x}, \vec{x}, x^\circ
|
|
\end{gather*}
|
|
|
|
Matrices (and vectors)
|
|
|
|
\begin{gather*}
|
|
\begin{pmatrix} % Parantheses
|
|
1 & 2 & 3 \\ % Columns separated with &
|
|
4 & 5 & 6 \\ % Rows separated with \\
|
|
7 & 8 & 9
|
|
\end{pmatrix}
|
|
,
|
|
\begin{bmatrix} % Brackets
|
|
1 & 2 & 3 \\
|
|
4 & 5 & 6 \\
|
|
7 & 8 & 9
|
|
\end{bmatrix}
|
|
,
|
|
\begin{Bmatrix} % _Curly_ brackets
|
|
1 & 2 & \\ % You can leave elements empty
|
|
4 & \displaystyle\int_0^1x^2 dx & 6 \\ % You can make the elements complicated (and force roomy display with \displaystyle
|
|
7 & 8 & 9
|
|
\end{Bmatrix}
|
|
,
|
|
\begin{pmatrix} % Essentially a vector
|
|
x_1 \\ x_2 \\ x_3 % Just because \\ causes linebreak, doesn't mean you need a new line in the source
|
|
\end{pmatrix}
|
|
\end{gather*}
|
|
|
|
% Defining a new command, don't do it here, do it in the preamble or something similar
|
|
% newcommand takes a command name, a number of arguments and the "function body" of the command. The arguments to the new command being defined can be accessed by #<number>
|
|
\newcommand{\myvec}[1]{
|
|
\begin{pmatrix}
|
|
#1
|
|
\end{pmatrix}
|
|
}
|
|
|
|
% Works like a charm
|
|
\begin{gather*}
|
|
\myvec{x_1\\x_2\\x_3} \leftarrow \text{My vector command}
|
|
\end{gather*} |