Document Structure
Minimal Document
\documentclass{article} \begin{document} Hello, LaTeX! \end{document}
Document Classes
articleShort documents, papers, reports
reportLonger documents with chapters
bookFull books with parts, chapters
beamerSlide presentations
letterFormal 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
\tinySmallest
\smallSmaller than normal
\normalsizeDefault size
\large / \LargeLarger / even larger
\huge / \HugeHuge / largest
Spacing & Breaks
\\Line break
\newpagePage break
\vspace{1cm}Vertical space
\hspace{1cm}Horizontal space
\noindentSuppress 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^bIntegral
\lim_{x \to 0}Limit
\inftyInfinity symbol
Greek Letters
\alpha \beta \gamma \deltaLowercase Greek
\Gamma \Delta \Theta \LambdaUppercase Greek
\epsilon \sigma \omega \piMore lowercase Greek
\mu \nu \rho \tau \phiStatistical / physics common
Matrices
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} % pmatrix = (), vmatrix = ||, Bmatrix = {}
Environments
Common Environments
documentMain content area
equationNumbered math equation
alignAligned multi-line equations
figureFloating figure
tableFloating table
verbatimLiteral text (no formatting)
abstractAbstract 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 / rLeft / center / right aligned
|Vertical line between columns
p{3cm}Paragraph column (fixed width)
\hlineHorizontal 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
hHere (approximately)
tTop of page
bBottom of page
pSpecial float page
!Override internal restrictions
HExactly 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
plainNumbered, sorted alphabetically
unsrtNumbered, in citation order
abbrvLike plain, abbreviated names
apalikeAuthor-year (APA-like)
Packages
Essential Packages
amsmathAdvanced math environments
graphicxImage inclusion
hyperrefClickable links and references
geometryPage margins: \usepackage[margin=1in]{geometry}
booktabsProfessional tables (\toprule, \midrule)
xcolorText and background colors
listingsSource code listings
tikzProgrammatic graphics and diagrams
babelMultilingual support
natbibFlexible 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.texCompile to PDF
bibtex docProcess bibliography
latexmk -pdf doc.texAuto-compile (handles reruns)
xelatex doc.texUnicode/custom fonts support
Special Characters
\% \$ \& \# \_Escaped reserved characters
\textbackslashBackslash 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
% commentSingle-line comment
\usepackage{lipsum}Dummy text: \lipsum[1-3]