I found a strange behavior of the microtype package. While using the command \SetExpansion to declare a microtype context with specific parameters, the color settings defined with the fontspec package are no longer available.

Here the code I was using:




\setmainfont{Linux Libertine}
\setsansfont[Color = FF0000FF]{Linux Biolinum}

\newcommand\Text{Lorem ipsum dolor sit amet, con- sectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.}


{\sffamily This is a false-latin example:} \Text

   {\sffamily This is a false-latin example:} \Text


which gives as a result:

enter image description here

If I comment out

%  context=MyExpansionContext,
%  shrink=270,
%  stretch=270

the result is colored as desired, but, obviously, without the specified microtype parameters:

enter image description here

  • It works with XeLaTeX. This really isn't the place to report bugs, though.
    – cfr
    Nov 16, 2016 at 0:59
  • @cfr It does not work with XeLaTeX, because XeLaTeX does not support font expansion. Anyhow, where do you suggest to post the topic? Nov 16, 2016 at 5:43
  • Report it to the package(s) maintainer(s). I'd wait first to see if somebody can tell you which package is buggy or whether both are. But generally bugs should be reported to package maintainers. Usually the documentation will tell you where to report them or who to report them too. (Obviously, this only applies to maintained packages.)
    – cfr
    Nov 16, 2016 at 16:04
  • What I meant, by the way, is that the colour works. Also, it isn't the expansion as such which is the problem. It is the use of the context. It is inserting lua commands directly, it seems. Moreover, the colour cannot be overridden using the ordinary colour commands in either XeTeX or LuaTeX (without an expansion context, obviously). That is, it is not just setting a default colour for sans. It is setting a come-what-may colour for sans.
    – cfr
    Nov 16, 2016 at 16:08

1 Answer 1


microtype makes copies of the fonts (to avoid the error ! error: (font expansion): font has been expanded with different stretch limit.) with \(pdf)copyfont, and this looses all font features, not only the color but also e.g. tlig (ligatures) and smcp (small caps):



{\testa abc -- `` }  normal 


{\testb abc -- `` } normal


enter image description here

The problem can also be shown in context:


{\testa abc -- }  normal


{\testb abc -- } normal


So I will ask on the context list ...


The answer from Hans Hagen is quite clear: \(pdf)copyfont works only on the tfm level and doesn't copy features like tlig, smcp and color. The code of microtype can't work correctly with open type fonts. Report the issue to the microtype maintainer.

  • 1
    Thank you for the answer. I reported to the maintainer of the microtype package Robert Schlicht ([email protected]) the problem, hoping he will read the email! Nov 17, 2016 at 10:19
  • 1
    @PaoloPolesana This has been fixed in microtype v2.7d. (My previous, now deleted comment was wrong.)
    – Robert
    Nov 19, 2019 at 0:14

You must log in to answer this question.

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