10

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?

3 Answers 3

8

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.

3
  • But then the characters remain active outside the CD environment and conflicts will appear, for example, using TikZ's -> construct. I think it's better to suppress the problem with < and > for all the document, either by using es-noshorthands or (less drastically) by using es-noquoting. Commented May 29, 2011 at 22:47
  • @Gonzalo That's true. Probably TikZ should do something about that just like many other packages (which is not likely to happen with amscd). I don't know enough of Spanish typography to judge wether the < and > shorthand are really useful. I'll add something to my answer.
    – egreg
    Commented May 29, 2011 at 22:57
  • They have a purpose - the Spanish-speaking world is huge and there are lots of conventions regarding quotes. <<>> provide a short logical markup, so that the same document could be typeset in different countries preserving their own conventions. On the other hand, T1 ligatures are visual markup. (And it existed long before csquotes was created.) Commented Jan 28, 2016 at 14:49
12

The spanish option for babel makes some characters active to build shorthands; these shorthands will conflict with the standard use of the characters in a non-spanish document. To prevent this problem load babel in the following way:

\usepackage[spanish,es-noshorthands]{babel}

This will disable all shorthands; to disable only those characters conflicting with quoting, you can use

\usepackage[spanish,es-noquoting]{babel}
0
3

The command \deactivatequoting would solve it as well, also you can activate it again afterwards.

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

diagram

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .