[OS X TeX] PDF Sync and different fonts/encodings?

Morten Høgholm morten.hoegholm at gmail.com
Mon Feb 6 15:21:49 EST 2006

On Mon, 06 Feb 2006 20:19:23 +0100, Frank STENGEL <fstengel at mac.com> wrote:

> Le 6 févr. 06 à 18:54, Morten Høgholm a écrit :
>> Careful, the above will most likely lead to an error like
>>   ! TeX capacity exceeded, sorry [input stack size=5000].
>> What we want here is to insert \@PDFSYNC unexpanded into \everymath  
>> while making sure we do not get an infinite loop with \everymath  
>> calling itself. Hence the above code should be
>>   \expandafter\everymath\expandafter{\expandafter\@PDFSYNC\the 
>> \everymath}
> Thanks. To test the line I posted, I had actually tried adding something  
> to pdfsync's \everymath, and that worked: the thing I had added was non  
> expandable. I am not surprised the reverse would fail... By the way, why  
> doesn't the following work?
> \expandafter\everymath\expandafter{\noexpand\@PDFSYNC\the\everymath}

First expansion results in \noexpand being expanded which leaves \@PDFSYNC  
as it is[*] and \the\everymath untouched. Then the assignment takes places  
and you now have

Only use \noexpand when doing an \edef or \xdef or when you rely on  
something so dirty that \noexpand will work for you.

And here comes the *:
   \noexpand temporarily turns the next token into \relax if it was  
expandable so actually \@PDFSYNC temporarily had meaning \relax above but  
that fizzled before anything else happened.

   This means that sometimes you can use a test like  
\expandafter\ifx\noexpand<token><token> which would return <true> if  
<token> was unexpandable like \def and <false> if it was expandable like  
\expandafter. The soon to be released new version of xspace uses such a  
test (watch this space for announcement).

You can also define a macro
where the \romannumeral will expand until it finds a space or an  
unexpandable token. The \noexpand in itself is an expandable command but  
since it turns a following expandable token into \relax this will stop the  
scanning because \relax is also unexpandable. Try the following small  

\test{abc}, \test{ abc}

This method is used in the rather new (an unfinished) l3keyval module in  
the LaTeX3 experimental code (available at  


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list