Essential LaTeX Packages
LaTeX's power comes from its package ecosystem. There are over 6,000 packages on CTAN — but you only need to know a core set to handle 95% of documents well. This guide covers the most important packages by category with usage examples.
\usepackage{name} to your preamble and compile.Document & Layout
geometrySet page margins, paper size, and orientation. The single most commonly used layout package.
setspaceControl line spacing. Provides \singlespacing, \onehalfspacing, \doublespacing, and \setstretch{1.3}.
multicolCreate multi-column layouts within a page. Use \begin{multicols}{2}...\end{multicols} for two-column sections.
parskipAdd space between paragraphs and remove paragraph indentation — the modern style preferred in many documents.
Typography & Fonts
microtypeEnables character protrusion and font expansion. Dramatically reduces overfull hbox warnings and improves text appearance.
fontencUse T1 font encoding for correct hyphenation of words with accented characters and proper PDF copy-paste.
inputencTell LaTeX your source file is UTF-8 encoded. Required for pdfLaTeX when using any non-ASCII characters.
lmodernLoad the Latin Modern fonts — a cleaner, scalable replacement for the default Computer Modern fonts.
Mathematics
amsmathThe essential math package. Provides align, gather, multline environments, and \text{}, \operatorname{}, \DeclareMathOperator.
amssymbExtra math symbols: ℝ, ℤ, ℕ, ∅, ⊂, ≤, ≥, ∈ and hundreds more.
amsthmTheorem-like environments: \newtheorem{thm}{Theorem} creates numbered theorems, lemmas, proofs, and definitions.
siunitxFormat numbers and physical units consistently: \SI{9.8}{m/s^2}, \num{3.14e6}, \ang{45}.
Figures & Tables
graphicxInclude images with \includegraphics. Supports PNG, JPEG, PDF, EPS. Provides scaling, rotation, and cropping options.
booktabsProfessional table rules: \toprule, \midrule, \bottomrule. Required for publication-quality tables.
subcaptionPlace multiple figures or tables side by side with individual sub-captions (a), (b), etc.
floatAdds the [H] placement specifier that forces a float exactly where it appears in the source.
Code & Verbatim
listingsSyntax-highlighted code blocks for 80+ programming languages. Configure colours, line numbers, and frame style.
mintedSuperior code highlighting using Python Pygments. Requires --shell-escape compile flag. Better output than listings.
verbatimEnhanced verbatim environment and \verbatiminput{file.txt} to include a plain-text file as-is.
References & Links
hyperrefMakes all cross-references, citations, and URLs clickable in the PDF. Load last in preamble. hidelinks removes coloured boxes.
cleverefSmart references: \cref{fig:arch} outputs 'Fig. 1' automatically. Handles plurals: \cref{fig:a,fig:b} → 'Figs. 1 and 2'.
urlFormats and line-wraps long URLs with \url{https://...}. Safer than typing URLs in text mode.
Package Loading Order Matters
hyperref must be loaded after almost all other packages to avoid conflicts. Only packages explicitly designed for it (like cleveref) should come after.
Load encoding packages before font packages and certainly before loading document content.
amsthm depends on amsmath; always load amsmath first.
Don't load both subfig and subcaption — they solve the same problem differently and will conflict. Pick one.
Experiment with packages in the editor
All packages above are available instantly — no installation needed.
Start Writing