Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Where did @Herbert's answer go!? –  Seamus Feb 18 '11 at 13:42
    
@Seamus: Good question, he updated it and then deleted it before I read the update. @Herbert, if you're reading this: I'd also like to know what happened to your answer. (Well, why that happened, to be precise.) –  Hendrik Vogt Feb 18 '11 at 13:44
    
it was nonsense –  Herbert Feb 18 '11 at 16:30

1 Answer 1

up vote 6 down vote accepted

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.)

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.