Introduction
LaTeX’s power comes from its extensive package ecosystem. Thousands of packages extend LaTeX capabilities, from typography to graphics to specialized features. Understanding which packages to use and how they work together is essential for efficient LaTeX document creation.
This guide covers essential packages, where to find them, and how to use them effectively.
Package Basics
Loading Packages
\usepackage[options]{package-name}
% Multiple packages
\usepackage{package1,package2,package3}
% With configuration
\usepackage[utf8]{inputenc}
\usepackage[top=1in,bottom=1in]{geometry}
Package Options
% Default options
\usepackage{hyperref}
% Custom options
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
% Multiple packages with options
\usepackage[
backend=biber,
style=authoryear,
sorting=nyt
]{biblatex}
Essential Core Packages
Encoding and Fonts
\usepackage[utf8]{inputenc} % UTF-8 input
\usepackage[T1]{fontenc} % Output encoding
\usepackage{lmodern} % Improved fonts
\usepackage{microtype} % Typography improvements
Mathematics
\usepackage{amsmath} % Math environments
\usepackage{amssymb} % Math symbols
\usepackage{amsthm} % Theorem environments
\usepackage{mathtools} % Extended math
Graphics
\usepackage{graphicx} % Include images
\usepackage{tikz} % Programmable graphics
\usepackage{pgfplots} % Data plotting
Cross-References
\usepackage{hyperref} % Clickable links
\usepackage{cleveref} % Smart references
\usepackage{nameref} % Named references
Typography Packages
Text Formatting
\usepackage{microtype} % Character protrusion
\usepackage{soul} % Text highlighting
\usepackage{xcolor} % Color support
\usepackage{fontspec} % Font selection (XeLaTeX)
Spacing
\usepackage{setspace} % Line spacing
\usepackage{parskip} % Paragraph spacing
\usepackage{indentfirst} % Indent first paragraphs
Graphics Packages
Image Handling
\usepackage{graphicx} % Basic graphics
\usepackage{wrapfig} % Wrapped figures
\usepackage{subcaption} % Subfigures
\usepackage{float} % Float placement
Diagram Creation
\usepackage{tikz} % General graphics
\usetikzlibrary{shapes,arrows,positioning,decorations}
\usepackage{pgfplots} % Plotting
\usepackage{chemfig} % Chemistry diagrams
Table Packages
Table Formatting
\usepackage{booktabs} % Professional tables
\usepackage{longtable} % Multi-page tables
\usepackage{tabularx} % Auto-width columns
\usepackage{multicol} % Multi-column
\usepackage{multirow} % Multi-row
\usepackage{array} % Extended array
Table Extras
\usepackage[table]{xcolor} % Table colors
\usepackage{diagbox} % Diagonal dividers
\usepackage{tabu} % Flexible tables
Bibliography Packages
Citation Systems
% Traditional
\usepackage{natbib}
\bibliographystyle{plainnat}
% Modern (recommended)
\usepackage[backend=biber]{biblatex}
% BibTeX fallback
\usepackage{cite}
Float and Layout Packages
Float Control
\usepackage{float} % H placement option
\usepackage{placeins} % Float barriers
\usepackage{flafter} % Floats after reference
\usepackage{morefloats} % More float slots
Page Layout
\usepackage{geometry} % Page dimensions
\usepackage{fancyhdr} % Headers/footers
\usepackage{changepage} % Change page layout
Utility Packages
Development
\usepackage{todonotes} % TODO notes
\usepackage{fixme} % Fixme notes
\usepackage{showkeys} % Show labels
\usepackage{layouts} % Layout diagrams
Conditional Content
\usepackage{iftex} % Check TeX engine
\usepackage{ifdraft} % Draft mode detection
\usepackage{comment} % Comment blocks
Finding and Installing Packages
CTAN
The Comprehensive TeX Archive Network (CTAN) hosts all packages:
- https://ctan.org
- Search by package name
- Download documentation
Package Managers
# TeX Live
tlmgr install package-name
tlmgr search keyword
# MiKTeX
mpm --install=package-name
# Ubuntu/Debian
apt install texlive-package-name
Package Documentation
texdoc package-name
texdoc tikz
texdoc beamer
Package Conflicts
Common Conflicts
% hyperref should load late
\usepackage{hyperref} % Last (except cleveref)
% cleveref loads after hyperref
\usepackage{cleveref}
% geometry after fancyhdr
\usepackage{fancyhdr}
\usepackage{geometry}
Resolving Conflicts
% Disable package features
\usepackage[noptions]{package}
% Load with options
\usepackage[all]{package}
% Use alternative packages
Package Version Management
Checking Versions
\usepackage{ifthen}
\makeatletter
\typeout{Package: \pkg@name\space v\pkg@version}
\makeatother
% Or check in log
\listfiles
Version Requirements
\usepackage{geometry}
\RequirePackage{geometry}[2020/01/02]
Recommended Package Sets
Academic Writing
\usepackage[
utf8,inputenc,
T1,fontenc,
]{inputenc}
\usepackage[
authoryear,
backend=biber
]{biblatex}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{cleveref}
Technical Documentation
\usepackage{minted}
\usepackage{listings}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{glossaries}
\usepackage{makeidx}
Beamer Presentations
\usepackage{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{minted}
\usepackage{bookmark}
Best Practices
Package Organization
- Load packages in logical order
- Set options in preamble
- Comment package purposes
- Keep package list manageable
Performance
% Load only needed features
\usepackage[only]{textcomp}
% Use draft for development
\usepackage[draft]{graphicx}
Conclusion
The LaTeX package ecosystem provides remarkable capabilities beyond the base system. By understanding essential packages and their interactions, you can efficiently build documents with professional features.
Start with core packages and add specialized packages as needed. Use package managers for easy installation and texdoc for documentation.
Comments