15

According to the answer given here, the microtype package should be loaded after the font, since microtype "needs to know what fonts are in use at the time that it is loaded". I am, however, not able to detect any difference between loading microtype before and after setting the font. I also notice that in the MWE below, the mt-*.cfg file for EB Garamond is loaded after fontspec, even if microtype is loaded first.

Does this mean that it simply doesn't matter when microtype is loaded?

\documentclass{article}
\usepackage{microtype,polyglossia}
    \setdefaultlanguage{english}
\usepackage{blindtext,fontspec}
    \setmainfont{EB Garamond}
\begin{document}
\Blinddocument
\end{document}

(simplified and abbreviated output below)
This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013/W32TeX)
(c:/texlive2013/texmf-dist/tex/latex/microtype/microtype.sty)
(c:/texlive2013/texmf-dist/tex/latex/microtype/microtype.cfg)
(c:/texlive2013/texmf-dist/tex/latex/polyglossia/polyglossia.sty)
(c:/texlive2013/texmf-dist/tex/latex/fontspec/fontspec.sty)
(c:/texlive2013/texmf-dist/tex/latex/fontspec/fontspec.cfg)
(c:/texlive2013/texmf-dist/tex/latex/ebgaramond/mt-EBGaramond.cfg)
5
  • mt-EBGaramond.cfg is not loaded here even if microtype is loaded second. I can't detect a difference but for a different reason: mt-EBGaramond.cfg is not loaded either way. However, I had to change your code to get it to compile and use EB Garamond 12 as the font name. So maybe that makes a difference?
    – cfr
    Commented Feb 24, 2014 at 17:36
  • 1
    @cfr I don't understand. mt-EBGaramond.cfg is not loaded? According to the log, it is, as seen in my MWE. I also don't understand what you mean by "maybe that makes a difference?"
    – Sverre
    Commented Feb 24, 2014 at 17:55
  • What I mean is: when I compile your code, it is not loaded. Except that I had to alter your code to get it to compile. Without the 12 I just get errors. With the 12, it compiles but it never loads the cfg file regardless. It is in your log, but not mine!
    – cfr
    Commented Feb 24, 2014 at 22:13
  • Since you’re using XeTeX with microtype you should know about the limitations this combination has.
    – Crissov
    Commented Feb 25, 2014 at 7:59
  • @cfr I see. That's a problem at your end, since the EB Garamond font is supposed to load without specifying the optical size. But this has nothing to do with my microtype question, so let's leave that aside. @Crissov I do, but pdflatex is not an option for me, since I need to use larger fonts. And lualatex has other limitations, such as not being able to compile with pstricks.
    – Sverre
    Commented Feb 25, 2014 at 12:13

1 Answer 1

12

Yes, microtype can be loaded at any time as its actual font setup is deferred until the end of the preamble. The restriction that the package should be loaded after the fonts dates back to very old microtype versions (older than v1.9a (2005/12/05)). (I've fixed this in the answer you link to.)

There's only one caveat concerning loading order (see "Hints and Caveats"), which doesn't apply to your case, just mentioning it for completeness' sake: when loading microtype with the babel option, you have to load the babel (or polyglossia) package first.

[EDIT: as mentioned by @koppor in the comment below, fontspec no longer needs to be loaded first (since v2.6).]

1

You must log in to answer this question.

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