[Tex/LaTex] Problem with spanish babel package

babelerrorsshorthandsspanish

I'm trying to use package amscd for a commutative diagram.
Everything goes smoothly if I write:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{amscd}
\begin{document}
$\begin{CD}
 A     @>b>>   C\\
 @VVV                         @VVV\\
 C  @>>>              R (V)
 \end{CD}$
\end{document}

However, if I replace english by spanish it doesn't work anymore. I get:

"Runaway argument?
b>> C\\ @VVV @VVV\\
 C @>>> R (V)
\end {CD}$
\end {document}
! File ended while scanning use of \ @>.
<inserted text> 
                \par 
<*> prueba1.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Emergency stop.
<*> prueba1.tex

*** (job aborted, no legal \end found)"

Any hints on how to solve it without having to use the english option?

Best Answer

The problem is that the Spanish module of babel activates the characters < and > in order to provide shorthands for "multilevel" quoting.

If you don't need those shorthands, you can use the technique proposed by Gonzalo Medina (i.e., the option es-noquoting or the more drastic es-noshorthands). Otherwise the code

\usepackage{etoolbox}
\preto\CD{\deactivatequoting}

after loading amscd will do the same job, deactivating the characters just for the CD environment.

One should realize that if T1-encoded fonts are used, the combinations << and >> already form ligatures for « and » (without the need of activating them). The package csquotes may be used instead of the quoting environment provided by the Spanish module for babel.