This reference covers the most important LaTeX packages organized by functionality. Each entry includes the package purpose, basic usage, and practical examples.

Package installation: LaTeX Cloud Studio includes all standard packages. No installation needed - just use \usepackage{packagename}.

Essential Packages

Core Document Setup

% Input encoding (for older documents)
\usepackage[utf8]{inputenc}

% Font encoding
\usepackage[T1]{fontenc}

% Language support
\usepackage[english]{babel}
% or multiple languages
\usepackage[english,spanish,french]{babel}

% Better fonts
\usepackage{lmodern}

% Microtype (better typography)
\usepackage{microtype}

Page Layout

geometry

Controls page dimensions and margins.

\usepackage{geometry}

% Common configurations
\geometry{margin=1in}
\geometry{left=1.5in, right=1in, top=1in, bottom=1in}
\geometry{a4paper, margin=2.5cm}
\geometry{letterpaper, landscape}

% Advanced options
\geometry{
  paperwidth=210mm,
  paperheight=297mm,
  left=25mm,
  right=25mm,
  top=30mm,
  bottom=30mm,
  headheight=15pt,
  headsep=10mm,
  footskip=15mm
}

fancyhdr

Custom headers and footers.

\usepackage{fancyhdr}
\pagestyle{fancy}

% Clear defaults
\fancyhf{}

% Custom headers/footers
\fancyhead[L]{Left Header}
\fancyhead[C]{Center Header}
\fancyhead[R]{\thepage}
\fancyfoot[C]{Footer Text}

% Different odd/even pages
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO,RE]{\leftmark}

% Custom styles
\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[C]{\thepage}
}

Mathematics Packages

amsmath

Extended math environments and commands.

\usepackage{amsmath}

% Provides environments:
\begin{align}
  f(x) &= x^2 + 2x + 1 \\
  &= (x + 1)^2
\end{align}

\begin{gather}
  a = b + c \\
  d = e + f
\end{gather}

\begin{split}
  (a + b)^3 &= a^3 + 3a^2b \\
  &\quad + 3ab^2 + b^3
\end{split}

% Commands
\text{text in math}
\tfrac{a}{b}  % Text-style fraction
\dfrac{a}{b}  % Display-style fraction
\binom{n}{k}  % Binomial coefficient

amssymb

Additional mathematical symbols.

\usepackage{amssymb}

% Provides symbols like:
\mathbb{R}    % Real numbers
\mathbb{Z}    % Integers
\mathbb{N}    % Natural numbers
\varnothing   % Empty set
\therefore    % Therefore
\because      % Because
\blacksquare  % QED symbol
\leqslant     % Less or equal (slanted)
\geqslant     % Greater or equal (slanted)

amsthm

Theorem environments.

\usepackage{amsthm}

% Define theorem environments
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}

% Usage
\begin{theorem}[Fermat's Last Theorem]
No three positive integers $a$, $b$, and $c$ satisfy...
\end{theorem}

\begin{proof}
The proof is left as an exercise.
\end{proof}

mathtools

Enhanced version of amsmath.

\usepackage{mathtools}

% Additional features
\begin{align}
  f(x) &= \begin{cases}
    x^2 & \text{if } x > 0 \\
    0 & \text{otherwise}
  \end{cases}
\end{align}

% Better spacing
\coloneqq     % :=
\Coloneqq     % ::=
\eqqcolon     % =:

% Paired delimiters
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}

% Usage
\abs{x}      % Absolute value
\abs*{x}     % Auto-sizing
\norm{v}     % Vector norm

Graphics and Figures

graphicx

Standard package for including graphics.

\usepackage{graphicx}

% Include images
\includegraphics{image.png}
\includegraphics[width=5cm]{image.pdf}
\includegraphics[height=3cm]{image.jpg}
\includegraphics[scale=0.5]{image.eps}
\includegraphics[width=0.8\textwidth]{image.svg}

% Rotation and scaling
\includegraphics[angle=90]{image.png}
\rotatebox{45}{Rotated text}
\scalebox{2}{Scaled text}
\resizebox{5cm}{3cm}{Resized content}

% Figure environment
\begin{figure}[htbp]
  \centering
  \includegraphics[width=\textwidth]{plot.pdf}
  \caption{Important results}
  \label{fig:results}
