[Xy-pic] macros in xy

Michael Barr barr at math.mcgill.ca
Sat Jul 28 14:49:27 CEST 2007

What I found is that the only way of using macros in xy for internal 
operations is to assemble the arguments and then issue a command that xy 
recognizes.  Here is an example from my diagxy macros:
   \setwdth{#3}{#4}\deltax=\wdth \divide \deltax by \ul
   \advance \deltax by \defaultmargin  \ratchet{\deltax}{100}
\else \deltax #2%
\xy\ar@{#1}^{#3}_{#4}(\deltax,0) \endxy%
What it does is make an arrow in the text.  In fact, it is the operating 
macro for a macro called \to that has a number of parameters, all 
optional.  Aside from spacing, what it does is assemble the parameters and 
then issue a valid xy command that is parsed by xy.  There are also \top, 
\toppp all of which deal with putting in default values for the various 
optional parameters.  Incidentally, I could not begin to imagine to doing 
all this using \newcommand.  It just doesn't have the chops.

Michael Barr

More information about the xy-pic mailing list