Soft hyphens and no-break spaces

A justified column set twice: the long words breaking at their soft hyphens with a hyphen shown, or left whole, and a figure a no-break space keeps together.

A narrow justified column goes loose as soon as its words are long: the spaces stretch, and channels of white run down the page. The cure is to say inside the text itself where a word may break. This page sets the same paragraph twice — above without those break marks, below with them — so the breaking is the only difference.

A soft hyphen is invisible until it is used, and draws a hyphen only on the line that breaks there. Its opposite is on the page too: a no-break space inside the figure 1 200 EUR, which keeps the number and its currency on one line however narrow the column gets.

What this example shows

  • Soft hyphens honoured, and a hyphen drawn only where a break happens.
  • A no-break space holding a figure and its unit together.
  • Both settings of the same paragraph, one above the other.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The same document is written in each of these languages. Open the one you want to look at.

Open the document in English Open the document in French

Read the Rust source Read the Python source

First page of Soft hyphens and no-break spaces

What this document weighs

Before 109,923 bytes
Now 39,394 bytes
Saved 64.2 %

Not one mark on the page changed. See every document measured.

Examples near this one

Break points after a slash or a hyphen

A justified column set twice: file paths and compounds running past the edge with no break points, then wrapping where a break after a slash or a hyphen is allowed.

Text poured into columns

One long passage poured into three columns, each fitting the lines its height allows and handing the rest to the next.

Every example, by subject