\end{figure}

subcaption

Create subfigures and subtables.

\usepackage{subcaption}

\begin{figure}
  \centering
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[width=\textwidth]{image1.png}
    \caption{First subplot}
    \label{fig:sub1}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[width=\textwidth]{image2.png}
    \caption{Second subplot}
    \label{fig:sub2}
  \end{subfigure}
  \caption{Combined figure}
  \label{fig:combined}
\end{figure}

% Reference subfigures
See Figure~\ref{fig:sub1} and~\ref{fig:sub2}.

tikz

Powerful graphics creation.

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning, shapes}

% Simple drawing
\begin{tikzpicture}
  \draw (0,0) -- (2,1) -- (1,2) -- cycle;
  \node at (1,1) {Center};
\end{tikzpicture}

% Complex diagram
\begin{tikzpicture}[
  node distance=2cm,
  every node/.style={draw, circle}
]
  \node (A) {A};
  \node (B) [right=of A] {B};
  \node (C) [below=of A] {C};
  
  \draw[->] (A) -- (B);
  \draw[->] (A) -- (C);
  \draw[->] (B) -- (C);
\end{tikzpicture}

Tables

booktabs

Professional table formatting.

\usepackage{booktabs}

\begin{table}[htbp]
  \centering
  \caption{Professional table}
  \begin{tabular}{lcc}
    \toprule
    Item & Quantity & Price \\
    \midrule
    Apples & 5 & \$2.50 \\
    Oranges & 3 & \$1.80 \\
    Bananas & 6 & \$3.00 \\
    \midrule
    Total & 14 & \$7.30 \\
    \bottomrule
  \end{tabular}
\end{table}

array

Enhanced array and tabular environments.

\usepackage{array}

% New column types
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

% Advanced tables
\begin{tabular}{>{\bfseries}l c r}
  \hline
  Bold Header & Center & Right \\
  \hline
  Row 1 & Data & Values \\
  Row 2 & More & Data \\
  \hline
\end{tabular}

longtable

Tables spanning multiple pages.

\usepackage{longtable}

\begin{longtable}{lcc}
  \caption{Long table spanning pages} \\
  \toprule
  Column 1 & Column 2 & Column 3 \\
  \midrule
  \endfirsthead
  
  \multicolumn{3}{c}{{\tablename\ \thetable{} -- continued}} \\
  \toprule
  Column 1 & Column 2 & Column 3 \\
  \midrule
  \endhead
  
  \midrule
  \multicolumn{3}{r}{{Continued on next page}} \\
  \endfoot
  
  \bottomrule
  \endlastfoot
  
  % Table content
  Data & More & Values \\
  % ... many rows
\end{longtable}

Bibliography and Citations

biblatex

Modern bibliography management.

\usepackage[style=authoryear,backend=biber]{biblatex}
\addbibresource{references.bib}

% Citation commands
\cite{key}              % (Author, Year)
\parencite{key}         % (Author, Year)
\textcite{key}          % Author (Year)
\citeauthor{key}        % Author
\citeyear{key}          % Year
\footcite{key}          % Footnote citation
\fullcite{key}          % Full citation

% Multiple citations
\parencite{key1,key2,key3}

% Bibliography
\printbibliography

natbib

Traditional bibliography package.

\usepackage[authoryear,round]{natbib}

% Citation styles
\citet{key}     % Author (Year)
\citep{key}     % (Author, Year)
\citealt{key}   % Author Year
\citealp{key}   % Author, Year
\citeauthor{key}% Author
\citeyear{key}  % Year

% With page numbers
\citep[p.~25]{key}
\citep[see][p.~25]{key}

% Bibliography
\bibliographystyle{plainnat}
\bibliography{references}

Lists

enumitem

Customizable lists.

\usepackage{enumitem}

% Customized itemize
\begin{itemize}[label=\textbullet, itemsep=0pt]
  \item First item
  \item Second item
\end{itemize}

% Customized enumerate
\begin{enumerate}[label=(\alph*), start=3]
  \item Third item (c)
  \item Fourth item (d)
\end{enumerate}

