Type setting is an art, and as most arts, it is extremely subjective. However, I will try to venture a few of my subjective opinions here as absolute truth (just because a bit of controversy is fun; feel free to disagree). Today we will look a bit at how interword spacing changes the feeling of a text, why margin protrusion makes things more even (and what margin protrusion is), as well as what font expansion is and why that helps as well. In particular, we will see how these things mean the difference of badly typeset text and nicely typeset text.

While most people I know who read this blog use LaTeX predominantly, most of us make acquaintance with the mainstream text tools, OpenOffice and Word. They create equally shoddy text (I guess it is their prerogative given that they are text processors rather than type setting programs, but it is still depressing). Still, looking at the output from one of these programs may serve as an (extremely good) motivating factor for considering LaTeX. The image below illustrates a standard text in OpenOffice, without hyphenation (with hyphenation did not change the result radically).

OpenOffice typesetting

Looking at the interword spaces on line three, we see that they're radically different from the spaces in the last line, for instance. This gives a very uneven reading and is not particularly nice looking at any rate. If we furthermore look down along the right margin, we see that, even though we have selected a justified text formatting, that the visual appearance of the text against the margin is not even. For instance, the ‘y’ and comma seem to be futher to the left than the ‘d’ and ‘r’. Furthermore, the fourth last line seem to be shorter than the others when you glance down along the right margin. This detracts from the aesthetic qualities of the text as well.

We are not going to be able to crank anything much more useful out of OpenOffice, so let us switch to our favourite typesetting language, LaTeX, and see how it looks there. This gives us what we can see in the following figure (margins adjusted to fit better with the OpenOffice defaults – normally margins are larger in LaTeX for better aesthetic value).

Basic LaTeX typesetting

This still gives us a somewhat jagged appearance in the right margin. What we want to do is to let some characters, in particularly punctuation, fall into the margin, causing more uniform lines to appear (visually, not mathematically). This is called character protrusion, or margin kerning.

Simple character protrusion

Pdftex 1.40 and newer supports two levels of character protrusion: level 1 that does not take line breaking into account, and level 2 that does. The details of this is easier to see if we are writing a two-column page. Below we see level 1 in the left column and level 2 in the right column. The interword spacing is clearly superior at level 2. In particular, this is illustrated in line 4 where there's a much larger space in the left column after the full stop.

Comparison of character protrusion levels 1 and 2

Looking at line 15 in the right column, we do, however, see that spacing is not entirely even, as there is a larger space after the full stop, at the text starting ‘At first I could not believe my’. These ‘artifacts’ happen when a proper line breaking cannot be made (breaking ‘eyes’ would be unnatural), and thus the line is padded with a bit of extra space, here after a full stop since we are more forgiving about extra spaces here as there is already some form of pause.

Some of the lines are spaced too tightly in my opinion in the right column above, example the line reading ‘my very feelings changed to repulsion and ter-’ is pushed too tightly together, particular the change from ‘feelings’ to ‘changed’ seem too close. As a way to improve the spacing we can turn on font expansion. What this feature does is to use a more narrow version of a font when there is little space, and a wider version of a font when there is ‘too much’ space. Since this change is, for the most part, automatically generated from the original font, great caution should be applied as it may distort the original font shapes, however, with the defaults, all this happens to a maximum of a three per cent change from the original shape, making it almost invisible to the naked eye. The results below are, however, fairly compelling. The left column is the same as the right column above, and the right column is with font expansion turned on at full level.

Full character protrusion and font expansion

This is miles from the look of OpenOffice that we saw at the beginning of this post. Indeed, returning to default margin size in full width, we can see the text typeset below with full character protrusion and font expansion.

Complete example

These things are, of course, just one among many of microtypographic finnesses that can be controlled in later versions of pdftex. What we have not looked at here is, of course, how you can use these things. Fortunately there is a nice package that wraps up a lot of these issues: microtype. Using it is exceptionally easy:


This will enable both character protrusion and font expansion. For more advanced manipulative changes, you can refer to microtype's documentation. (There is even a way to make it look like it was created in Word or OpenOffice!)