Stage 2 · Text and documents 13 / 48 ≈ 17 min read

Line Breaks and Spacing in LaTeX: What Actually Works

A double backslash ends a line; a blank line ends a paragraph. Those are different operations with different visible results, and most spacing problems in a beginner document come from using the first when the second was meant. This lesson separates the two, lists the four places a forced break is the right tool, names the registers that own your vertical space, and gives the knobs that fix an overfull line without faking a break.

    Two operations that look alike: end the line, end the paragraph

    A blank line in your source is a \par: it closes the paragraph, so the vertical glue after it is \parskip plus a baseline distance, and the next line is treated as the first line of a new paragraph — which means it is indented by \parindent. \\ only stops the current line: the paragraph carries on, so the line after it is not indented, no \parskip is inserted, and the two lines sit one \baselineskip apart like any other pair of lines in the paragraph.

    The difference is visible in three places and nobody tells you where to look. In a document with \parindent on, the line after a blank line is indented and the line after \\ is not. In a document using the parskip package, the gap after a forced break is smaller than the gap between paragraphs — often much smaller, which is why \\ "does not work" in business letters. And the line ending in \\ is not justified: TeX stops it with an explicit break rather than letting the line-breaking algorithm choose, so the words are not spread to the right margin, and hyphenation is not considered at that point.

    Under the hood, \\ is \newline with optional arguments. The kernel also saves and restores the spacefactor across the break, which is the reason a sentence-ending full stop before \\ does not add the extra inter-sentence space you would get if the paragraph continued — a small piece of polish that hand-written TeX line breaking never got.

    Forced breaks are correct in exactly four places: between rows of a tabular or array, between lines of the multi-line maths environments (aligned, gathered, cases, matrix), inside center/flushleft/flushright blocks and the address-style material they exist for, and in poetry, where a line of verse is not a line of prose. Everywhere in ordinary running text, it is a symptom rather than a tool.

    \begin{array}{lll}\text{source} & \text{what it does} & \text{visible effect} \\\hline \texttt{double backslash} & \text{ends the line} & \text{no indent, no parskip} \\ \texttt{blank line} & \text{ends the paragraph} & \text{indent plus a gap} \\ \texttt{\textbackslash linebreak} & \text{asks for a break} & \text{line stays justified}\end{array}
    \begin{array}{lll}\text{source} & \text{what it does} & \text{visible effect} \\\hline \texttt{double backslash} & \text{ends the line} & \text{no indent, no parskip} \\ \texttt{blank line} & \text{ends the paragraph} & \text{indent plus a gap} \\ \texttt{\textbackslash linebreak} & \text{asks for a break} & \text{line stays justified}\end{array}
    Four visible differences between a forced line break and a paragraph break in LaTeX SOURCE ON THE LEFT, WHAT THE PAGE LOOKS LIKE ON THE RIGHT SAME PARAGRAPH: \ (A DOUBLE BACKSLASH) … the line ends here\\ and the next one starts without any new paragraph. not justified no indent on either following line; no \parskip glue anywhere; the page may still break between them NEW PARAGRAPH: A BLANK LINE ( = \par ) … the paragraph ends here % blank line and this one starts afresh. \parskip + one \baselineskip of glue \parindent on the first line only TeX is free to hyphenate to fill both lines DECIDING WHICH ONE YOU MEANT prose, continuing the argument prose, new idea rows of a tabular / array rows of aligned, cases, matrix an address block inside center blank line, never the backslash pair blank line double backslash is the only option double backslash, inside one maths object with one number double backslash — the block is not a paragraph of prose blank line blank line double backslash double backslash double backslash The right-hand column is a paragraph decision: it changes indent, glue and justification. The lower three are structural: the environment needs the break to mark where a row ends.
    A forced break stops a line; a paragraph break stops the paragraph and hands the next line to the indent and parskip rules.

    The optional argument, the star, and what a forced break costs

    \\[12pt] adds vertical space between the line being ended and the next one; \\* forbids a page break at that point, which is what keeps an address block or a couplet of verse from being split. Those two options are the whole reason to type \\ instead of \newline, which takes neither.

    The space argument has a documented weakness that bites at exactly the wrong moment: the glue it inserts is attached to the break, so if TeX decides to end the page there anyway, the space disappears with the page. The same is true of any vertical glue at the top of a page, which is why the star forms exist — \vspace*{20pt} survives where \vspace{20pt} is discarded. If a line of space is genuinely load-bearing (a signature block, a separated verse stanza), the robust tool is the needspace package's \needspace{5\baselineskip}, which pushes the whole block to the next page instead of gluing it in place.

    \linebreak[n] and \nolinebreak[n] are the polite versions: a number from 0 to 4 attaches a penalty to that break opportunity — the kernel's low, medium and high values are 51, 151 and 301, and 4 is a demand rather than a request. Because TeX still runs its optimiser, a \linebreak[3] line is justified to the margin and a hyphenation elsewhere in the paragraph may still win. \pagebreak[n] and \nopagebreak[n] do the same job at the page level; \nopagebreak written just after the last line of a list item is the cheapest way to keep that item from being cut in half.

    Two failures to avoid by construction. A \\ as the last thing before \end{tabular} adds an empty row — and with an optional argument, a row of pure space. And a \\ immediately before a displayed equation fights the class's own display skips: the \[ already starts a line of its own, so the forced break adds nothing but a ragged line and an unexpected gap.

    \begin{aligned} f(x) & = x^{2} + 2x && \text{row one} \\ & = (x+1)^{2} - 1 && \text{row two} \end{aligned}
    \begin{aligned} f(x) & = x^{2} + 2x && \text{row one} \\ & = (x+1)^{2} - 1 && \text{row two} \end{aligned}
    Inside aligned the double backslash is not a shortcut for a new paragraph: it ends a row of a single maths object, and the whole environment stays one equation with one number.

    How TeX reads the spaces you type

    Inside a line of source, a run of spaces, tabs and single line breaks collapses into one inter-word glue item: word + newline + word is identical to word word. That is why professional sources break every sentence onto its own line without changing the output by a point. A blank line is the exception, because it is not a space — it is \par.

    A % at the end of a line is the tool for removing a space rather than adding one: it turns everything to the end of that line into a comment, including the line break itself, so the next source line continues without any glue. You will need it in tabular cells that end with a command, after \item labels, anywhere a stray space becomes a visible gap, and in the middle of a \parbox where a paragraph break is fatal.

    To put a space where TeX would swallow one, type a control space \ — after a command name, whose trailing whitespace is eaten by definition, or when you want "50 cc" not "50cc". The tie ~ is the opposite instrument: a space that a line break may never use, correct in item~\ref{itm:psu}, Figure~3, 2.4~GHz. Explicit skips come next: \hspace{1em} (rigid unless you write plus and minus), \hfill (infinite stretch, the thing to use for pushing material apart), \kern (rigid and, unlike \hskip, not a place where a line may break), and the named widths \enspace, \quad, \qquad. One em is the current font size, so all of them scale with the size rungs of the previous lesson.

    Maths spacing is a separate system with its own, finer units: \,, \: and \; are the three mu-scaled gaps, \! removes one, and \mathsf{abc} versus abc differ by the automatic inter-attribute glue TeX inserts around operators and relations. Do not reach for \hspace inside a formula: \mathop, \mathbin and the spacing classes exist so that a formula keeps its spacing when it is shrunk into a subscript.

    How whitespace in a LaTeX source file maps onto the page: newline, blank line, percent sign and runs of spaces THE SOURCE FILE, WITH EVERY WHITESPACE DECISION MARKED 1 words on one line, then a 2 newline in the file. 3 (an empty line here) 4 A second paragraph. 5 It ends with a percent: and 6 this line is glued on tight. 7 Many spaces in a row 8 are one space to TeX. one newline = one space a blank line = \par a % hides the rest of the line, including its break runs of spaces collapse THE RESULT ON THE PAGE \parskip + \baselineskip of glue, then an indent lines 5 and 6 became one line of text: line 7 is set as it would be with single spaces — TeX never sees the rest THE THREE THAT ARE WORTH MEMORISING newline one space so break a paragraph anywhere you like blank line \par indent + paragraph glue, so never two in a row percent at the end nothing the space is gone; this is how you join lines One newline is a space and ten are also one space; only the empty line changes the paragraph, and % changes it back.
    Source whitespace mapped to output: single newline is a space, blank line is a paragraph, percent sign is a hole in the line.

    Vertical space: the registers, not your fingers

    Every gap in a LaTeX page is owned by a named register, and knowing the owner is how you fix spacing globally instead of line by line. Between lines of a paragraph: \baselineskip, with \lineskip taking over when two lines carry tall material. Between paragraphs: \parskip. Above and below a list: \topsep and \partopsep; inside it, \itemsep and \parsep. Between text and a displayed equation: \abovedisplayskip and \belowdisplayskip, or their short variants when the preceding line is short. Around floats: \floatsep, \textfloatsep, \intextsep. Below a caption: \abovecaptionskip.

    The three ready-made sizes — \smallskip, \medskip, \bigskip (and the \…skip vertical-mode equivalents) — are not fixed lengths but class-defined glue with stretch and shrink, so they behave correctly at a page break where a hard \vspace{1cm} does not. \vfill fills whatever is left of a page, which is what a title block or a signature line actually wants.

    A \vspace typed in the middle of a line does not push the rest of that line down: vertical glue only has meaning between lines, so either the space is added at the next line break you reach, or it is dropped. Write \par (or a blank line) before it, or use \\[space]. At the top of a page, plain \vspace is discarded outright and only \vspace* keeps its size.

    The legitimate structural uses are three: \enlargethispage{\baselineskip} (and its starred variant) to steal a line of space on one bad page, \needspace{n\baselineskip} to keep a block intact, and a class-level change to one of the registers above. Anything else — the \\ \\ pair, the empty ~\par, the \vspace before every subsection — is a local patch on a global problem, and it will resurface the moment the text reflows.

    \begin{array}{ll}\text{line to line} & \texttt{baselineskip} \\ \text{paragraph to paragraph} & \texttt{parskip} \\ \text{list above and below} & \texttt{topsep} \\ \text{text to equation} & \texttt{abovedisplayskip}\end{array}
    \begin{array}{ll}\text{line to line} & \texttt{baselineskip} \\ \text{paragraph to paragraph} & \texttt{parskip} \\ \text{list above and below} & \texttt{topsep} \\ \text{text to equation} & \texttt{abovedisplayskip}\end{array}
    Horizontal and vertical space commands in LaTeX compared: what each one is, whether it stretches, and which mode it is legal in HORIZONTAL SPACE — INSIDE A LINE COMMAND WHAT IT ADDS STRETCHES? CAN A LINE BREAK THERE? a space or one newline one inter-word glue yes yes backslash + space a space TeX cannot swallow yes yes ~ (the tie) a space that must stay yes no — that is the point \hspace{1em} rigid unless you write plus= only if you add it yes \hfill infinite stretch always yes \kern 6pt rigid shift, TeX primitive no no — use \hskip for that \quad \qquad \enspace 1 em, 2 em, half an em a little yes VERTICAL SPACE — BETWEEN LINES AND PAGES COMMAND / REGISTER WHAT IT SEPARATES SURVIVES A PAGE BREAK? MODE IT NEEDS \baselineskip two lines of one paragraph it is the page grid automatic \parskip two paragraphs yes, it is glue automatic at \par \vspace{12pt} anything you ask it to no — discarded at the top vertical mode \vspace*{12pt} the same, forced yes vertical mode \[12pt] after a break the next line, in one line pair no — it rides on the break horizontal
    Horizontal tools on the left, vertical ones on the right, with the mode each one is legal in.

    Overfull and underfull lines, and the knobs that fix them

    TeX breaks lines by minimising a cost function: badness measures how far the glue had to stretch or shrink, demerits punish bad sequences, hyphenation has a price of its own. An Overfull \hbox in the log means the cheapest solution it found still exceeded the measure by more than \hfuzz, so the line sticks into the margin; an Underfull \hbox means the line was stretched to fill and looks spaced out. Both are messages about your text, not about the compiler.

    The ordered list of fixes: reword the sentence; let TeX hyphenate where it is allowed to (\hyphenpenalty and \exhyphenpenalty raise or lower the price, \doublehyphendemerits and \finalhyphendemerits stop runs of hyphens and a hyphen on the last line); give the optimiser a last-resort escape with \setlength{\emergencystretch}{1em}, which is applied only after normal stretching fails and therefore does not loosen the whole document; widen or break the offending material yourself; and only then reach for \sloppy or a sloppypar environment, which loosens \tolerance and friends and will happily produce ugly lines to avoid the warning.

    Long unbreakable tokens are a different problem with a different fix: a URL, a file path or a camel-case identifier cannot be hyphenated at all. \url{...} and \path{...} from hyperref or url break them at sensible characters (xurl breaks them anywhere), and \allowbreak or a discretionary \- handles a single stubborn word. To see the hyphenation TeX has chosen, ask in the log: \showhyphens{supernumerary} prints it; \hyphenation{pe-diat-ric} adds exceptions per document rather than patching individual words with \-.

    One package fixes more of these than all the knobs together: \usepackage{microtype} adds protrusion (round letters and punctuation hang a hair past the margin, so lines have more slack) and, under pdfLaTeX or LuaLaTeX, font expansion (a glyph set at 99.5% width). Load it last, look at the pages, and only then decide whether a specific line still deserves a reword.

    \documentclass[10pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{array}
    \usepackage{amsmath}
    
    \begin{document}
    
    % ---- the three legitimate uses of an explicit line break ----
    \begin{tabular}{@{}ll@{}}
      Row one, cell one & Row one, cell two \\
      Row two           & still the same environment \\[4pt]
      A gap paid for by the row, not by an empty row
    \end{tabular}
    
    \begin{equation}
      \begin{aligned}
        (a+b)^{2} &= a^{2} + 2ab + b^{2} \\
                  &= (a-b)^{2} + 4ab
      \end{aligned}
    \end{equation}
    
    % ---- hyphenation you control instead of space you fake ----
    The word supernumerary is long, and a discretionary hyphen can be placed by
    hand: super\-nu\-mer\-ary. To see what TeX would have chosen anyway, ask it
    in the log with \verb|\showhyphens{supernumerary}|.
    
    % ---- two spaces in the source are exactly one space on the page ----
    Two   spaces      and          a   newline
    all collapse into one inter-word glue, and a blank line here ends the
    paragraph.
    
    % ---- the comment character eats the line break, so it eats the space ----
    This line ends with a percent sign and therefore joins the next one with
    no space at all:%
    this word follows immediately.
    
    \end{document}

    Paragraph style is one decision, made once

    There are two ways to separate paragraphs and every document picks one: indent the first line and give the paragraph no extra space (\parindent on, \parskip zero — the default of the standard classes), or don't indent and put a real gap between paragraphs (the reverse). Mixing them is what produces the "nothing lines up" look of a first LaTeX document, because the class's headings, lists and captions were all tuned for the one it ships with.

    For the second style, load the parskip package rather than setting the length by hand: it gives \parskip a stretch component, zeroes \parindent, and re-tunes the list parameters so that the space between items does not double up. KOMA-script classes make the same choice an option — parskip=full, parskip=half, parskip=parindent — and half is the typographically careful one, because it uses half a baseline distance instead of a full line, which keeps justified text from looking like a rail schedule.

    The class also suppresses the indent of the first paragraph after a heading, through its own \@afterheading machinery. That is why \noindent directly under a \section appears to do nothing, and why Americans-style documents that want every paragraph indented load indentfirst. An explicit \indent at the start of a line is the way to force one glyph of indent where the class decided not to.

    Two habits follow from making the decision once. Do not open a paragraph with \hspace{1cm} or a run of typed spaces — the indent is a length owned by the class. And do not fake a bigger gap between two paragraphs with a spare \parskip-sized empty line: if the gap is structural, it is a heading or a list; if it is typographic, it belongs in the register.

    \documentclass[12pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{parskip}       % blank-line paragraphs: no indent, real gap
    \usepackage{enumitem}
    \usepackage{needspace}
    
    \setlength{\emergencystretch}{2em}  % last-resort stretching, not first resort
    \hyphenpenalty=150                % make hyphenation a bit more attractive
    \tolerance=1500                   % before emergency stretch is tried
    
    \begin{document}
    
    \section{Space that is not yours to add}
    
    % Wrong, and silent: vertical glue placed in the middle of a line.
    This paragraph tries \vspace{20pt} to push its own second half down the page
    and achieves nothing, because the glue is only obeyed between lines.
    
    \medskip
    \needspace{6\baselineskip}
    A short block that must not be split by a page break: \verb|needspace| asks
    for six lines of room right here and starts a new page if they are not
    available. It is the honest version of the six backslash-backslash pairs
    people type instead.
    
    \section*{And space that the class already owns}
    
    \begin{itemize}[noitemsep,topsep=6pt]
      \item \texttt{parskip} turned the vertical gap between paragraphs on and
            took the indentation off; that is one decision, made once.
      \item It also re-tuned the list parameters, which is why these two items
            sit closer together than the two paragraphs above.
    \end{itemize}
    
    \end{document}

    Reading the page back: what to check when the spacing is wrong

    Work outside-in. First, is the whole document wrong or is one line wrong? Whole-document problems are register problems: \parskip, \baselineskip (that is, \linespread{factor}\selectfont or \setstretch), the list parameters, the display skips — all set in the preamble or by a package, never by hand. One-line problems are content problems: a long word, a missing hyphenation point, a URL, a math run that has to be broken with \linebreak rather than \\.

    Second, read the log for Overfull and Underfull in the order they appear, since a forced break early on changes the line-breaking of everything downstream of it on the page. The log prints the offending material between | bars so you can find it, and the quickest diagnosis of all is to compile once with the draft class option: it draws a black rule through every overfull line and replaces graphics with placeholder boxes, so the page itself points at the problem.

    Third, remember the default vertical mode of the standard classes: article ends pages ragged, while report and book stretch the text of a short page so that the last baseline lands at the same height on every page. If a chapter's last page has suspiciously airy spacing, that is \flushbottom at work, and \raggedbottom is the switch — a page-layout decision, not a spacing bug, and the subject of the next lesson.

    The three listings on this page are the whole toolkit in source form: the first contrasts paragraph and forced breaks line by line, the second shows what a package-owned paragraph style looks like together with needspace and emergency stretch, and the third is the short catalogue of legitimate uses — a table row, an aligned derivation, a hand-placed hyphenation, a collapsed run of spaces and a percent sign that removes a break.

    a\,b \quad a\:b \quad a\;b \quad a\quad b \quad a\qquad b \quad a\!b
    a\,b \quad a\:b \quad a\;b \quad a\quad b \quad a\qquad b \quad a\!b
    \documentclass[11pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{amsmath}
    \usepackage{microtype}
    
    \begin{document}
    
    % ---- 1. Two paragraphs: what a blank line buys you -----------------
    This is the first paragraph. It continues across source lines because a
    single newline in the file is just another space to TeX.
    
    And this is the second: the blank line above became \par, so this line is
    indented by \parindent and separated from the paragraph above by \parskip.
    
    % ---- 2. Forced breaks: same paragraph, two lines -------------------
    \begin{center}
      A. Student\\
      Room 214, Faculty of Mathematics\\[6pt]
      a.tudent@example.edu
    \end{center}
    
    % ---- 3. Where \\ is a bug ------------------------------------------
    Never write a double backslash to split a paragraph like this, because
    the line ends ragged, no indentation or paragraph glue appears, and the
    sentence after the break is still the same paragraph.
    
    % ---- 4. A \\ next to display maths is never needed -----------------
    The wave equation is written as
    \[
      \frac{\partial^{2} u}{\partial t^{2}} = c^{2}\nabla^{2} u
    \]
    and the display already starts and ends on its own line, so putting a
    forced break before the \verb|\[| only fights the class's display skips.
    
    % ---- 5. Asking instead of forcing ----------------------------------
    This sentence is long enough that TeX would happily hyphenate something in
    it, but here \linebreak I ask for a break at this exact place and the line is
    still stretched to the right margin, which is what a forced break would have
    cost me.
    
    \end{document}

    Lesson cheat sheet

    One key line of code from each section — jump to it or copy it straight from here.

    Section Key code
    \begin{array}{lll}\text{source} & \text{what it does} & \text{visible effect} \\\hline \texttt{double backslash} & \text{ends the line} & \text{no indent, no parskip} \\ \texttt{blank line} & \text{ends the paragraph} & \text{indent plus a gap} \\ \texttt{\textbackslash linebreak} & \text{asks for a break} & \text{line stays justified}\end{array}
    \begin{aligned} f(x) & = x^{2} + 2x && \text{row one} \\ & = (x+1)^{2} - 1 && \text{row two} \end{aligned}
    \begin{array}{ll}\text{line to line} & \texttt{baselineskip} \\ \text{paragraph to paragraph} & \texttt{parskip} \\ \text{list above and below} & \texttt{topsep} \\ \text{text to equation} & \texttt{abovedisplayskip}\end{array}
    \documentclass[10pt]{article}
    \documentclass[12pt]{article}
    \documentclass[11pt]{article}

    Common mistakes

    • Separating paragraphs with \\. You get no indent, no paragraph glue and a ragged line; the blank line or \par is the paragraph separator.
    • \\[20pt] to push an equation or a table down the page. The space is glued to the break, so it silently vanishes when the page breaks there — and the real problem is usually a block that wants \needspace or a float.
    • \\ as the last row of a tabular: it adds an empty row, and with an optional argument it adds a row of nothing but space.
    • Forgetting that % also removes the line break. A percent sign at the end of a line inside a table cell or a \parbox is usually a fix; a percent sign in the middle of a line has just commented out the rest of your code.
    • Trying to add vertical space in the middle of a line with \vspace: vertical glue only counts between lines, so end the paragraph first (\par) or use \\[space].
    • \sloppy as a global fix for overfull boxes. It removes the warning by letting lines stretch arbitrarily; \setlength{\emergencystretch}{1em} targets the same problem without touching the rest of the document.
    • Using \linebreak and \\ as synonyms: the first is a penalty that keeps the line justified and lets TeX hyphenate elsewhere, the second is a command that ends the line ragged.

    Questions about this lesson

    What is the difference between a blank line and double backslash in LaTeX?
    A blank line is \par: it closes the paragraph, so the next line gets the paragraph indent and the gap \parskip puts between paragraphs. \ ends only the current line, so the paragraph continues: no indent, no paragraph glue, and the finished line is not justified. Use \ inside tables, aligned maths, centre blocks and verse; use a blank line between prose paragraphs.
    How do I force a line break without starting a new paragraph?
    Type \ at the point where the line should end, or \newline if you do not need the optional space or star arguments. If the text is justified and you want the break to look natural, prefer \linebreak[4], which asks TeX to break there while still spreading the line to the right margin.
    How do I add space between paragraphs in LaTeX?
    Do not add it per paragraph. Either set the style once — the parskip package, or parskip=half on a KOMA-script class — or accept the class default and use a heading or a list where a visual break is really needed. A \vspace typed between two paragraphs works until the text reflows and then looks wrong on a different page.
    Why does LaTeX ignore the spaces I typed?
    Because runs of spaces, tabs and single line breaks in the source all collapse to one inter-word space, and a command name eats the whitespace after it. To force one space, type \ (control space); to keep two words on the same line, join them with ~ (a tie); to remove the space a line break would leave, end the line with %.
    How do I fix an overfull hbox warning in LaTeX?
    In order: reword the sentence, allow hyphenation (\hyphenpenalty, or a discretionary \- where you want it), give TeX a last-resort \setlength{\emergencystretch}{1em}, break the long material by hand, and only then use \sloppy or a sloppypar environment. For URLs and file names, \url{} from hyperref is the fix, not more glue.
    Why is there no space after my section heading? / why is my page stretched out?
    Two different defaults. The standard classes put \parskip-sized space nowhere near headings — the heading owns its own \above and \below skips, which is a layout decision rather than a bug. A page whose lines are unusually far apart is a report or book class using \flushbottom, which stretches the last page of a chapter to full height; \raggedbottom turns that off.

    Live playground: edit the LaTeX, see it render

    The preview updates as you type — break it on purpose to see how errors look.

    KaTeX error
    Try an example

    Keep reading

    Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.