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 '16 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? – Paolo Polesana Nov 16 '16 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 '16 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 '16 at 16:08

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.

| improve this answer | |
  • 1
    Thank you for the answer. I reported to the maintainer of the microtype package Robert Schlicht (w.m.l@gmx.net) the problem, hoping he will read the email! – Paolo Polesana Nov 17 '16 at 10:19
  • 1
    @PaoloPolesana This has been fixed in microtype v2.7d. (My previous, now deleted comment was wrong.) – Robert Nov 19 '19 at 0:14

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.