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.
Best Answer
First, let us make it work with
hyperref
.hyperref
redefines\@footnotemark
itself, so instead of overwriting it, we just patch it with theetoolbox
package.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:Next, we tell
microtype
that this is the set of fonts we want to protrude:Now we can define the actual protrusion:
This would already be enough, but
microtype
complains that it has no protrusion settings forT1/lmr/m/n/7
and forOT1/lmr/m/n/7
etc., so let us provide some: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:
which gives