LaTeX Cheat Sheet
Expressions
Expression Number
If you need an expression number:
\begin{eqnarray}
y=\alpha x + \beta
\end{eqnarray}
If you do not need an expression number:
\[
y=\alpha x + \beta
\]
Align Equations
Use & to align multiple equations at equal positions.
\[
a&=b+c \\
d+e&=f
\]
\begin{eqnarray}
a&=b+c \\
d+e&=f
\end{eqnarray}
Simultaneous Equations
\begin{eqnarray}
\begin{cases}
(x - 2)^2 + y^2 + z^2 = 1\\
x + z = 3
\end{cases}
\end{eqnarray}
\begin{numcases}
{}
(x - 2)^2 + y^2 + z^2 = 1\\
x + z = 3
\end{numcases}
Matrix
\begin{eqnarray}
\left(
\begin{array}{cc}
a & b \\
c & d
\end{array}
\right)
\end{eqnarray}
Source Code
minted
To write code directly in a tex file, use minted.
\begin{minted}[linenos, breaklines, frame=lines]{c}
#include <stdio.h>
int main(){
printf("Hello, World!");
return 0;
}
\end{minted}
Use inputminted to specify a file and put the source code in it.
\inputminted[linenos, breaklines, frame=lines]{language}{src/hello.c}
Figure
This is an example of inserting a single image. In the example below, the package here is used to insert the image at the specified position. (\usepackage{here}
)
\begin{figure}[H]
\centering
\includegraphics[width=10cm]{path2image}
\caption{hoge}
\label{fig1}
\end{figure}
Table
The table can be written as follows, but it is easier to create it automatically using Table generator.
\begin{table}[H]
\centering
\caption{title}
\label{tbl:1}
\begin{tabular}{ccc}
\hline
e1 & e2 & e3 \\
\hline
11 & 12 & 13 \\
21 & 22 & 23 \\
31 & 32 & 33 \\
\hline
\end{tabular}
\end{table}
Footnote
\footnote[number]{text}
Special Characters and Operators
Σ
\sum_{\alpha=0}^{\beta}
∫
\int_{\alpha}^{\beta}
lim
\lim_{n \to \infty}
≠
\neq
≈
\approx
≒
\fallingdotseq
≡
\equiv
>
\gt
<
\lt
≧
\geq
\geqq
≦
\leq
\leqq
×
\times
÷
\div
±
\pm
∈
\in
⊂
\subset
∩
\cap
∪
\cup
Null Set ∅
\emptyset
∞
\infty
Vector
\vec{a}
\bm{a}
Partial, Del, ∂
\partial