% Inline lists
\begin{enumerate*}[label=(\roman*)]
  \item One \item Two \item Three
\end{enumerate*}

% Description lists
\begin{description}[style=nextline]
  \item[Long term] Description on next line
  \item[Short] Inline description
\end{description}

Code and Verbatim

listings

Code listings with syntax highlighting.

\usepackage{listings}
\usepackage{xcolor}

% Configure style
\lstset{
  language=Python,
  basicstyle=\ttfamily\small,
  keywordstyle=\color{blue},
  commentstyle=\color{green},
  stringstyle=\color{red},
  numbers=left,
  numberstyle=\tiny,
  breaklines=true,
  frame=single
}

% Inline code
\lstinline{print("Hello")}

% Code block
\begin{lstlisting}[caption=Python example]
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
\end{lstlisting}

% External file
\lstinputlisting[language=C]{code.c}

minted

Advanced syntax highlighting.

\usepackage{minted}

% Inline code
\mintinline{python}{print("Hello")}

% Code block
\begin{minted}[linenos,bgcolor=gray!10]{python}
def quicksort(arr):
    if len(arr) <= 1:
        return arr
    pivot = arr[len(arr) // 2]
    left = [x for x in arr if x < pivot]
    middle = [x for x in arr if x == pivot]
    right = [x for x in arr if x > pivot]
    return quicksort(left) + middle + quicksort(right)
\end{minted}

% External file
\inputminted{javascript}{script.js}

verbatim

Enhanced verbatim environments.

\usepackage{verbatim}

% Basic verbatim
\begin{verbatim}
Raw text with $special% characters&
\end{verbatim}

% Comment out sections
\begin{comment}
This entire section is commented out
and will not appear in the output.
\end{comment}

% Verbatim input from file
\verbatiminput{file.txt}

Fonts and Typography

fontspec

Modern font selection (XeLaTeX/LuaLaTeX).

\usepackage{fontspec}

% Set main fonts
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}

% Font features
\setmainfont[
  Ligatures=TeX,
  Numbers=OldStyle
]{Minion Pro}

% Custom font families
\newfontfamily\myfont{Comic Sans MS}
{\myfont This text uses Comic Sans}

microtype

Typography refinements.

\usepackage{microtype}

% Automatic improvements:
% - Character protrusion
% - Font expansion
% - Kerning adjustments
% - Tracking adjustments

% Manual adjustments
\textls[200]{Letter spaced text}
\microtypesetup{expansion=false}

Cross-references

hyperref

Hyperlinks and PDF features.

\usepackage{hyperref}

% Configuration
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  filecolor=magenta,
  urlcolor=cyan,
  citecolor=green,
  pdfauthor={Author Name},
  pdftitle={Document Title},
  pdfsubject={Subject},
  pdfkeywords={keyword1, keyword2}
}

