babel spanish causes “Missing \endcsname…” error

Bug #1243455 reported by Roberto E Ferrer Pirela on 2013-10-22
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
moderncv
Undecided
Unassigned

Bug Description

This error was reported at http://tex.stackexchange.com/questions/140155/moderncv-and-babel-spanish-cause-missing-endcsname-error

Summary: The use of \usepackage[spanish, activeacute]{babel} along with \phone generates the following error:

! Missing \endcsname inserted. \protect l.22 \phone[mobile]{+1~(234)~567~890} The control sequence marked should not appear between \csname and \endcsname.

One tex.stackexchange user noted:

The babel module for Spanish redefines \roman to use small caps and in many places moderncv uses \roman for building indexed macros, basically by doing

\csname xyz\roman{counter}\endcsname

which won't work if \roman is redefined in that way.

The macros involved are

    1. \endcvcolumns which is defined by \newenvironment{cvcolumns}, where the occurrences of

    \roman{tmpiteratorcounter}

    should become

    \romannumeral\c@tmpiteratorcounter

    2. \cvcolumn, where the occurrences of

    \roman{cvcolumnscounter}

    should become

    \romannumeral\c@cvcolumnscounter

    3. \collectionadd (in moderncvcollection.sty), where the occurrences of

    \roman{collection@#2@count}

    should become

    \romannumeral\csname c@collection@#2@count\endcsname

Francisco Lopes (oblita) wrote :

I'm also suffering the issue with babel greek... I've applied the stackexchange command patches.

Hernan (hgsolari) wrote :

There is a conflict with "babel" and moderncv which goes beyond this problem. It does not show with
\usepackage[english]{babel}
but it shows in different forms with, for example
\usepackage[spanish,es-lcroman]{babel}

In the following example the error reads:
! Missing \endcsname inserted.
<to be read again>
                   \global
l.47 \end{document}

but longer examples may produce the error before reaching the end.

\documentclass[11pt,a4paper,sans]{moderncv} % Font sizes: 10, 11, or 12; paper sizes: a4paper, letterpaper, a5paper, legalpaper, executivepaper or landscape; font families: sans or roman

\moderncvstyle{casual} % CV theme - options include: 'casual' (default), 'classic', 'oldstyle' and 'banking'

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage[utf8]{inputenc} % para ver bien acentos --> ingreso para caracteres de teclado

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

\usepackage[scale=0.75]{geometry} % Reduce document margins

\firstname{Juan}
\familyname{de los Palotes}

\title{Curriculum Vitae}
\address{lugar}{casa}
\mobile{000}
\phone{111}
\email{name@host}

\begin{document}

\makecvtitle % Print the CV title

%----------------------
% DATOS PERSONALES
%----------------------
\section{Datos Personales}
\cvitem{Apellido}{de los Palotes}
\cvitem{Nombres}{Juan}
\cvitem{Nacionalidad}{apátrida}

%---------------
% DOCENCIA
%---------------
\section{Docencia}
\subsection{Cargos actuales}
\cventry{a}{b}{c}{d}{e}{f}
\cventry{a2}{b2}{c2}{d2}{e2}{f2}
\subsection{Formación}
\cvitem{NADA}{Nada}%
\cvitem{TODO}{Todo}
\end{document}

Hernan (hgsolari) wrote :

Here is a workaround.The only thing we need from Babel is the hyphenation.
In the previous example we can substitute the call to babel by
\usepackage[spanish,es-lcroman,es-noquoting,english]{babel}
es-lcroman fix a problem of font substitution described in the original post
es-noquoting allows you to use "quote me" instead of the quoting in spanish ``quote me''
the last option (english) will be the default

Now, after \begin{document} write \begin{otherlanguage}{spanish}
and close it with \end{otherlanguage}
\begin{document}
\begin{otherlanguage}{spanish}
typeset your CV
\end{otherlanguage}
\end{document}

Off course, in case you want a mixed language CV you can set each part to one of the declared options in the call to Babel.

I am attaching a replacement for the spanish example. I had to apply this trick twice since in one piece did not work.

Hernan (hgsolari) wrote :

OK, the solution is: load [spanish]{babel} with options
\usepackage[spanish,es-noquoting,es-noshorthands]{babel} % load spanish avoiding interference with moderncv

you can find the options in http://www.texnia.com/spanishopt.html

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers