Table of Contents
TexLive Packages
Packages extend LaTeX with new commands and environments. Load them in the preamble (before \begin{document}) with \usepackage{packagename}. Packages add features like graphics, colors, advanced math, bibliographies, code listings, and much more.
\documentclass{article} \usepackage{amsmath} % advanced math \usepackage{graphicx} % include graphics \usepackage{xcolor} % colors \usepackage{hyperref} % hyperlinks \begin{document} % Your content \end{document}
Common packages:
amsmath — advanced math symbols and environments (align, gather, etc.). Often loaded first if you use anything beyond basic math.
graphicx — include images with \includegraphics. Required for figures.
xcolor — text and background colors with \textcolor and \colorbox.
hyperref — hyperlinks and PDF metadata. Load last (after most other packages) to avoid conflicts. Enables \url{...}, \href{url}{text}, and internal references.
listings — format source code with syntax highlighting and line numbers. Alternative to verbatim for displaying code.
tikz — draw diagrams, plots, and graphics programmatically. Powerful but complex; see TexLive TikZ Graphics.
geometry — customize page margins: \usepackage[margin=1in]{geometry}.
fancyhdr — custom page headers and footers. See TexLive Headers and Footers.
natbib — flexible bibliography system with author-year citations. Alternative to standard BibTeX.
Package options are passed in square brackets: \usepackage[options]{package}. Example: \usepackage[T1]{fontenc} loads T1 font encoding (better for non-English text).
Installing packages: Most common packages are included in texlive-latex-extra. If a package is missing, install via your package manager: apt install texlive-latex-extra (Debian). For newer packages or custom packages, place .sty files in the same directory as your .tex file or in ~/texmf/tex/latex/.
Finding packages: Search CTAN (Comprehensive TeX Archive Network) to find and learn packages. Read package documentation: texdoc packagename opens the .pdf manual in a viewer if installed.
