Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Spanish Babel in IEEETran

1,080 views
Skip to first unread message

Manuel Olivares

unread,
May 11, 2011, 2:14:01 PM5/11/11
to
Hi,

I used to prepare documents in spanish with IEETran.cls class
including:

\documentclass[journal,twoside]{IEEEtran}
\usepackage[latin1]{inputenc}
\usepackage[spanish]{babel}

but since I updated to Miktex 2.9 (getting IEETran.cls automatic
update) I can't compile my latex documents in spanish any more.

The message I got is
! Package babel Error: You havent't defined the language SPANISH yet.

but teh Babel package works fine whith article.cls class:

\documentclass[12pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[spanish]{babel}

I would appreciate any suggestion regarding the current use of
IEEETran class with spanish babel.

Regards,
Manuel

Enrico Gregorio

unread,
May 11, 2011, 2:18:55 PM5/11/11
to
Manuel Olivares <molivar...@gmail.com> wrote:

With a minimal example based on those three lines I don't get
errors. I don't have MiKTeX, but I doubt that this has anything
to do with this.

Can you provide a file that shows the error?

Ciao
Enrico

Ulrike Fischer

unread,
May 11, 2011, 2:20:45 PM5/11/11
to
Am Wed, 11 May 2011 11:14:01 -0700 (PDT) schrieb Manuel Olivares:

> Hi,
>
> I used to prepare documents in spanish with IEETran.cls class
> including:
>
> \documentclass[journal,twoside]{IEEEtran}
> \usepackage[latin1]{inputenc}
> \usepackage[spanish]{babel}
>
> but since I updated to Miktex 2.9 (getting IEETran.cls automatic
> update) I can't compile my latex documents in spanish any more.
>
> The message I got is
> ! Package babel Error: You havent't defined the language SPANISH yet.

If the message really say SPANISH in uppercase letters, there is
probably a \selectlanguage command in a \MakeUpperCase. Sounds like
a bug in the cls.

Make a complete example that demonstrates the problem.


--
Ulrike Fischer

Michael Shell

unread,
May 11, 2011, 7:49:31 PM5/11/11
to Manuel Olivares
On Wed, 11 May 2011 20:20:45 +0200
Ulrike Fischer <ne...@nililand.de> wrote:


> If the message really say SPANISH in uppercase letters, there is
> probably a \selectlanguage command in a \MakeUpperCase. Sounds like
> a bug in the cls.


Your instincts are correct Ulrike. ;)

The problem is listed in the FAQ. Putting this patch code after
the class loads will fix the problem:


