[Tex/LaTex] microtype package (v.2.5 beta 06) and footnote protrusion

footnotesmicrotypeprotrusion

According to section 6 of microtype manual (v.2.5 from 2011/02/07, p. 23) the code below should set custom protrusion for footnote numbers. However, when \microtypecontext command is set, it cancels footnote mark completely. I run lualatex (beta-0.70.1-2011061410), but it isn't important if you're using pdflatex or xelatex, the result is same. Ideas?

Here's a MWE:

\documentclass{article}

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

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

\makeatletter

\SetProtrusion[context=footnote]%
    {font=*/*/*/*/scriptsize}% adapt if necessary; "footnotesize" corrected to "scriptsize" after Werner's note
    {1={,650},%
    2={,400},%
    3={,400},%
    4={,400},%
    5={,400},%
    6={,400},%
    7={,500},%
    8={,400},%
    9={,400},%
    0={,400}}

\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

%\setcounter{footnote}{123}

\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}

Note that the version of microtype package is 2.5 beta 06 which supports xelatex and tracking feature for lualatex.

The same question asked at comp.text.tex. I'll sync them if necessary.


UPDATE: Robert made couple of replies at comp.text.tex and solved most of problems regarding this issue by updating the package (microtype beta is now 2.5 beta 08). The only one that still remains is that numbers throughout a document (not only footnotes) are always lining nums, meaning Lowercase and Proportional options to fontspec get ignored, so text figures cannot be used in normal fashion. With Renderer=Basic option to fontspec, Numbers=Lowercase option gets applied, but Numbers=Proportional still does not.

Best Answer

As @Thorsten mentioned, the problem is that microtype is unable to associate your protrusion settings properly with the footnote. This is because you only specify the font type via the incorrect size - \footnotesize in this case. The warning produced by pdfTeX is

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

resulting in:

Incorrect microtype protrusion

Using either

{font=*/*/*/*/scriptsize}% adapt if necessary

or

{encoding=OT1}% You could add `,family=cmr` to be more specific

instead of

{font=*/*/*/*/footnotesize}% adapt if necessary

which, instead, yields:

Correct microtype protrusion

I am using TeXLive 2011 under Windows with microtype v2.4. The example in my documentation that you highlighted used the same modification to the above suggestion. I obtain a similar result under lualatex, but I know that microtype is not supported under xelatex, producing the following warning:

Package microtype Warning: You don't seem to be using pdftex.
(microtype)                `microtype' only works with pdftex.
(microtype)                Try running `pdflatex' instead of `xelatex'.