[Xy-pic] Using macros in xymatrix
andrew.clegg at gmail.com
Thu Jul 26 17:22:51 CEST 2007
I'm using xymatrix to do various kinds of linguistic diagram, and it's
producing some great results. One thing I would like to do is define
some standard designs for common elements of the diagrams so that I
don't have to type them in each time I use them -- this would make the
xymatrix definitions quicker to write and much easier to read.
For example, one style that I use a lot is a word in fixed-space font
with a bit of extra spacing and a rectangular frame around it, like
So I defined a macro called \lab (as in label) to represent this:
I've also done the same for different arrow styles, e.g. arrows with
So then you can say for example
for "foo" in a nice box with a thick arrow coming out the right side.
Works fine, and much simpler than the full xy syntax. However, I'd
also like to be able to use the style macros in labels on the arrows
But this doesn't work! I get an "Argument of \lab has an extra }"
message as if something fragile is getting expanded improperly. I
tried to protect it:
but even more bizarrely, this results in an unbroken arrow with no label at all.
Does anyone have a workaround, or a better way to solve the problem
without using \newcommand?
More information about the xy-pic