Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up

Essential LaTeX Packages

Packages extend LaTeX functionality. Here is a selection of the most useful ones, organized by category. All are available on Sarmate.net.

Basic packages

inputenc / fontenc

Character encoding management. Essential for French accents.

LaTeX
\usepackage[utf8]{inputenc}  % Encodage UTF-8
\usepackage[T1]{fontenc}     % Polices avec accents

babel

Multilingual support: hyphenation, translation of terms ("Table of Contents", "Figure"...).

LaTeX
\usepackage[english]{babel}
% or for multiple languages:
\usepackage[french, english]{babel}  % last listed = main language

Page layout

geometry

Precise control of margins and text area.

LaTeX
\usepackage[
    a4paper,
    margin=2.5cm,
    % or detailed:
    top=2cm,
    bottom=2cm,
    left=3cm,
    right=2cm
]{geometry}

fancyhdr

Custom headers and footers.

LaTeX
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}  % Clear all
\fancyhead[L]{My document}
\fancyhead[R]{\thepage}
\fancyfoot[C]{Confidential}

setspace

Line spacing control (single, 1.5, double).

LaTeX
\usepackage{setspace}
\onehalfspacing  % 1.5 line spacing
% or \doublespacing for double line spacing

Mathematics

amsmath, amssymb, amsfonts

The AMS suite: advanced math environments, symbols, fonts.

LaTeX
\usepackage{amsmath}   % align, cases, matrix...
\usepackage{amssymb}   % \mathbb, \therefore...
\usepackage{amsfonts}  % Math fonts

% Usage example
\begin{align}
    f(x) &= x^2 + 2x + 1 \\
         &= (x+1)^2
\end{align}

mathtools

Extension of amsmath with fixes and additional features.

LaTeX
\usepackage{mathtools}  % Also loads amsmath

% Auto-sizing delimiters
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\abs{x}  % |x| with correct size

Graphics and images

graphicx

Image insertion (PNG, JPG, PDF).

LaTeX
\usepackage{graphicx}
\includegraphics[width=0.8\textwidth]{image.png}

tikz / pgfplots

Vector drawings and function plots directly in LaTeX.

LaTeX
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{tikzpicture}
    \begin{axis}[xlabel=$x$, ylabel=$f(x)$]
        \addplot[blue, smooth] {x^2};
    \end{axis}
\end{tikzpicture}

xcolor

Colors for text, tables, and drawings.

LaTeX
\usepackage[table]{xcolor}

\textcolor{red}{Red text}
\textcolor{blue!50}{Blue at 50%}
\definecolor{mygreen}{RGB}{0, 128, 64}

Source code

listings

Source code display with syntax highlighting.

LaTeX
\usepackage{listings}
\lstset{
    language=Python,
    basicstyle=\ttfamily\small,
    keywordstyle=\color{blue},
    commentstyle=\color{gray},
    numbers=left
}

\begin{lstlisting}
def hello():
    print("Hello, World!")
\end{lstlisting}

minted

Alternative to listings using Pygments (better highlighting).

LaTeX
\usepackage{minted}

\begin{minted}{python}
def factorial(n):
    return 1 if n <= 1 else n * factorial(n-1)
\end{minted}

Links and references

hyperref

Clickable links in the PDF: table of contents, references, URLs.

LaTeX
\usepackage[
    colorlinks=true,
    linkcolor=blue,
    urlcolor=cyan,
    citecolor=green
]{hyperref}

\href{https://www.sarmate.net}{Sarmate.net}
\url{https://example.com}
Loading order hyperref should generally be loaded last to avoid conflicts with other packages.

Other useful packages

enumitem

Advanced list customization (numbering, spacing).

float

[H] option to force figure placement.

caption / subcaption

Caption customization and subfigures.

siunitx

SI number and unit formatting.

LaTeX
\usepackage{siunitx}
\SI{9.81}{\meter\per\second\squared}  % 9.81 m/s²
\num{1234567}  % 1 234 567 (with spaces)

Typical preamble

Here is a complete preamble for most documents:

LaTeX
\documentclass[12pt, a4paper]{article}

% Encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

% Page layout
\usepackage[margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing

% Mathematics
\usepackage{amsmath, amssymb}

% Images and graphics
\usepackage{graphicx}
\usepackage{xcolor}

% Tables
\usepackage{booktabs}
\usepackage{multirow}

% Links (last)
\usepackage[colorlinks=true]{hyperref}

\title{My document}
\author{First Last}
\date{\today}

\begin{document}
\maketitle
% Content...
\end{document}

Ready to explore these packages?

All are available and ready to use on Sarmate.net

Create a free account