Skip to main content
In LaTeX, 1em is a font-relative horizontal unit equal to the current font’s quad width (\fontdimen6, roughly the nominal font size—10pt in 10pt Computer Modern), and 1ex is the current font’s x-height (\fontdimen5, roughly the height of a lowercase x—about 4.3pt in 10pt Computer Modern). Both units scale automatically when the font size changes, whereas fixed units such as pt, mm, cm, and in stay constant.

All 12 LaTeX measurement units

TeX defines nine absolute units (pt, bp, mm, cm, in, pc, dd, cc, sp) and three relative units (em, ex, mu). Note that en is not a valid TeX unit: writing \hspace{1en} fails with ! Illegal unit of measure (pt inserted).—use 0.5em instead.
units-table.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
Note the difference between pt (TeX point, 1/72.27 in) and bp (PostScript/PDF “big point”, 1/72 in, which CSS and design tools call pt). mu is valid only in math-mode glue and kern commands (such as \mkern, \mskip, and amsmath’s \mspace) and math-skip registers (\thinmuskip, \medmuskip, \thickmuskip); for math spacing commands such as \,, \:, \;, \quad, and \qquad, see Math operators and spacing.

How em and ex scale with font size

Because em and ex read the active font’s metrics, horizontal or vertical gaps written in em or ex grow in headings and shrink in footnotes, while cm, mm, or pt stay fixed:
em-ex-scaling.tex

Setting and modifying lengths (\newlength, \setlength, \addtolength)

LaTeX stores dimensions in named length registers. Use three built-in commands to create and update them:
  • \newlength{\mylen}: allocates a new length register initialized to 0pt.
  • \setlength{\mylen}{2cm}: assigns a fixed or relative length (including multiples of another length such as 0.5\textwidth).
  • \addtolength{\mylen}{-1cm}: adds a positive or negative offset to the current value.
You can inspect any length’s current value in pt by printing \the\textwidth (or another register name) in the document.

Common length registers and \textwidth vs \linewidth

Use \linewidth rather than \textwidth when sizing figures, rules, or boxes that might sit inside an indented list (itemize, enumerate, quote) or a two-column layout: inside itemize, \linewidth narrows to fit the indentation while \textwidth remains the full page text width. Inside a minipage, all three (\textwidth, \linewidth, \columnwidth) are set to the minipage’s width.
setlength-and-registers.tex

Rubber (stretchable) lengths

A rubber length (TeX glue) has a natural size plus optional plus stretch and minus shrink components, written as 4pt plus 2pt minus 1pt. TeX stretches or shrinks rubber lengths within those bounds to fill lines and balance page breaks—which is why article’s default \parskip is 0.0pt plus 1.0pt. For infinitely stretchable space that pushes content apart to the margins, use \fill (for example \hspace{\fill}, equivalent to \hfill) or \stretch{n} to divide leftover space proportionally:
rubber-lengths.tex

Try it in the editor

All core length registers and units work out of the box in LaTeX Cloud Studio’s TeX Live 2026 (full distribution) environment. Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with the complete example.