When finalizing documents, one of the last things I do is usually to play with the page geometry to improve the overall layout: get rid of a few orphans or widows, reduce the number of hyphenations, etc.
I usually start by designing my documents with an acceptable or imposed/suggested page geometry, say
\usepackage[scale=0.75]{geometry}
but more often than not (if not always), I can actually replace that 0.75 (as an example) by anything in between 0.73 and 0.77 (because even when the page geometry is supposedly "mandatory", most people won't notice the difference...).
My process so far is however manual, tedious and quite subjective, basically trying out different scale options and picking the one most pleasing to my eye...
A better process would be to have TeX output a few typographical indicators or, better, a global "badness" indicator for the whole document, and then use a small script to optimize the scale factor based on this. So here are my few related questions:
a) Is it possible to have TeX output such typographic quality indicators such as:
- The number of widows,
- The number of orphans,
- The number of hyphens,
- The standard and maximum inter-word spacing,
- The number of lines with inter-word spacing greater than twice the standard value, and
- Any other relevant typographic quality indicator you believe is useful? (I am assuming cardinal sins like overfull boxes have been dealt with in all cases).
b) For widows, orphans, hyphens and similar relevant grave sins, would it be possible to modify TeX's output routine to identify where they happen? Either directly inside the document, as a Warning in the log, or both at choice (as happens for over- and under-full
hboxs).Is it possible to get TeX to output a global quality / badness indicator for the whole document? I know TeX works with a system of penalties internally; is it possible to output the penalty total for the whole document, and would that be an appropriate metric for my optimization desire?
(Note: the answer does not have to work on every engine; in particular, Lua code is perfectly acceptable as I guess the question draws to some of the stated objectives of luatex to "open up the internals of TeX")
wheretotrimshould identify as easy to 'fix' paragraphs in terms of reducing the overall length of the document. That is, these two goals overlap in many cases. – jon May 20 '13 at 19:25loosenessof paragraphs. – Andrew Swann May 21 '13 at 06:26\marginpar), for proofreading purposes, and it would be easy to add a counter so you know how many there are. For horizontal spacing, you will get "underfull \hbox" warnings. 2. I think it would be better to output a mean and/or a median level of badness, as well as the extremes. Otherwise, any long document will have a huge badness rate. – ienissei May 21 '13 at 14:42