Discretionary break 2026-11-05
A discretionary break describes an optional line breaking choice whose printed material may depend on whether the break is selected. In TeX,
\discretionary{pre}{post}{none} supplies material before a chosen break, after it, or in the unbroken case.[ref]TeX source code by Donald E. Knuth. disc_node: pre_break, post_break and replacement material
For a purely mechanical example,
ab\discretionary{-}{X}{Y}cd can produce abYcd without the break, or ab- followed on the next line by Xcd when it is selected. The arbitrary strings make all three branches visible. A common hyphenation case simply inserts a hyphen before the break and supplies no material afterward.Each alternative has its own geometry. A typesetting box used only in the pre-break branch must contribute its width when that branch is tested. The natural line width, typesetting glue and typesetting penalty calculation must therefore use the selected representation. Treating the choice merely as an invisible marker could miss the width of the inserted hyphen.
Line adjustment ratio 2026-11-05
The line adjustment ratio measures the stretch or shrink required to make a candidate line fit. In the finite-glue model, let be its natural line width, its target typesetting line width, and and the total stretch and shrink coefficients of its typesetting glue. DefineIt is a dimensionless quantity: numerator and denominator are widths measured in the same units. Each glue item uses the same , scaled by its own appropriate coefficient.[ref]
Breaking paragraphs into lines by Donald E. Knuth and Michael F. Plass. pp.1125–1127: adjustment ratio and feasible stretching/shrinking
For , and , targets 32 and 28 give and respectively. If a nonzero width difference requires a coefficient total of zero, this model cannot make the adjustment. With ordinary bounded shrinkage, asks the glue to shrink beyond its total allowance and is infeasible. Positive stretch is usually limited by an acceptable-quality threshold rather than by treating as an absolute geometric limit.
The typesetting badness scores spacing quality from the required adjustment, while a line-breaking fitness class records a coarser category for comparison with neighbouring lines. Neither measure alone incorporates every typesetting penalty.
Text justification 2026-11-05
Text justification adjusts the contents of a line to occupy its available typesetting line width, often aligning both ends of the text. Changing word spacing is one method; permissible adjustments depend on the writing system. Typographic alignment more generally includes leaving the opposite edge ragged or centring a line.[ref]
CSS Text Module Level 3 by World Wide Web Consortium. §6: alignment versus justification; §6.4: script-sensitive expansion and compression
In an illustrative line with natural line width and target width , two equally flexible spaces can each gain 1. If their stretch coefficients are instead 1 and 3, proportional adjustment allocates the required extra 2 asBoth choices reach the same width; their internal spacing differs. Typesetting glue expresses that flexibility, and the line adjustment ratio computes the common proportional change.
Line breaking and text justification interact: a different break changes the number of spaces available to absorb the width difference. A good paragraph layout therefore considers spacing quality when choosing breaks, rather than merely stretching an already chosen set of lines. The Knuth-Plass line-breaking algorithm makes that interaction explicit.
Typographic alignment 2026-11-05
Typographic alignment places a line's content relative to its available horizontal space. Common choices align its left edge, align its right edge, centre it or apply text justification. In CSS,
text-align specifies alignment within the line's container, rather than positioning the entire container in the page.[ref]Text in Cascading Style Sheets Level 2 Revision 2 by World Wide Web Consortium. §16.2: alignment within line boxes and text-align values
For a rigid line with natural line width , no indentation, and a left boundary at , the starting positions areThus and give starts 0, 8 and 16. These three choices preserve the internal word spacing. Text justification can instead change that spacing through typesetting glue so the content reaches the intended edges. The alignments therefore solve different geometric tasks even when the same words and computer font are used.
Word spacing 2026-11-05
Word spacing is the separation between adjacent words in a line of text. Its nominal value comes from the computer font and layout settings; text justification can adjust it through typesetting glue. Letter spacing instead changes spacing within the text's sequence of letters. A script without visible word separators needs a different spacing strategy from an English sentence.[ref]
CSS Text Module Level 3 by World Wide Web Consortium. §§6.4 and 7.1–7.2: script-dependent justification and word/letter spacing
Suppose three typesetting boxes have widths 8, 6 and 10, and the two intervening spaces each have width 3. The natural line width isAdding 1 to each space gives width 32. Adding 1 to every glyph advance would generally produce a different layout, because there need not be one glyph per word or per stored character. Word spacing must therefore be applied to the intended separators rather than inferred from a count of glyphs.