29

In the TeXbook, Knuth notes that italics can lead to problems with justification:

EXERCISE 14.16
When an entire paragraph is typeset in italic or slanted type, it sometimes appears to be offset on the page with respect to other paragraphs. Explain how you could use \leftskip and \rightskip to shift all lines of a paragraph left by 1pt.

The following text shows that one can even get fluttering margins:

\documentclass{article}
\textwidth=3.85cm
\begin{document}
\it\noindent
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}

The effect is a bit overemphazised by the small \textwidth, but the compilation doesn't show any overfull hboxes. In particular the left margin looks awful in my opinion.

Is there any way to overcome this problem in TeX? I'd prefer a LaTeX answer, but in the end I'm open to any TeX version.

I know that this is actually a font problem; and it happens due to the way the CM italic font is designed. (In fact I have already asked and answered a few questions concerning problems with italics.) Is there an italic font where the problem is less prominent or even non-existent?

6
  • 1
    and why don't you use package microtype?
    – user2478
    Feb 2, 2011 at 13:22
  • @Herbert: OK, at close inspection I see that indeed this helps a bit, thanks. But it doesn't make the problem go away. Feb 2, 2011 at 13:32
  • Yes, microtype is the way to go in this case. You should IMO put this as an answer, Herbert.
    – topskip
    Feb 2, 2011 at 13:34
  • Hendrik: you probably need to set the lpcode and the efcode of the glyphs.
    – topskip
    Feb 2, 2011 at 13:35
  • @Patrick: At the time of your comment, I had no idea what you're talking about. Now I looked at mt-cmr.def: Do you mean the A = {50,50} stuff in \SetProtrusion? (And can you explain why the values for cmr-it are chosen in such a way that you still have heavy flutter?) Feb 2, 2011 at 16:36

3 Answers 3

20

With version 2.5 of the microtype package, available on CTAN since 13 March 2013, the simple answer to my question is "use microtype".


Thanks, Herbert and Joseph, for telling me that this can be done with the microtype package. I did know that microtype can do margin kerning, but I had always thought that this is only about punctuation. In reality, one can adjust the margin kerning for every single letter.

What I had been wondering: Why is the output in Herbert's and Joseph's answer a bit better, but still far from good? The answer, of course, is that the margin kerning table provided by microtype just isn't good enough. So I went ahead and went through all the letters ... The output now looks as follows, and I'm quite happy with it:

Here's the code, which essentially consists of the adjusted margin kerning table (that has now been added to the microtype package):

\documentclass{article}
\textwidth=3.85cm
\usepackage{microtype}
\LoadMicrotypeFile{cmr}
\SetProtrusion
   [ name     = cmr-it   ]
   { }
   {
     A = {100,100},
     B = {83,-40},
     C = {165,-75},
     D = {75, -28},
     E = {80,-55},
     F = {85,-80},
     G = {153,-15},
     H = {73,-60},
     I = {140,-120},
     J = {135,-80},
     K = {70,-30},
     L = {87, 40},
     M = {67,-45},
     N = {75,-55},
     O = {150,-30},
     P = {82,-50},
     Q = {150,-30},
     R = {75, 15},
     S = {90,-65},
     $ = {100,-20},
     T = {220,-85},
     U = {230,-55},
     V = {260,-60},
     W = {185,-55},
     X = {70,-30},
     Y = {250,-60},
     Z = {90,-60},
     a = {150,-10},
     b = {170,   },
     c = {173,-10},
     d = {150,-55},
     e = {180, },
     f = { ,-250},
     g = {150,-10},
     h = {100, },
     i = {210, },
     j = { ,-40},
     k = {110,-50},
     l = {240,-110},
     m = {80, },
     n = {115, },
     o = {155, },
     p = { , },
     q = {170,-40},
     r = {155,-40},
     s = {130, },
     t = {230,-10},
     u = {120, },
     v = {140,-25},
     w = {98,-20},
     x = {65,-40},
     y = {130,-20},
     z = {110,-80},
     0 = {170,-85},
     1 = {230,110},
     2 = {130,-70},
     3 = {140,-70},
     4 = {130,80},
     5 = {160, },
     6 = {175,-30},
     7 = {250,-150},
     8 = {130,-40},
     9 = {155,-80},
     . = { ,500},
    {,}= { ,450},
     : = { ,300},
     ; = { ,300},
     & = {130,30},
    \% = {180,50},
     * = {380,20},
     + = {180,200},
     @ = {180,10},
     ~ = {200,150},
     ( = {300, },    ) = {  ,70},
     / = {100,100},
     - = {500,300},
     \textendash       = {500,300},   \textemdash        = {400,170},
     \textquoteleft    = {800,200},   \textquoteright    = {800,-20},
     \textquotedblleft = {540,100},   \textquotedblright = {500,100}
   }

\begin{document}
\noindent\itshape
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}
3
  • 4
    If you think that your values are better and should be added to microtype: Send them the author of microtype. Feb 19, 2011 at 15:00
  • 2
    @Ulrike: Thanks, I'll do that. (I'm not a professional typesetter, so I'm not sure if it's good, but I'm pretty sure that it's better than before.) Feb 19, 2011 at 16:13
  • 1
    @Ulrike: With the help of Robert Schlicht, I further improved the values (actually more than a year ago ...); the updated package has been available on tlcontrib for some time now. Jul 18, 2012 at 18:51
17

microtype has an optional argument that you can allow to shift the characters more to the right, e.g. [factor=1300]

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern,picture}
\usepackage{microtype}
\textwidth=3.85cm
\begin{document}
\itshape\noindent\makebox(0,0){\put(\textwidth,-2cm){\line(0,-1){80}}}%
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}

enter image description here

and here the output with optional arguments [factor=1100,stretch=80] for microtype

enter image description here

8
  • @Herbert: Thanks. The right margin is a lot better, but I'm more concerned about the left margin. By the way, what optional argument do you mean? In your code there is none. Feb 2, 2011 at 13:46
  • @Hendrik: I meant, you can increase it, see edited answer. The default of factor is 1000
    – user2478
    Feb 2, 2011 at 13:48
  • @Herbert: Is this factor only about hanging punctuation? There the standard seems OK. Feb 2, 2011 at 13:57
  • @Hendrik: it is for the character protrusion. microtype has a lot of optional arguments.
    – user2478
    Feb 2, 2011 at 14:04
  • @Herbert: I had a look at the manual and read a bit about protrusion. Did I get it right that the protrusion is set for each character individually? So for the left margin I'd have to adjust the settings? Feb 2, 2011 at 14:10
10

Personally, I think using the Latin Modern fonts with microtype seems to be a better approach

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern,microtype}

\textwidth=3.85cm
\begin{document}
\it\noindent
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}

microtype-version

1
  • As a note, the most obvious change between the version in the question and my alternative is in line 3. That shows up best if you compare the two side-by-side. I know Hendrik doesn't like the left margin, but to me the right margin in the original is more visually-jarring (mainly because of where the full-stop ends up).
    – Joseph Wright
    Feb 2, 2011 at 14:05

You must log in to answer this question.

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