\makeatletter
\def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}\MakeUppercase{\protect#1}}%
\def\rightmark{\@IEEEcompsoconly{\sffamily}\MakeUppercase{\protect#2}}}
\makeatother


Alternatively, the user can manually define the \leftmark and \rightmark
manually setting the headers in caps and avoiding a call to \markboth:

\renewcommand{\leftmark}{JOURNAL NAME ,~VOL.~1, NO.~1,~JANUARY~2008}
\renewcommand{\rightmark}{SHELL et al.: PAPER TITLE}

Cheers,

Mike Shell

Manuel Olivares

unread,
May 12, 2011, 9:25:39 AM5/12/11
to

Thank you, but the patch code doesn't work for spansih. I tried:

\documentclass[journal,twoside]{IEEEtran}

\makeatletter
\def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#1}}%
\def\rightmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#2}}}
\makeatother

\usepackage[spanish]{babel}

but I get the error ! Argument of \language@active@arg~ has an
extra }.

I read the FAQ and tried:

\documentclass[journal,twoside]{IEEEtran}

\makeatletter
\def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#1}}%
\def\rightmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#2}}}
\makeatother

\usepackage[english]{babel}

and it works fine. But I still like to use the IEEETran class with
dosuments in spanish... any suggestion?

Regards,
Manuel

Ulrike Fischer

unread,
May 12, 2011, 9:50:52 AM5/12/11
to
Am Thu, 12 May 2011 06:25:39 -0700 (PDT) schrieb Manuel Olivares:

> Thank you, but the patch code doesn't work for spansih. I tried:
>

[incomplete example]

> but I get the error ! Argument of \language@active@arg~ has an
> extra }.
>

> But I still like to use the IEEETran class with
> dosuments in spanish... any suggestion?

Well at first: make a complete example which demonstrates your
error. Your code snippet works fine for me when I add a simple
document body.

--
Ulrike Fischer

Javier Bezos

unread,
May 12, 2011, 10:24:08 AM5/12/11
to
Manuel:

> but I get the error ! Argument of \language@active@arg~ has an
> extra }.
>
> I read the FAQ and tried:
>
> \documentclass[journal,twoside]{IEEEtran}
>
> \makeatletter
> \def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}
> \MakeUppercase{\protect#1}}%
> \def\rightmark{\@IEEEcompsoconly{\sffamily}
> \MakeUppercase{\protect#2}}}
> \makeatother
>
> \usepackage[english]{babel}

With this preamble I couldn't reproduce the error. However,
I presume the document has something like ~} (ie, a tilde
followed by a right brace), which, unfortunately, babel
doesn't handle well. You may deactivate the ~ shorthand as
explained on:

http://www.tex-tipografia.com/spanishopt.html

I hope this helps
Javier
-----------------------------
http://www.tex-tipografia.com/

Manuel Olivares

unread,
May 12, 2011, 4:49:01 PM5/12/11
to

Thank you both Javier and Michael!

Problem solved using:

\documentclass[journal,twoside]{IEEEtran}

\makeatletter
\def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#1}}%
\def\rightmark{\@IEEEcompsoconly{\sffamily}
\MakeUppercase{\protect#2}}}
\makeatother

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

In this way my spanish documents using IEEETran are alive again!

Regards,
Manuel

Michael Shell

unread,
May 12, 2011, 7:45:02 PM5/12/11
to Manuel Olivares
On Thu, 12 May 2011 13:49:01 -0700 (PDT)
Manuel Olivares <molivar...@gmail.com> wrote:


> \usepackage[spanish,es-notilde]{babel}


On Thu, 12 May 2011 16:24:08 +0200
Javier Bezos <see....@no.espam.es> wrote:

: I presume the document has something like ~} (ie, a tilde


: followed by a right brace), which, unfortunately, babel
: doesn't handle well.


Thank you Javier, this may help a lot of folks.


Manuel,

Can you tell me where in your document the offending tilde
~ construct is? i.e., is it in your \markboth ? If so,
could you please show it to me for future reference.

FWIW, I wish babel would not break so easily with regard
to the formatting of headers.


Thanks,

Mike


Manuel Olivares

unread,
May 13, 2011, 11:57:02 AM5/13/11
to Manuel Olivares
This is the code that originates the message:

! Argument of \language@active@arg has an extra }.

\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{latex.eps}
% \caption{Short caption}\label{resultado}
\caption{Long caption long caption long caption long caption long caption}\label{resultado}
\end{figure}

The problem occurs when a long caption is used in the figure environment.

Solutions:
- Use a short caption instead
- Activate the option es-notilde in \usepackage[spanish,es-notilde]{babel}

I think this problem is not related to IEEETran nor Babel, but to the user. I am sorry for that.

Regards,
Manuel

Michael Shell

unread,
May 13, 2011, 9:10:16 PM5/13/11
to Manuel Olivares
On Fri, 13 May 2011 08:57:02 -0700 (PDT)
Manuel Olivares <molivar...@gmail.com> wrote:

> The problem occurs when a long caption is used in the figure environment.
>
> Solutions:
> - Use a short caption instead
> - Activate the option es-notilde in \usepackage[spanish,es-notilde]{babel}
>
> I think this problem is not related to IEEETran nor Babel, but to the user.
> I am sorry for that.


Manuel,

Alas, the problem does not happen under article class so I have to
look into it. It turns out that a ~} sequence (as Javier suspected) in
the \@makecaption is what is triggering the problem. In the next update
of IEEEtran I will change all the ~ to \nobreakspace to avoid the problem.

In the meantime, this patch (for non-compsoc papers only, and watch
that your email client or newsreader does not introduce line breaks
as some lines are over 80 chars long) will overcome the problem so
you can still use active ~:

\makeatletter
\long\def\@makecaption#1#2{%
% test if is a for a figure or table
\ifx\@captype\@IEEEtablestring%
% if a table, do table caption
\footnotesize\begin{center}{\normalfont\footnotesize #1}\\{\normalfont\footnotesize\scshape #2}\end{center}%
\@IEEEtablecaptionsepspace
% if not a table, format it as a figure
\else
\@IEEEfigurecaptionsepspace
% 3/2001 use footnotesize, not small; use two nonbreaking spaces, not one
\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}\nobreakspace\nobreakspace #2}%
\ifdim \wd\@tempboxa >\hsize%
% if caption is longer than a line, let it wrap around
\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}\nobreakspace\nobreakspace }%
\parbox[t]{\hsize}{\normalfont\footnotesize\noindent\unhbox\@tempboxa#2}%
% if caption is shorter than a line, center if conference, left justify otherwise
\else%
\ifCLASSOPTIONconference \hbox to\hsize{\normalfont\footnotesize\hfil\box\@tempboxa\hfil}%
\else \hbox to\hsize{\normalfont\footnotesize\box\@tempboxa\hfil}%
\fi\fi\fi}
\makeatother

Cheers,

Mike

0 new messages