Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up

Units of measurement in LaTeX

All spacing commands in LaTeX (\vspace, \hspace, \setlength, etc.) accept a length with a unit. There are absolute units (fixed size) and relative units (that adapt to the font).

Absolute units

Absolute units have a fixed size, independent of the font or context.

UnitNameValueCommon usage
cmCentimètre1 cmMarges, espacements
mmMillimètre0.1 cmAjustements fins
inPouce (inch)2.54 cmFormat US
ptPoint typographique0.351 mmTaille de police, filets
bpBig point (PostScript)0.353 mmImages, PDF
pcPica12 pt = 4.218 mmTypographie classique

Font-relative units

Relative units adapt to the current font size. They are preferable for documents that stay harmonious when you change the font size.

UnitDefinitionAt 12ptCommon usage
emLargeur du « M »~12ptIndentation, espacements de texte
exHauteur du « x »~5ptAjustements verticaux fins
mu1/18 em (maths)~0.67ptEspacement en mode mathématique

LaTeX elastic lengths

LaTeX defines predefined lengths that adapt to the document context. They are very useful for proportional spacing.

LengthDescription
\textwidthLargeur de la zone de texte
\linewidthLargeur de la ligne courante
\columnsepEspace entre colonnes
\parindentIndentation de paragraphe
\parskipEspace entre paragraphes
\baselineskipEspace entre lignes de base

Practical examples

LaTeX
% Espacement en différentes unités
\hspace{1cm} 1 centimètre

\hspace{10mm} 10 millimètres (= 1cm)

\hspace{1em} 1 em (relatif à la police)

\hspace{72pt} 72 points (= 1 pouce)

% Image à 80% de la largeur du texte
% \includegraphics[width=0.8\textwidth]{image.png}

% Filet horizontal
\rule{\textwidth}{0.4pt}  % trait fin sur toute la largeur

% Espace vertical de 2 fois la hauteur d'un x
\vspace{2ex}
Tip: em vs cm Prefer em and ex for text-related spacing (indentation, inner margins). Use cm and mm for fixed dimensions (page margins, image sizes). This way your document stays proportional if you change the font size.

Test your knowledge

3 questions to check what you have learned.

1

Among these, which is a valid LaTeX length?

A length is written as number + unit together, e.g. 2cm. The full unit name or a bare number without unit causes an error.

2

Which unit adapts to the current font size?

em (width of "M") and ex (height of "x") are font-relative. cm and pt are absolute, fixed-size units.

3

How do you make an image equal to 80% of the text width?

You multiply the elastic length \textwidth by a factor: 0.8\textwidth. The percent sign % is not a LaTeX unit and \pagewidth does not exist.

Try it in Sarmate

Edit, compile and download your LaTeX documents directly in your browser.

Open the editor