LaTeX Package Management
Learn to find, install, and manage LaTeX packages. Understand CTAN, package documentation, troubleshooting conflicts, and best practices.
Master LaTeX package management to extend your documents with powerful features. This guide covers package discovery, installation, usage, and troubleshooting.
Good news: LaTeX Cloud Studio includes all major packages pre-installed. You can focus on using packages rather than installing them!
Understanding LaTeX Packages
What Are Packages?
Packages extend LaTeX’s core functionality by providing:
- Additional commands and environments
- New document classes
- Enhanced formatting options
- Specialized symbols and fonts
- Integration with external tools
Package Categories
Core Extensions
amsmath, amssymb, graphicx, geometry Essential packages that most documents need
Specialized Tools
tikz, minted, algorithm2e, chemfig Domain-specific packages for specialized content
Formatting & Style
fancyhdr, titlesec, enumitem, booktabs Packages that enhance document appearance
Language & Fonts
babel, fontspec, polyglossia, microtype Internationalization and typography
Finding Packages
CTAN: The Comprehensive TeX Archive Network
Package Documentation
Every package should include documentation. Here’s how to access it:
Popular Package Collections
Package Installation
LaTeX Cloud Studio (Pre-installed)
LaTeX Cloud Studio advantage: All major packages are pre-installed and ready to use. Simply add \usepackage{packagename}
to your document.
Local Installation (For Reference)
Package Usage Patterns
Loading Order Matters
Package Options
Conditional Package Loading
Package Conflicts and Compatibility
Common Conflicts
Known package conflicts:
- hyperref conflicts: Load hyperref late, but before cleveref
- Font conflicts: Don’t mix incompatible font packages
- Math conflicts: amsmath and mathtools can conflict with some packages
- Table conflicts: Some table packages don’t work together
- Encoding conflicts: inputenc and fontspec are mutually exclusive
Debugging Package Issues
Essential Package Categories
Mathematics and Science
Graphics and Visualization
Text and Document Formatting
Code and Verbatim
Advanced Package Management
Creating Your Own Packages
Package Version Control
Best Practices
Package management best practices:
- Document requirements: List all required packages in comments
- Use stable packages: Prefer well-established packages over experimental ones
- Read documentation: Always check package documentation before use
- Test compatibility: Test package combinations in minimal examples
- Version control: Document package versions for reproducible builds
- Minimal loading: Only load packages you actually use
- Load order: Follow standard loading order to avoid conflicts
- Keep updated: Use recent package versions when possible
Package Documentation Template
Troubleshooting Guide
Common Error Messages
Fixing common package errors:
- “Package not found”: Check spelling and availability
- “Option clash”: Package loaded twice with different options
- “Command already defined”: Two packages define the same command
- “Missing number”: Syntax error in package options
- “Unknown option”: Option not supported by package version
- “File not found”: Missing package files or dependencies
Quick Reference
Essential Package Loading Order
Package Categories Quick List
Category | Essential Packages |
---|---|
Math | amsmath , amssymb , mathtools |
Graphics | graphicx , tikz , subcaption |
Tables | booktabs , array , longtable |
Bibliography | biblatex , natbib |
Typography | microtype , setspace , enumitem |
Layout | geometry , fancyhdr , titlesec |
Code | listings , minted , fancyvrb |
hyperref , cleveref , bookmark |
Next: Learn about Enhanced cross-linking to improve navigation between related topics in your documentation.