10

In microtype package (v.2.5 beta 06) and footnote protrusion, custom protrusion for footnote numbers is enabled. However, as soon as I edit the footnote characters to the ones generated by \fnsymbol and alter the corresponding character to be protruded, it stops working. Here's an MWE for the footnote with numbers:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{geometry}
\geometry{a5paper,showframe}
\usepackage[protrusion=true,factor=2000]{microtype}
\SetProtrusion[context=footnote]{encoding=T1}{1={,650}}    

\makeatletter
\newcommand*\new@makefnmark{\hbox{\@textsuperscript{\normalfont
    \microtypecontext{protrusion=footnote}\@thefnmark}}}
\renewcommand*\@footnotemark{%
    \leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
    \new@makefnmark \ifhmode\spacefactor\@x@sf\fi \relax}
\makeatother

\begin{document}
Here's some text to show the behaviour of footnote marker at%
%
\footnote{A footnote}
%
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.
\end{document}

Here's an MWE for the footnote with the symbols defined by \fnsymbol:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{geometry}
\geometry{a5paper,showframe}
\usepackage[protrusion=true,factor=2000]{microtype}
\SetProtrusion[context=footnote]{encoding=T1}{*={,650}}    
%\SetProtrusion[context=footnote]{encoding=T1}{\ast={,650}}    
%\SetProtrusion[context=footnote]{encoding=T1}{\textasteriskcentered={,650}}    
% None of the above work

\makeatletter
\newcommand*\new@makefnmark{\hbox{\@textsuperscript{\normalfont
    \microtypecontext{protrusion=footnote}\@thefnmark}}}
\renewcommand*\@footnotemark{%
    \leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
    \new@makefnmark \ifhmode\spacefactor\@x@sf\fi \relax}
\makeatother

\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\begin{document}
Here's some text to show the behaviour of footnote marker at%
%
\footnote{A footnote}
%
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.
\end{document}

However, given the definition of \@fnsymbol I know for a fact that the symbol for the first footnote is *:

\fnsymbol=macro:
#1->\expandafter \@fnsymbol \csname c@#1\endcsname

\@fnsymbol=macro:
#1->\ensuremath {\ifcase #1\or *\or \dagger \or \ddagger \or \mathsection \or     mathparagraph \or \|\or **\or \dagger \dagger \or \ddagger \ddagger \else \@ctr
err \fi }

So my question is, how do I configure microtype correctly to get this to work? Note that I am using microtype v2.5. Below are the errors I get from running the nonworking MWE:

Package microtype Warning: I cannot find a protrusion list for font
(microtype)                `OT1/lmr/m/n/7' (context: `footnote'). Switching off
(microtype)                protrusion for this font on input line 20.


Package microtype Warning: I cannot find a protrusion list for font
(microtype)                `OT1/lmr/m/n/5' (context: `footnote'). Switching off
(microtype)                protrusion for this font on input line 20.


Package microtype Warning: I cannot find a protrusion list for font
(microtype)                `OT1/lmr/m/n/10' (context: `footnote'). Switching off
(microtype)                protrusion for this font on input line 20.
2
  • 2
    JFYI: Microtype v2.5 final is on CTAN for some weeks now.
    – Speravir
    Commented Apr 17, 2013 at 21:15
  • I ran this on the version that I downloaded from CTAN yesterday. The problem was fixed by @mafp.
    – cdacosta
    Commented Apr 18, 2013 at 13:58

1 Answer 1

11

First, let us make it work with hyperref. hyperref redefines \@footnotemark itself, so instead of overwriting it, we just patch it with the etoolbox package.

\usepackage{etoolbox}
...
\makeatletter
\newcommand*\new@makefnmark{\hbox{\@textsuperscript{\normalfont
    \microtypecontext{protrusion=footnote}\@thefnmark}}}
\patchcmd{\@footnotemark}
  {\@makefnmark}
  {\new@makefnmark}{}{}
\makeatother

Next, let us protrude the footnote markers. We define the fonts that we want to protrude. I chose the default set alltext, plus the font of the footnote symbols:

\DeclareMicrotypeSet{alltextAndFootnotes}{%
  encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2}, %% alltext
  font     = {OMS/lmsy/m/n/scriptsize},
}

Next, we tell microtype that this is the set of fonts we want to protrude:

\microtypesetup{protrusion=alltextAndFootnotes}

Now we can define the actual protrusion:

