Key concept: LaTeX uses different units for different purposes. Understanding when to use each unit type will help you create professional, consistent documents.Related topics: Single vs double-sided documents | Spacing | Headers & footers
LaTeX Units Overview
Absolute Units
Fixed measurements that don’t change based on font or context.Relative Units
Units that scale with font size or document context.Basic Length Usage
Setting Lengths
basic-lengths.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Measuring Existing Elements
measuring.tex
Practical Applications
Page Layout Dimensions
page-dimensions.tex
Font-Relative Spacing
font-relative.tex
Advanced Length Operations
Length Arithmetic
length-arithmetic.tex
Conditional Lengths
conditional-lengths.tex
Spacing Commands
Horizontal Spacing
horizontal-spacing.tex
Vertical Spacing
vertical-spacing.tex
Length Variables and Customization
Document-Wide Settings
document-settings.tex
Creating Length Commands
length-commands.tex
Math Mode Spacing
Math Units
math-spacing.tex
Units in Different Contexts
Tables and Figures
table-figure-units.tex
Custom Environments
custom-environments.tex
Best Practices
Common Patterns
best-practices.tex
Debugging Length Issues
Measuring and Displaying
debugging-lengths.tex
FAQ
When should I use em/ex vs pt/cm?
When should I use em/ex vs pt/cm?
Use relative units (
em, ex) when spacing should scale with the font (e.g., paragraph spacing, indents). Use absolute units (pt, cm) for fixed physical dimensions (e.g., margins, figure sizes).Why does spacing look different after changing font size?
Why does spacing look different after changing font size?
em and ex scale with the current font, so changes to font size affect spacing. For fixed spacing independent of font, use absolute units like pt or cm.How do I measure current lengths in my document?
How do I measure current lengths in my document?
Use
\the\length to print a value (e.g., \the\textwidth) and packages like layouts to visualize page geometry. See the Debugging section for examples.Best way to set margins?
Best way to set margins?
Use the
geometry package and specify margins in cm/mm for clarity. For responsive layouts, consider percentages of \paperwidth/\paperheight.Quick Reference
Essential Length Commands
Common Length Variables
Next: Learn about Headers and footers to customize page headers and footers, or explore Page numbering for advanced numbering schemes.
