Essential Packages

Load packages in the preamble, pass them options and define your own commands.

Packages extend LaTeX. You load them in the preamble, before \begin{document}, with \usepackage.

Common packages

\usepackage{amsmath}   % Advanced math
\usepackage{graphicx}  % Images
\usepackage{hyperref}  % Clickable links

Package options

Many packages accept options in square brackets.

\usepackage[margin=1in]{geometry}  % Set margins
\usepackage[utf8]{inputenc}        % Input encoding
\usepackage[style=apa]{biblatex}   % Reference style

Load hyperref late in the preamble, after most other packages, since it redefines several commands.

Custom commands

Use \newcommand for shortcuts you repeat. The number in square brackets is the argument count, and #1 is the first argument.

% In preamble:
\usepackage{amssymb}
\usepackage{xcolor}
\newcommand{\R}{\mathbb{R}}
\newcommand{\alert}[1]{\textbf{\textcolor{red}{#1}}}

% In document:
The set of real numbers is $\R$.
\alert{Do not forget this!}

This prints the blackboard-bold symbol for the reals, then the warning in bold red.

\mathbb needs amssymb (or amsfonts), and \textcolor needs xcolor. A missing package gives an "Undefined control sequence" error.