\SetProtrusion[context=footnote]{encoding=OMS, family=lmsy,series=m, shape=n, size=scriptsize}{%
  "03={,650},%% *
  "78={,650},%% \mathsection
  "79={,650},%% \dagger
  "7A={,650},%% \ddagger
  "7B={,650},%% \mathparagraph
  "6B={,650},%% \|
  }

This would already be enough, but microtype complains that it has no protrusion settings for T1/lmr/m/n/7 and for OT1/lmr/m/n/7 etc., so let us provide some:

\SetProtrusion[context=footnote,load=lmr-T1,factor = 700]
  {encoding=T1, family=lmr, series=m, shape=n, size=scriptsize}
  {  }
\SetProtrusion[context=footnote,load=cmr-OT1,factor = 700]
  {encoding=OT1, family=lmr, series=m, shape=n}
  {  }

We just use the default protrusion settings for T1-encoded Latin Modern Roman, and OT1-encoded Computer Modern, scaled a little down. Change to your liking.

Complete MWE:

\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{etoolbox}

\usepackage{geometry}
\geometry{a5paper,showframe}

\usepackage[colorlinks]{hyperref}


\usepackage[protrusion=alltext,factor=2000]{microtype}

\DeclareMicrotypeSet{alltextAndFootnotes}{%
  encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2}, %% alltext
  font     = {OMS/lmsy/m/n/scriptsize},
}

\microtypesetup{protrusion=alltextAndFootnotes}
\SetProtrusion[context=footnote]{encoding=OMS, family=lmsy,series=m, shape=n, size=scriptsize}{%
  "03={,650},%% *
  "78={,650},%% \mathsection
  "79={,650},%% \dagger
  "7A={,650},%% \ddagger
  "7B={,650},%% \mathparagraph
  "6B={,650},%% \|
  }
\SetProtrusion[context=footnote,load=lmr-T1,factor = 700]
  {encoding=T1, family=lmr, series=m, shape=n, size=scriptsize}
  {  }
\SetProtrusion[context=footnote,load=cmr-OT1,factor = 700]
  {encoding=OT1, family=lmr, series=m, shape=n}
  {  }

\makeatletter
\newcommand*\new@makefnmark{\hbox{\@textsuperscript{\normalfont
    \microtypecontext{protrusion=footnote}\@thefnmark}}}
\patchcmd{\@footnotemark}
  {\@makefnmark}
  {\new@makefnmark}{}{}
\makeatother

\renewcommand{\thefootnote}{\fnsymbol{footnote}}

%% --------------------------------------------------------------
%% --------------------------------------------------------------
\begin{document}
Here's some text to show the behaviour of footnote marker at%
\footnote{A footnote}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{B}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{C}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{D}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{E}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{F}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{G}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{H}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.

Here's some text to show the behaviour of footnote marker at%
\footnote{I}
the end of a line, which disappears when the code for setting  microtypecontext is used in fnmark redefinition.
\end{document}

which gives

sample output

6
  • Thank you. I'd like to point out that using encoding=T1 works also. Just out of curiosity, how do I find out the mathcode for a given character and how would I enable protrusion for that code.
    – cdacosta
    Commented Apr 18, 2013 at 13:59
  • I'm also having trouble protruding the other symbols. I've redefined the \@fnsymbol to \makeatletter \def\@fnsymbol#1{\ifcase #1\or *\or \textdagger \or \textdaggerdbl \or \S \or \P \or \textbar \or **\or \textdagger\textdagger \or \textdaggerdbl\textdaggerdbl \else \@ctrerr \fi } \makeatother and added the proper characters to the protrusion, but it still doesn't work. Any ideas?
    – cdacosta
    Commented Apr 18, 2013 at 14:08
  • @cdacosta A very helpful resource for me for all TeX stuff is TeX by topic. You can get a free pdf, and it has character tables, too. You can also look into the configuration files of microtype, e.g., mt-cmr.cfg.
    – mafp
    Commented Apr 18, 2013 at 14:24
  • Thanks a lot, I'll look into it. I've been reading the TeX Book, but I'm inexperienced dealing with microtype. I've uncovered another problem still: using hyperref with colored links destroys the protrusion, probably because of some redefinition of the fnsymbol. I'll see if I can fix it myself.
    – cdacosta
    Commented Apr 18, 2013 at 14:33
  • 1
    Great answer, I would only suggest not to scale down the protrusion settings for T1 and OT1, since the settings are size-specific anyway; also, loading the complete settings isn't necessary either, as they will never be used in the footnote context.
    – Robert
    Commented Apr 20, 2013 at 19:05

You must log in to answer this question.

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