Written and maintained by CASRAI Editorial Board
Last updated
Quick answer. Line spacing in LaTeX is set with the setspace package (\onehalfspacing, \doublespacing, \setstretch{value}). Horizontal gaps in text use \hspace{1cm} or the stretchable \hfill. Gaps inside equations use \,, \:, \;, \quad and \qquad, and \! removes a thin space. This page puts all four kinds of spacing in one decision table, then explains each.
It is written for researchers who typeset papers, theses or reports in LaTeX and need a specific gap, a journal-required line spacing, or a fix for an equation that looks cramped.
Which spacing command do I need?
| Task | Command | What it does |
|---|---|---|
| Whole-document line spacing | \usepackage{setspace} then \doublespacing or \onehalfspacing |
Sets the line spacing for the text that follows |
| Line spacing by an exact factor | \setstretch{1.25} |
Sets \baselinestretch and takes effect immediately |
| One section at a different spacing | \begin{spacing}{2.5} ... \end{spacing} |
Applies the factor inside the environment only |
| Fixed horizontal gap in text | \hspace{1cm} |
Inserts a horizontal space of exactly that length |
| Stretchable horizontal gap | \hfill |
Pushes the surrounding text apart to fill the line |
| Fixed vertical gap | \vspace{5mm} |
Inserts vertical space of that length |
| Small gap inside an equation | \, \: \; |
Thin, medium and thick math spaces |
| Large gap inside an equation | \quad \qquad |
One and two quads of space |
| Tighten an equation | \! |
Negative thin space |
Source: Overleaf documentation pages cited in the Sources section, read 2026-11-07.
How to modify line spacing in LaTeX
Load the setspace package in the preamble and choose a spacing command. According to the Overleaf documentation, \singlespacing, \onehalfspacing and \doublespacing can be used in the preamble or in the document body.
- Add
\usepackage{setspace}to the preamble. - Add
\doublespacing(or\onehalfspacing) after it to apply the spacing to the whole document, or place the command later in the body to change spacing from that point. - For a custom factor use
\setstretch{1.25}. - For a single block, wrap it:
\begin{spacing}{2.5} ... \end{spacing}.
LaTeX double spacing
Use \doublespacing. Single spacing in LaTeX is about 1.2 times the font size, and at an 11 pt font size double spacing corresponds to a \baselinestretch of about 1.618. That is why \setstretch{1.618} and \begin{spacing}{1.618} produce the same \baselineskip as \doublespacing.
setspace, linespread and the spacing environment
| Option | Use it for | Note |
|---|---|---|
\doublespacing, \onehalfspacing, \singlespacing |
Standard spacing presets | From setspace; usable in the preamble or the body |
\setstretch{value} |
A custom factor | From setspace; effective immediately |
\begin{spacing}{value} |
One block of text | From setspace; singlespace and singlespace* environments also exist, the starred one improving the spacing around lists and quotations |
\linespread{scale} |
Changing \baselineskip without changing the font size |
In the document body it needs a font-selection command to take effect |
The setspace package is on CTAN (version 6.7b, LPPL 1.3 license, checked 2026-11-07); its documentation is linked in the Sources section.
Horizontal spacing in LaTeX (hspace and friends)
LaTeX hspace
\hspace{1cm} inserts a fixed horizontal space, for example Left\hspace{1cm}Right. For a gap that stretches to fill the line, use \hfill: Left Side \hfill Right Side pushes the two parts to opposite margins. \hrulefill fills the gap with a rule and \dotfill with dots.
How do I add a blank character in LaTeX?
Inside running text, use \hspace{length} for a measured gap. Inside math mode, a backslash followed by a space gives a normal text-width space, and \quad and \qquad give wider ones (table below).
Vertical space
\vspace{5mm} adds a fixed vertical gap and \vfill a stretchable one. The presets \smallskip, \medskip and \bigskip are about 3 pt, 6 pt and 12 pt, with stretch of roughly 1, 2 and 4 pt.
Spacing in math mode
LaTeX sets the spaces around operators and relations automatically, so manual spacing is for exceptions. The manual commands:
| Command | Space | In math units (mu) |
|---|---|---|
\, |
3/18 of a quad | 3 mu |
\: |
4/18 of a quad | 4 mu |
\; |
5/18 of a quad | 5 mu |
\! |
minus 3/18 of a quad (negative) | -3 mu |
| backslash followed by a space | a normal text space | – |
\quad |
the current font size | 18 mu |
\qquad |
two quads | 36 mu |
Automatic spacing uses three lengths: \thinmuskip (3 mu), \medmuskip (4 mu) and \thickmuskip (5 mu). Relations such as = get thick space and binary operators such as + get medium space. To force that treatment on a symbol, wrap it in \mathrel{} or \mathbin{}.
What is \! in LaTeX?
It is a negative thin space: it moves the next item 3 mu to the left, cancelling the width of a \,. Use it to tighten a gap inside a formula.
What does \( do in LaTeX?
Nothing to do with spacing. \( opens inline math mode and \) closes it, an alternative to the dollar signs.
Troubleshooting
- Spacing change does nothing.
\renewcommand{\baselinestretch}{1.5}only takes effect after a font-changing command such as\selectfont.\setstretch{1.5}applies immediately, so prefer it. - Double spacing looks different from a factor of 2.
\doublespacingis calibrated to the font; at 11 pt the matching factor is about 1.618. - Lists and quotations look uneven in a spaced document. Use the starred
singlespace*environment, which improves the spacing arounditemizeandquote. - Equation looks cramped or too open. Add or remove
\,or\!, and see aligned equations in LaTeX and matrices in LaTeX for alignment problems.
Related layout guides: paragraph indentation in LaTeX and vertical lines in LaTeX. If a journal asks for a specific line spacing, see manuscript format for journal submission.
FAQ
How to modify line spacing in LaTeX?
Load setspace and use \onehalfspacing, \doublespacing or \setstretch{value}.
What is \!?
A negative thin math space of -3 mu.
How do I add a blank character in LaTeX?
\hspace{1cm} in text; \quad or \qquad in math.
What does \( do in LaTeX?
It starts inline math mode; it does not add space.
Sources
- Overleaf, Spacing in math mode (read 2026-11-07)
- Overleaf, Line breaks and blank spaces (read 2026-11-07)
- Overleaf, Paragraph formatting (read 2026-11-07)
- CTAN, setspace package and its documentation (read 2026-11-07)







