I now put a \relax before every instance of \underline and it works.<br><br>Thanks :-)<br><br><div class="gmail_quote">On Mon, Nov 14, 2011 at 12:34, Ross Moore <span dir="ltr"><<a href="mailto:ross.moore@mq.edu.au">ross.moore@mq.edu.au</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On 14/11/2011, at 12:15 PM, Arne Schröder wrote:<br>
<br>
> I made up a sample-file which fails with the error message "You can't use `spacefactor' in math mode \xy@{}{\leave@}", marking line 13:<br>
><br>
<br>
</div>Just put \relax immediately inside the cell where<br>
the problem occurs.<br>
<div class="im"><br>
> \documentclass{scrreprt}<br>
> \usepackage[matrix]{xy}<br>
><br>
> \CompileMatrices<br>
><br>
> \begin{document}<br>
><br>
> \[<br>
> \begin{xy}<br>
> \xymatrix{<br>
</div>\relax<br>
<div class="im">>   \underline{bla}<br>
> }<br>
> \end{xy}<br>
> \]<br>
><br>
> \end{document}<br>
><br>
> Do you know whether I have done something wrong?<br>
<br>
</div>It is a known issue with \xymatrix  and some other kinds<br>
of alignment environments.<br>
<br>
TeX has to expand any macro that comes as the 1st thing<br>
in a cell, to see whether  \omit  appears.<br>
When it is a complicated non-robust macro, this can lead<br>
to an error in parsing.<br>
<div class="im"><br>
> Is there a known workaround?<br>
<br>
</div>Just put \relax to inhibit further expansion.<br>
<div class="im"><br>
> Thanks in advance,<br>
><br>
> Arne Schröder<br>
<br>
<br>
</div>Hope this helps,<br>
<br>
        Ross<br>
<br>
------------------------------------------------------------------------<br>
<font color="#888888">Ross Moore                                       <a href="mailto:ross.moore@mq.edu.au">ross.moore@mq.edu.au</a><br>
Mathematics Department                           office: E7A-419<br>
Macquarie University                             tel: <a href="tel:%2B61%20%280%292%209850%208955" value="+61298508955">+61 (0)2 9850 8955</a><br>
Sydney, Australia  2109                          fax: <a href="tel:%2B61%20%280%292%209850%208114" value="+61298508114">+61 (0)2 9850 8114</a><br>
------------------------------------------------------------------------<br>
<br>
<br>
<br>
</font></blockquote></div><br>