LATEX QUICK REFERENCE
Document structure, math, tables, figures, and more
Document Structure
Minimal Document
\documentclass{article}
\begin{document}
Hello, LaTeX!
\end{document}
Document Classes
| article | Short documents, papers, reports |
| report | Longer documents with chapters |
| book | Full books with parts, chapters |
| beamer | Slide presentations |
| letter | Formal letters |
Preamble
\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, graphicx}
\title{My Document}
\author{Alice}
\date{\today}
Sectioning
| \part{} | Top-level division (book/report) |
| \chapter{} | Chapter (report/book only) |
| \section{} | Section |
| \subsection{} | Subsection |
| \subsubsection{} | Sub-subsection |
| \paragraph{} | Named paragraph |
Text Formatting
Font Styles
| \textbf{bold} | **Bold** text |
| \textit{italic} | *Italic* text |
| \underline{text} | Underlined text |
| \texttt{code} | Monospace / typewriter |
| \textsc{Small Caps} | Small capitals |
| \emph{emphasis} | Emphasis (context-aware italic) |
Font Sizes
| \tiny | Smallest |
| \small | Smaller than normal |
| \normalsize | Default size |
| \large / \Large | Larger / even larger |
| \huge / \Huge | Huge / largest |
Spacing & Breaks
| \\ | Line break |
| \newpage | Page break |
| \vspace{1cm} | Vertical space |
| \hspace{1cm} | Horizontal space |
| \noindent | Suppress paragraph indent |
| ~ | Non-breaking space |
Math Mode
Inline & Display Math
Inline: $E = mc^2$ or \( a^2 + b^2 = c^2 \)
Display: \[ \int_0^\infty e^{-x} dx = 1 \]
Numbered: \begin{equation}
F = ma \label{eq:newton}
\end{equation}
Common Symbols
| ^ and _ | Superscript / subscript: x^2, a_i |
| \frac{a}{b} | Fraction: a/b |
| \sqrt{x} / \sqrt[3]{x} | Square / cube root |
| \sum_{i=1}^{n} | Summation |
| \int_a^b | Integral |
| \lim_{x \to 0} | Limit |
| \infty | Infinity symbol |
Greek Letters
| \alpha \beta \gamma \delta | Lowercase Greek |
| \Gamma \Delta \Theta \Lambda | Uppercase Greek |
| \epsilon \sigma \omega \pi | More lowercase Greek |
| \mu \nu \rho \tau \phi | Statistical / physics common |
Matrices
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
% pmatrix = (), vmatrix = ||, Bmatrix = {}
Environments
Common Environments
| document | Main content area |
| equation | Numbered math equation |
| align | Aligned multi-line equations |
| figure | Floating figure |
| table | Floating table |
| verbatim | Literal text (no formatting) |
| abstract | Abstract block (article) |
Aligned Equations
\begin{align}
x &= a + b \\
y &= c + d
\end{align}
% & marks alignment point, \\ breaks lines
Lists & Tables
Lists
\begin{itemize}
\item Bullet point
\item Another item
\end{itemize}
\begin{enumerate}
\item First \item Second
\end{enumerate}
Tables
\begin{tabular}{|l|c|r|}
\hline
Name & Age & Score \\ \hline
Alice & 25 & 88 \\
Bob & 30 & 92 \\ \hline
\end{tabular}
Column Specifiers
| l / c / r | Left / center / right aligned |
| | | Vertical line between columns |
| p{3cm} | Paragraph column (fixed width) |
| \hline | Horizontal line |
| \cline{2-3} | Partial horizontal line (cols 2-3) |
Figures
Including Images
\usepackage{graphicx} % in preamble
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{img.png}
\caption{A figure caption}
\label{fig:example}
\end{figure}
Placement Specifiers
| h | Here (approximately) |
| t | Top of page |
| b | Bottom of page |
| p | Special float page |
| ! | Override internal restrictions |
| H | Exactly here (requires float) |
Cross-references
See Figure~\ref{fig:example} on
page~\pageref{fig:example}.
% Requires two compilations to resolve
Bibliography
BibTeX Workflow
% In .bib file:
@article{smith2025,
author = {Smith, John},
title = {A Great Paper},
journal = {Nature}, year = {2025}
}
Citing in Document
According to~\cite{smith2025} ...
\bibliographystyle{plain}
\bibliography{refs} % refs.bib
Bibliography Styles
| plain | Numbered, sorted alphabetically |
| unsrt | Numbered, in citation order |
| abbrv | Like plain, abbreviated names |
| apalike | Author-year (APA-like) |
Packages
Essential Packages
| amsmath | Advanced math environments |
| graphicx | Image inclusion |
| hyperref | Clickable links and references |
| geometry | Page margins: \usepackage[margin=1in]{geometry} |
| booktabs | Professional tables (\toprule, \midrule) |
| xcolor | Text and background colors |
| listings | Source code listings |
| tikz | Programmatic graphics and diagrams |
| babel | Multilingual support |
| natbib | Flexible citations (author-year, numeric) |
Custom Commands
New Commands
\newcommand{\R}{\mathbb{R}} % shortcut
\newcommand{\norm}[1]{\|#1\|} % 1 argument
Now use: $x \in \R$, $\norm{v}$
Renewing & Environments
\renewcommand{\abstractname}{Summary}
\newenvironment{boxed}
{\begin{center}\begin{tabular}{|p{0.9\textwidth}|}\hline}
{\hline\end{tabular}\end{center}}
Useful Shortcuts
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\dd}[2]{\frac{d #1}{d #2}}
% Usage: $\pd{f}{x}$, $\dd{y}{t}$
Common Patterns
Title Page
\begin{document}
\maketitle
\tableofcontents
\newpage
Compilation
| pdflatex doc.tex | Compile to PDF |
| bibtex doc | Process bibliography |
| latexmk -pdf doc.tex | Auto-compile (handles reruns) |
| xelatex doc.tex | Unicode/custom fonts support |
Special Characters
| \% \$ \& \# \_ | Escaped reserved characters |
| \textbackslash | Backslash in text |
| \{ \} | Literal braces |
| ``text'' | Smart double quotes |
| --- | Em dash |
| -- | En dash |
Useful Tips
| \label{} + \ref{} | Cross-reference anything |
| \input{file} | Include another .tex file |
| % comment | Single-line comment |
| \usepackage{lipsum} | Dummy text: \lipsum[1-3] |