% Usage
\href{https://example.com}{Link text}
\url{https://example.com}
\nolinkurl{https://example.com}

% Internal links
\hyperref[label]{text}
\autoref{label}  % Automatic reference type

cleveref

Intelligent cross-referencing.

\usepackage{cleveref}

% Better references
\cref{eq:equation}     % Equation (1)
\Cref{fig:figure}      % Figure 1
\cref{sec:section}     % Section 2.1

% Multiple references
\cref{eq:1,eq:2,eq:3}  % Equations (1) to (3)
\cref{fig:a,fig:b}     % Figures 1 and 2

% Custom names
\crefname{algorithm}{algorithm}{algorithms}
\Crefname{algorithm}{Algorithm}{Algorithms}

Specialized Packages

siunitx

Scientific units and numbers.

\usepackage{siunitx}

% Numbers
\num{123456.789}        % 123,456.789
\num{1.23e-4}          % 1.23 × 10⁻⁴

% Units
\si{\meter\per\second}  % m/s
\si{\kilo\gram}        % kg
\si{\degree\celsius}    % °C

% Numbers with units
\SI{9.81}{\meter\per\second\squared}  % 9.81 m/s²
\SI{25}{\degree\celsius}              % 25 °C

% Ranges
\SIrange{10}{20}{\celsius}            % 10 °C to 20 °C
\numrange{1.2}{3.4}                   % 1.2 to 3.4

% Tables
\begin{tabular}{S[table-format=3.2]}
  \toprule
  {Values} \\
  \midrule
  1.23 \\
  45.67 \\
  890.12 \\
  \bottomrule
\end{tabular}

algorithm2e

Algorithm pseudocode.

\usepackage[ruled,vlined]{algorithm2e}

\begin{algorithm}[H]
  \SetAlgoLined
  \KwData{Array $A$ of $n$ elements}
  \KwResult{Sorted array $A$}
  
  \For{$i \leftarrow 1$ \KwTo $n-1$}{
    $key \leftarrow A[i]$\;
    $j \leftarrow i-1$\;
    
    \While{$j \geq 0$ \KwAnd $A[j] > key$}{
      $A[j+1] \leftarrow A[j]$\;
      $j \leftarrow j-1$\;
    }
    $A[j+1] \leftarrow key$\;
  }
  
  \caption{Insertion Sort}
  \label{alg:insertion-sort}
\end{algorithm}

mhchem

Chemical formulas and equations.

\usepackage{mhchem}

% Chemical formulas
\ce{H2O}              % Water
\ce{CaCl2}            % Calcium chloride
\ce{H2SO4}            % Sulfuric acid

% Chemical equations
\ce{2H2 + O2 -> 2H2O}
\ce{CaCO3 + 2HCl -> CaCl2 + H2O + CO2}

% Reaction arrows
\ce{A <=>> B}         % Equilibrium
\ce{A ->[catalyst] B} % Catalyst
\ce{A ->[\Delta] B}   % Heat

% States of matter
\ce{H2O(l)}           % Liquid
\ce{NaCl(s)}          % Solid
\ce{CO2(g)}           % Gas
\ce{Na+(aq)}          % Aqueous

Layout and Formatting

multicol

Multiple column layouts.

\usepackage{multicol}

% Two-column text
\begin{multicols}{2}
  This text will be formatted in two columns.
  LaTeX automatically balances the columns.
\end{multicols}

% Three columns with separator
\begin{multicols}{3}[\section{Three Column Section}]
  Content in three columns with a section header.
\end{multicols}

% Column break
\begin{multicols}{2}
  First column content.
  \columnbreak
  Second column content.
\end{multicols}

setspace

Line spacing control.

\usepackage{setspace}

% Document-wide spacing
\singlespacing
\onehalfspacing
\doublespacing
\setstretch{1.5}

% Local spacing
\begin{spacing}{1.8}
  This paragraph has 1.8 line spacing.
\end{spacing}

\begin{singlespace}
  This paragraph is single-spaced.
\end{singlespace}

\begin{doublespace}
  This paragraph is double-spaced.
\end{doublespace}

parskip

Paragraph spacing without indentation.

\usepackage{parskip}

% Automatically sets:
% - \parindent to 0pt
% - \parskip to appropriate spacing
% - Adjusts list environments

% Manual control
\setlength{\parskip}{1em}
\setlength{\parindent}{0pt}

Package Management Tips

Loading Order

Important package loading order:

  1. Font encoding: inputenc, fontenc
  2. Language: babel, polyglossia
  3. Fonts: lmodern, fontspec
  4. Math: amsmath, amssymb, mathtools
  5. Graphics: graphicx, tikz
  6. Tables: booktabs, longtable
  7. Bibliography: biblatex, natbib
  8. Cross-references: cleveref, hyperref (load last)

Common Conflicts

% Avoid these combinations:
% \usepackage{subfigure}  % Old package
% \usepackage{subcaption} % Use this instead

% \usepackage{cite}       % Basic citations
% \usepackage{natbib}     % Use this for advanced citations

% \usepackage{hyperref}
% \usepackage{cleveref}   % Load cleveref AFTER hyperref

Quick Reference

Most Used Packages

Essential

amsmath graphicx hyperref geometry babel

Typography

microtype setspace parskip fontspec lmodern

Tables

booktabs array longtable multirow tabularx

Bibliography

biblatex natbib cite apacite chicago

Math

amssymb amsthm mathtools siunitx physics

Code

listings minted verbatim algorithm2e pseudocode


Need help choosing packages? Check our Package Selection Guide for recommendations based on document type and field.