8

In this answer about full justification for italic text, I used microtype's \SetProtrusion to get better-looking margin kerning for italics. It works fine, but I had to call \SetProtrusion after \begin{document}, which is clearly not nice.

I tried it in the preamble: Then it compiles, but the new protrusion table isn't used. I tried it with \AtBeginDocument, but this gave a very long error message, starting with

Package microtype Warning: Unknown slot number of character
(microtype)                ` A '
(microtype)                in font encoding `OT1'.
(microtype)                Make sure it's a single character
(microtype)                (or a number) in protrusion list 
(microtype)                `cmr-it'.

Thus my question: How do I call \SetProtrusion in the preamble?

(Answers which use external files are appreciated, but I'd also like to know if it's possible without that.)

EDIT: Here's a minimal example (sorry for not providing that immediately).

\documentclass{article}
\usepackage{microtype}
\AtBeginDocument{%
\SetProtrusion
   [ name     = cmr-it   ]
   { }
   { A              = {50,50},
     \textquoteleft = {700, } }}
\begin{document}
\it foo
\end{document}
Hendrik Vogt
  • 37,935

1 Answers1

8

If you want to overwrite a set from one the mt-xxx.cfg files you should load this file first:

\documentclass{article}
\usepackage{microtype}
\LoadMicrotypeFile{cmr}
\SetProtrusion[name=cmr-it]    { }    {A= {1000,1000}}


\begin{document}
ABC\\
ABC\\
\itshape ABC
\\abc
\end{document}

Btw: The spaces around the "A" in the microtype warning indicates that at the begin of the document spaces are no longer ignored. The warning disappears if you remove the spaces in \SetProtrusion. (You will get other errors but as \AtBeginDocument is the wrong idea anyway I didn't investigate more.)

Ulrike Fischer
  • 327,261
  • Great, thanks, \LoadMicrotypeFile{cmr} is the solution. But I don't quite understand your "Btw" about spaces: As I wrote in the question, with \SetProtrusion after \begin{document} it did work despite all the spaces. Or are those spaces only relevant with \AtBeginDocument? – Hendrik Vogt Feb 19 '11 at 10:36