[Xy-pic] Math fonts

Ross Moore ross at ics.mq.edu.au
Sat May 10 09:46:53 CEST 2003

On Wed, 7 May 2003, Yannick Delbecque wrote:

> After a few tests, I get the same error with the minimal file:

Then I understand this perfectly now...

> \documentclass{article}
> \usepackage[all]{xy}
> \CompileMatrices
> \begin{document}
> \[ \xymatrix{ \mathrm{R} } \]
> \end{document}

Compilation necessarily requires expansion of the first thing
in each cell of a matrix.
But you cannot afford to have \mathrm expand at this early stage.

Simply use

  \xymatrix{\relax\mathrm{R} }

Note that this applies to the 1st token in *every* cell.
If the 1st token is an expandable control-sequence (other than
Xy-pic macros: \drop, \ar, \POS, \xypolygon, etc.), then
you should put in \relax to inhibit expansion.
 this fails:
   \[ \xymatrix{ a\mathrm{R} &\mathrm{B} } \]

 this works:
   \[ \xymatrix{ a\mathrm{R} &\relax\mathrm{B} } \]

There is a note in the Reference Manual about this effect, that occurs
when compiling matrices.

> But there is no error if I desactivate "\CompileMatrices" or remove the
> \mathrm command!

\CompileMatrices is a very TeXnichal thing.
To use it successfully in all contexts, you need to have some appreciation
of programming concepts (such as understaning the difference between
'immediate expansion' and 'deferred expansion').

> I also checked when there is no .xyc file present, and the error still
> occurs: the problem doesn't seems to be the reading of the compiled
> file by xypic.

No. It occurs earlier than at the re-reading stage.

> Note I used both OzTeX and TeTeX under mac os X to verify this.

Platform/system should be immaterial.

Hope this helps,

	Ross Moore

> Thanks!
> Yannick
> _______________________________________________
> Xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic

More information about the Xy-pic mailing list