[texhax] LaTeX hangs up with $(\ref{label})$ and [spanish]{babel}

Ian Collier imc at comlab.ox.ac.uk
Tue Jul 8 15:25:46 CEST 2003

philip.ratcliffe at uninsubria.it ("Philip G. Ratcliffe") writes:
[someone asked]
>| I have experienced an annoying behaviour of LaTeX.  When I use a reference
>| inside math mode
>| the TeX program hungs up without any error message.  I have reproduced the
>| problem in the small document below.
>| This happens when using  \usepackage[spanish]{babel} and after using \chapter.

>I suspect it has to do with the way the "spanish" package redefines "."
>although I haven't time to delve any deeper.

It is.

The \ref command temporarily sets \@safe at activestrue while it typesets
the reference ("1.1").

The dot has a 8000 mathcode which makes it active within math mode.
It is defined to be "\es at use@shorthand ." which, when \@safe at actives
is true, expands to "\string .", which expands to just "." and so
the loop starts again.
---- Ian Collier : imc at comlab.ox.ac.uk : WWW page below
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml

More information about the texhax mailing list