Admittedly a looooooong shot...

We're all taught that one of the prime objectives of typesetting is providing a uniform typeblock color (ie. the proportion of ink / no-ink on a page) as that is supposed to aid in reading and minimize distraction. That's the whole idea behind, for example, the microtype package

So I was thinking... why not take the definition of "color" a bit more textually: I'd like to change the color of a line depending on its tightness.

To put it another way: I'd like the actual color of the text to vary smoothly from pure 100% black for normal lines up to, say, 85% black for tight lines. This should be done automatically for every line in the typeblock (of course, we'd like to avoid abrupt changes in blackness, so a maximum of, say, 5% change in color should be enforced between consecutive lines).

I'm not sure this will be visually appealing, typographically sound or even doable, but felt like trying and stumbled on a brick wall... anyone care to share any ideas?

PDFLaTeX preferred, but non-exclusive.

  • 8
    If there was a {dont-do-this} tag, I'd apply it to this question right now even if I wasn't lockstep.
    – lockstep
    Dec 8, 2011 at 17:52
  • Yeah, kinda foresaw this would happen... yet, think about font expansion: it used to be a big no-no amongst some... I'm not saying this should be done (ample testing is needed), just asking how it could be :)
    – mpr
    Dec 8, 2011 at 18:02
  • @mpr: I removed the dont-do-this tag again; it has been proposed and declined on meta (meta.tex.stackexchange.com/questions/1201/do-not-do-this-tag), since meta-tags are generally to be avoided. I'm quite sure lockstep wasn't actually intending for this question to be tagged so.
    – doncherry
    Dec 8, 2011 at 19:54
  • Oops, sorry about that! Could you delete the tag I created too?
    – mpr
    Dec 8, 2011 at 19:58
  • @mpr: No problem, you only meant for the best. There's no need to delete the tag, the system will delete it automatically after a few days because there aren't any questions tagged with it.
    – doncherry
    Dec 8, 2011 at 20:34

1 Answer 1


No, it can't be done with pdflatex; it should be feasible with LuaTeX, but since the result might resemble the following picture, I'd scream with horror if I had to see a book printed in this fashion. :)

(Note: the first paragraph is just for comparison. I found the line breaks and then applied a different grayness to lines according to their looseness or tightness. It's a bit exaggerated, perhaps, but the sense should be clear.)

enter image description here

  • Perhaps this is "not an answer", but +1 anyway.
    – lockstep
    Dec 8, 2011 at 18:33
  • Hmmm... looks pretty ugly indeed :P Are those lines between 100% and 85% greyness? Maybe shorten the range, say 100--95%? Also... it looks as if the calculation is reversed: tight lines should be lighter ;) +1 indeed :)
    – mpr
    Dec 8, 2011 at 18:39
  • @mpr It would be ugly anyway. :)
    – egreg
    Dec 8, 2011 at 18:52
  • hahaha! I'm guessing it's just a matter of finding the right parameters (not trying to sound like a broken record here, but consider font expansion again... ugly indeed, except when you restrict it to 1--2%). Would you mind indulging me and posting the source to your answer? I'd like to play with this a little :)
    – mpr
    Dec 8, 2011 at 18:59
  • Thinking back on this... it could be used as a visual aid when editing: it would make tight/loose lines really stand out...
    – mpr
    Dec 8, 2011 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .