9

I would like to disable or modify character protrusion (enabled by microtype) for specific characters.

Let me illustrate the issue with the en-dash, which protrudes far too wide for my taste:

without protrusion with protrusion

(left: without protrusion; right: with protrusion)

I am however unable to disable protrusion with \SetProtrusion:

\documentclass{memoir}
\usepackage{mathptmx}
\usepackage[T3,T1]{fontenc}
\usepackage{microtype}
%\usepackage[protrusion=false]{microtype}
\SetProtrusion
  { encoding = T1,
    family   = ptm }
  { \textendash = {,0} }


\begin{document}

Word word word word word word word word word word word word word word -- word
word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word
word word word word word word ...

\end{document}

I also get the following warning:

Package microtype Warning: protrusion codes list `ptm-T1' will override list
(microtype)                `q.tex/9' for font `T1/ptm///' on input line 105.

According to How do I call microtype's \SetProtrusion in the preamble?, including a line \LoadMicrotypeFile{ptm} just before \SetProtrusion helps; if I try this, this does seem to address the issue for -- (\textendash), but (1) the annoying warning stays and (2) my code disables all protrusion (by overriding the whole list of protrusion values with my short list). What is the right way to partially override default character protrusion settings? Ideally there will be a way that does away with any warnings while not disabling important microtype functionality.

  • 3
    \LoadMicrotypeFile{ptm}\SetProtrusion[name=myptm,load=ptm-T1]{ encoding = T1 , family = {ptm,ptmx,ptmj} }{ \textendash = {,0} } seems to work. and as this loads ptm-T1 before it overrides it I guess you can ignore the warning. – cgnieder Jul 14 '13 at 17:12
10

This is how you can extend or alter existing settings:

  1. Make sure that the settings you want to change are already loaded; in the preamble, this isn't guaranteed to be the case, so you need \LoadMicrotypeFile.

  2. Create new settings that load the default settings by way of the load key.

  3. If you want set protrusion for any glyph to zero, you explicitly have to do that – declaring empty protrusion values (e.g. \textendash = {,}) will not change anything.

  4. If the warning you receive disturbs you, you can suppress it by loading the package with verbose=silent; note, however, that this will also suppress all other microtype warnings. (I guess something like a override key for settings would be useful, but for now it is how it is.) EDIT: Since version 2.7, you will no longer receive a warning if the overridden list is the same as the one that's been loaded.

So, to turn this into code:

\usepackage[verbose=silent]{microtype}
\LoadMicrotypeFile{ptm}
\SetProtrusion
    [ name = ptm-adapted, % the name is optional
      load = ptm-T1 ]
    { encoding = T1,
      family   = {ptm,ptmx,ptmj} }
    { 
      \textendash = { ,0},      % left protrusion will remain untouched, 
                                % right protrusion set to zero
     %\textendash = {150,150},  % this would set protrusion on both sides to 150
    }

To adjust settings for more than one font, you have to do the same again (loading the settings and creating new ones), i.e. issue \SetProtrusion (with \LoadMicrotypeFile) multiple times:

\LoadMicrotypeFile{ppl}
\SetProtrusion
    [ load = ppl-T1 ]
    { encoding = T1,
      family   = {ppl,pplx,pplj} }
    { ... }

Another, simpler but less fine-grained, possibility might be to load the package with a factor less than 1000; this will scale the protrusion values for all glyphs of all fonts. For example,

\usepackage[factor=500]{microtype}

would halve all protrusion values.

  • You could use the silence package to specifically mute this one warning: \WarningFilter{microtype}{protrusion codes list} – languitar May 19 '17 at 7:58
5

I presently load microtype with protrusion adjustments as follows. Perhaps someone is interested in using my values, especially for Times (ptm), which imho has too much protrusion. Please note that my selection of adjustments is not an attempt at being exhaustive.

\usepackage[verbose=silent]{microtype}
    \LoadMicrotypeFile{ptm}
    \SetProtrusion
      [ name = ptm-adapted,
        load = ptm-T1 ]
      { encoding = T1,
        family   = {ptm,ptmx,ptmj} }
      { f = { ,-200},
        r = { ,-100},
        \textquoteleft     = {300, }, % default uses 500
        \textquoteright    = { ,300}, % default uses 500
        \textquotedblleft  = {75, }, % default uses 300
        \textquotedblright = { ,75}, % default uses 400
        \textendash = {0,0}, % default is 300/300
        \textemdash = {0,0}, % default is 200/200
        /           = { ,-100}, % default uses 200
        (           = {67, }, % default uses 100
        )           = { ,67}, % default uses 200
        {,}         = { ,167}, % default uses 500
        :           = { ,167}, % default uses 500
        ;           = { ,100}, % default uses 300
        .           = { ,233}, % default uses 700
        ?           = { ,33} } % default uses 100
    \SetProtrusion
      [ name = ptm-it-adapted,
        load = ptm-it-T1 ]
      { encoding = T1,
        family   = {ptm,ptmx,ptmj},
        shape    = {it,sl} }
      { f = { ,-300},
        : = { ,0}, % default uses 500
        . = { ,233} } % default uses 700
    \LoadMicrotypeFile{ppl}
    \SetProtrusion
      [ name = ppl-adapted,
        load = ppl-T1 ]
      { encoding = T1,
        family   = {ppl,pplx,pplj} }
      { \textquoteleft     = {150, }, % default uses 500
        \textquoteright    = { ,150}, % default uses 700
        \textquotedblleft  = {75, }, % default uses 300
        \textquotedblright = { ,75}, % default uses 400
        \textendash = {0,0}, % default is 300/300
        \textemdash = {0,0}, % default is 200/200
        /           = { ,100}, % default uses 300
        (           = {50, }, % default uses 100
        )           = { ,150}, % default uses 300
        {,}         = { ,250}, % default uses 500
        :           = { ,250}, % default uses 500
        ;           = { ,250}, % default uses 500
        .           = { ,350}, % default uses 700
        ?           = { ,100} } % default uses 200
    \SetProtrusion
      [ name = txtt ]
      { encoding = T1,
        family   = txtt,
        shape    = {it,sl} }
      { f = { ,-120},
        - = { ,300} } % in order to match ordinary hyphens' protrusion in body text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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