Learn to create professional cross-references in LaTeX documents. This guide covers the complete referencing system from basic labels to advanced automated references.
Why cross-references matter: They maintain consistency automatically, update numbering when you reorganize content, and provide clickable navigation in PDF documents.
Basic Cross-referencing System
Labels and References
The Label-Reference Workflow
- Create labels with
\label{prefix:name}
- Reference labels with
\ref{prefix:name}
- Compile twice to resolve all references
Recommended Label Prefixes
Standard Naming Convention
Label Naming Best Practices
Label naming tips:
- Use descriptive names:
fig:sales-growth not fig:1
- Keep it concise but meaningful
- Use hyphens for multi-word labels
- Be consistent throughout your document
Advanced Reference Commands
Page References
Equation References
The cleveref Package
Smart Automatic References
Customizing cleveref
Advanced cleveref Features
Hyperref Integration
Clickable References
Special Reference Types
Theorem Environments
Algorithm References
Cross-document References
External References with xr Package
Managing Large Documents
Best Practices
Cross-referencing best practices:
- Consistent labeling: Use standard prefixes and descriptive names
- Non-breaking spaces: Always use
~ before \ref{} commands
- Meaningful labels: Choose names that describe content, not position
- Compile multiple times: Run LaTeX twice to resolve all references
- Use cleveref: Automate reference types and formatting
- Check broken refs: Look for ”??” in output indicating unresolved references
- Hyperref last: Load hyperref before cleveref but after most other packages
- Backup strategy: Keep label conventions documented for large projects
Troubleshooting
Common cross-referencing issues:
- ”??” in output: Reference not found - check label spelling and compile twice
- Wrong reference numbers: Labels may have moved - recompile completely
- Missing hyperlinks: Ensure hyperref is loaded before cleveref
- Broken subfigure refs: Check subcaption package and label placement
- cleveref not working: Load after hyperref and other reference packages
- External refs failing: Ensure external documents compiled first
- Theorem refs wrong: Check theorem numbering and cleveref configuration
- PDF bookmarks broken: Check special characters in section titles
Advanced Tips
Conditional References
Custom Reference Macros
Quick Reference
Essential Commands
Compilation Order
Next: Learn about Package management to understand how to find, install, and use LaTeX packages effectively.