[OS X TeX] Re: The microtype mystery

Robert w.m.l at gmx.net
Sun Aug 22 23:48:47 EDT 2010


Hi George, Josep Maria, all,

the solution is to add the following lines after loading microtype:

\makeatletter
\def\MT at register@subst at font{\MT at exp@one at n\MT at in@clist\font at name\MT at font@list
   \ifMT at inlist@\else\xdef\MT at font@list{\MT at font@list\font at name,}\fi}
\makeatother

With the examples provided to me by George and Josep Maria (thanks very 
much to both of you!), loading microtype will now increase the 
compilation time by a factor of 2.5 to 3. Even though this is still 
slower than I would have expected, it is bearable, I suppose. I may be 
able to speed microtype up a bit more, but will have to postpone this 
for later.

For the interested, here's the background:
* Every time a font is `picked up' by latex, microtype checks whether it 
has already seen this font: if it has, it will do nothing; if it hasn't, 
microtype will do its work (set up protrusion and everything else) and 
then add the font name to the list of fonts it has already dealt with.
- Explanation #1: Compiling documents that are loaded with maths gets so 
slow because every time math mode is entered, latex picks up lots of 
math fonts, triggering microtype for each one. This accounts for the 
factor 2.5 to 3 we now get (with the above fix).
* Now, there are also cases where a font is not available, but will be 
substituted (e.g. if small caps are not available, the regular shape 
will be used). microtype is aware of these substitutions, and also adds 
the substitute to the list of fonts it has already seen.
- Explanation #2: Without the fix, microtype would have added 
substituted fonts *every time they were picked up*, which could lead to 
duplicates in microtype's font list. This was responsible for the epic 
deceleration, in particular together with the latexsym package, which 
replaces the bold font with the regular one -- every time a math symbol 
is typeset, regardless whether defined by latexsym or not! -- 
potentially leading to thousands of duplicates in the font list.

The two lines given above should fix that.

Regards,
-- 
  Robert




More information about the MacOSX-TeX mailing list