Changing Style in the Middle of a Paragraph

Most text in a real document is not one style from end to end. A sentence has a bold term, a total is underlined, a footnote marker is smaller than the words around it. The usual workaround is to cut the sentence into pieces and place each one after the last — which holds until the text is translated and the pieces no longer add up to the same width.

Here the sentence stays one sentence and changes style inside itself, so it can be translated without anybody putting the pieces back in order. A line grows as tall as the tallest thing standing on it, so a big word in a small paragraph opens up its own line and leaves the others alone. And an underline drawn at a fixed distance below the words cuts through the tails of the g and the p in one font and floats miles below them in the next, so here each one is placed where that font says its own underline belongs. Below it the page goes further: a heading left hollow, or thickened without switching to a bold font; an underline set heavy and clear of the tails, and a hairline struck through the letters; a long web address broken after each slash, and cut mid-word only where nothing else fits; and a paragraph centred both across and down in the box around it, with its size measured and printed under it.

What This Example Shows

  • Size, colour and underline changing inside one sentence.
  • A line growing as tall as the tallest word standing on it.
  • Underlines placed where the font itself says they belong.

The Source Code, Complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.

Read the Rust source Read the Python source Read the JSON source

The Document Itself

Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese

Changing Style in the Middle of a Paragraph, first page

The Same Document in Other Languages

This document weighs 18.5 kB

Examples Near This One

Breaking an Overlong Word

A word longer than the column that holds it: the library leaves it whole, cuts it at the column's edge, or cuts it and closes the line on a hyphen.

Break Points After a Slash or a Hyphen

A justified column set four times: file paths and compounds running past the edge with no break points, wrapping where a break after a slash or a hyphen is allowed, then wherever their punctuation allows one, and last with no-break hyphens that keep each compound whole.

A Stack Laid out by Hand, One Box at a Time

A delivery slip poured into two boxes, the second taking up where the first stopped, and a poster whose picture no box can hold, each box saying what became of the stack in it.

Every example, by subject