3 ms·
I wish there were also other attempts to create a paragraph breaking algorithms. For example one, which limits the total amount of white space on a line. Becaus
by pgtan 8y ago
I wish there were also other attempts to create a paragraph breaking algorithms. For example one, which limits the total amount of white space on a line. Because, if you have a line with many short words on it, and all the glue is max stretched even not exceeding the allowed value, the line looks nevertheless somewhat holey.
- svat 8y agoAvoiding “holey” lines is in fact is what the Knuth-Plass algorithm tries to do, and in general it results in “tighter” (less whitespace) paragraphs than alternative algorithms (those that look at only one line at a time). If you'd like even less space, you can just set a smaller “ideal” width of a space — if you have an example of a paragraph (and font, and line width) for which you think the spacing is not optimal, I can show you what I mean.
- tropo 8y agoAn example of a paragraph (and font, and line width) for which the spacing is not optimal is trivial: anything done with the Knuth-Plass line-wrapping algorithm. The trouble here isn't just the design of the algorithm. The specification itself is bad. The moment you start to mess with the kerning (spacing, both between letters and otherwise) specified by the font designer, you've gone wrong. The font ships with correct kerning. That kerning is what the font designed determined would look best and be most readable. Regular letter spacing also helps with readability. Hyphens are also trouble for readability.
- svat 8y agoPerhaps you, and the person I was replying to, are talking about different things. The Knuth–Plass algorithm does not mess with the kerning specified by the font designer. In fact, despite some demand, Knuth never added a feature of letter-spacing into TeX, because all the typographers he spoke to agreed it was a bad idea. (It is now possible to do that, with hacks and with other engines like pdfTeX/XeTeX/LuaTeX, but in any case that's not relevant to the Knuth-Plass algorithm being discussed.) What the Knuth-Plass algorithm is concerned with is merely where to choose line breaks. For justified paragraphs (as in any competently typeset book you can pick up), the space between words necessarily varies from line to line (barring some staggering coincidence). What the algorithm tries to do is break lines such that this inter-word space is as close as possible to the ideal specified in the font (and to minimize the amount of hyphenation required), and at this it does a better job than other algorithms (those that look at only one line at a time). See Figure 4 in the paper: http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf#page=12 http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf#pag... (page 1130, the 12th page in the PDF).
- burfog 8y agoJustified paragraphs are never justified. Proper typesetting has zero hyphenation and always obeys the inter-word space specified by the font designer.
- svat 8y agoThat's an interesting opinion, stated like a fact. :-) I have three responses to that: 1. The opinion is certainly a radical one, i.e. at odds with almost every typographer. Walk into a library and pick up a random book or magazine (by a good publisher), and you'll almost surely find justified paragraphs. It's only some self-published books or typewriter / computer printouts that tend not to justify. It is an interesting exercise to try to find a physical book (that you have access to) that contains non-justified paragraphs — I looked at 65 books at home (that have paragraphs) and all of them (across multiple languages) use justification. (In the poetry books I had to look at the preface...) I checked previews online of some books by typographers and font designers, and (of course) they also contain justified paragraphs: Robert Bringhurst's The Elements of Typographic Style, etc. I am aware of Eric Gill's An Essay on Typography that is not, and contains a section called ”The Procrustean Bed”, and that's about it. 2. The problem being solved, for which the algorithms are being compared, is how to generate justified paragraphs. The top-level comment (by pgtan@) that started this thread, was also about justified paragraphs (that's what I was pointing out in the comment you replied to). As an analogy, when discussing algorithms for the traveling salesman problem, one can reject the problem by declaring that sales must be done online, which... seems somewhat a change of topic. 3. Even if what you want is non-justified (ragged-right) paragraphs, you still need to choose line breaks. The choice is not always unique. The Knuth–Plass algorithm covers this case too (with the right choice of penalties and glue), and has something to offer here too. It's in the paper :-) http://eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf http://eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf (Search for "ragged")