Closed louridas closed 9 years ago
Thanks for this. I remember there being something about the demerits calculation in the addendum for the reproduction of "Breaking Paragraphs into Lines" in the "Digital Typography" book. I'm going to look it up and check the correctness when I have some time.
Thanks, they were indeed incorrect. I've fixed it.
According to the TeX Book, p. 98, and Breaking Paragraphs into Lines, the demerits of a line with a penalty -10000 < penalty < 0 should be:
demerits = Math.pow(options.demerits.line + badness, 2) - Math.pow(node.penalty, 2);
instead of
demerits = Math.pow(options.demerits.line + badness - node.penalty, 2);
which is currently the case in:
https://github.com/bramstein/typeset/blob/master/src/linebreak.js#L168