Jump to content

Knuth–Plass line-breaking algorithm

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by The Anome (talk | contribs) at 07:42, 30 March 2024 (more, with cite). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Knuth-Plass algorithm is a line-breaking algorithm designed for use in Donald Knuth's typesetting program TeX. It integrates the problems of text justification and hyphenation into a single algorithm by using a discrete dynamic programming method to minimize a loss function that attempts to describe the aesthetic qualities desired in the finished output.[1][2][3]

The algorithm works by dividing the text into a stream of three kinds of objects: boxes, which are non-resizable chunks of content, glue, which are flexible, resizeable elements, and penalties, which represent places where breaking is undersirable (or, if negative, desirable).[2]

References

  1. ^ "The Knuth/Plass line-breaking Algorithm". defoe.sourceforge.net. The Folio Project. Retrieved 2024-03-30.
  2. ^ a b Knuth, Donald E.; Plass, Michael. "Breaking Paragraphs into Lines" (PDF).
  3. ^ Jonathan, Fine (2000). "Line breaking and page breaking" (PDF). TUGboat.