[Xy-pic] macros

Ross Moore ross.moore at mq.edu.au
Thu Feb 24 20:57:11 CET 2011


Hi Daniel, and Alex,

Sent from my iPad

On 25/02/2011, at 6:19 AM, Daniel Müllner <nospamplease at stanford.edu> wrote:

> Hi Alex, (and hi Ross, since I know you are reading this list),
> 
> yes, you can. Here is the trick: Use \scantokens{\POS{...}}
> 
> \newcommand{\XyCover}[2]{\scantokens{\POS

Mostly the \scantokens is not needed, but certainly you must start the macro expansion with \POS to turn on parsing of the subsequent tokens. However ...


> #1*{};#2*{}**{};
> ?<*[@_][o]=<0.0pc>{\bullet};
> ?>*[@_][o]=<0.8pc>{\bigcup} **[|(2)]\dir{-};
> }}
> 
> \[
> \xy
> \XyCover{(-10,0)}{(0,10)}
> \XyCover{(0,10)}{(10,0)}
> \XyCover{(10,0)}{(0,-10)}
> \XyCover{(0,-10)}{(-10,0)}
> \endxy
> \]
> 
> Has this trick ever been mentioned in the Xy-pic mailing list? Ross, you might want to describe the \scantokens trick somewhere in the Xy-pic documentation. It can be a real lifesaver in every TeXnical situation where the catcodes have non-default values!

  ... yes, when the catcodes are different, then \scantokens would be a life saver.
It is not mentioned in the existing documentation, since this pre-dates the adoption of eTeX as the main basis of processing engines, and the decision to make the basic  tex  and  latex  commands become  pdfTeX  running with  pdfoutput  being 0. Prior to this, \scantokens  would not be available. 

But now, it certainly could be the right way to solve some problems where the catcode of some punctuation characters has been changed, e.g. by Babel for French or Spanish accents.
A collection of real-world examples would be useful.

> 
> Best,
> 
> Daniel

Cheers,

     Ross


More information about the xy-pic mailing list