[OS X TeX] Microtype Fix (from: Microtype mystery)

Ross Moore ross.moore at mq.edu.au
Mon Aug 30 05:25:50 CEST 2010


Hello Vijay,

On 30/08/2010, at 12:31 PM, R. Vijay Krishna wrote:

> Hello:
> 
> Sorry to start a new thread, but my previous post seems to have been lost somewhere in the ether (I think).  This is about the microtype code that was posted earlier:
> 
>> 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
> 
> Unfortunately, this seems to conflict with something:  The following example 
> 
> -----------
> 
> \documentclass{article}
> 
> 
> \usepackage{ifxetex}
> \ifxetex
> 
> \usepackage[no-math]{fontspec}
> \usepackage{xunicode}
> \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
> 
> \setmainfont[Mapping=tex-text,Numbers=OldStyle]{Adobe Garamond Pro}
> 
> \else
> \usepackage[T1]{fontenc}
> \usepackage{lmodern}
> 
> \usepackage[tracking=smallcaps,letterspace=30]{microtype}
> 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%  Fix for 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
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
> \fi

This kind of nested \if ... \if... \fi ... \fi cannot work,
unless the {microtype} package is loaded.
Only then is  \ifMT at inlist@  recognised as being a conditional
switch.
Otherwise  \ifMT at inlist@  is undefined and does not match the
first \fi .

What XeTeX sees is then:

    \ifxetex ... \else \fi} \makeatother \fi 

which explains the message of having too many }'s .

> 
> \begin{document}
> 
> This is some filler text
> 
> \end{document}
> 
> ---------
> 
> Running pdfLaTeX gives the desired output, however, compiling with XeTeX produces the following error:
> 
> -----------
> 
> ! Too many }'s.
> l.25 ...MT at font@list{\MT at font@list\font at name,}\fi}
>                                                \makeatother
> ? 
> ! Extra \fi.
> l.28 \fi
> 
> -----------


Here's one way to fix the problem.

>>> \usepackage{ifxetex}
>>> \makeatletter
>>>  \let\MT at inlist@fi\fi
>>> \makeatother
>>> \ifxetex
>>> 
>>> \usepackage[no-math]{fontspec}
>>> \usepackage{xunicode}
>>> \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
>>> 
>>> \setmainfont[Mapping=tex-text,Numbers=OldStyle]{Adobe Garamond Pro}
>>> 
>>> \else
>>> \usepackage[T1]{fontenc}
>>> \usepackage{lmodern}
>>> 
>>> \usepackage[tracking=smallcaps,letterspace=30]{microtype}
>>> 
>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> %%%%%%%%%  Fix for 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,}\MT at inlist@fi} \makeatother
>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> 
>>> \fi
>>> 

> 
> Getting rid of the fix for microtype solves the problem.  Is this a problem with ifxetex?

No. It is a matter of understanding how TeX processes
\if...  \else ... \fi  conditionals.

The "Fix" for microtype assumes that the microtype
package has been loaded, which only happens when the 
TeX engine supports it (i.e., with pdfTeX).

For any other engine, that coding is potentially
unbalanced. Certainly it cannot go inside another
conditional, without taking care to keep it properly
balanced within that setting.

>  
> 
> Thanks,
> Vijay.



Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the macostex-archives mailing list