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

Or name \end... illegal, see p.192 of the manual.

8,617 views
Skip to first unread message

Aaron Digulla

unread,
Jan 20, 2009, 8:16:49 AM1/20/09
to
Hello,

When I run this file:

-------------- test.tex --------------------------------
\documentclass[a4paper,twocolumn,10pt,american]{article}
\usepackage[T1]{fontenc}
\usepackage[american,german]{babel}

\iflanguage{german}{
\newcommand{\quotes}{\dq}
}{}
\iflanguage{american}{
\newcommand{\quotes}{"}
}{}

\begin{document}
\normalfont
\quotes{}Text.\quotes{}
\end{document}
-------------- test.tex --------------------------------

I get this error:

---------------- output -------------------------------
...
! LaTeX Error: Command \quotes already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.11 }{}

?
(./test.aux) [1] (./test.aux) )
Output written on test.dvi (1 page, 236 bytes).
Transcript written on test.log.
---------------- output -------------------------------

The log says:

Package babel Info: Making " an active character on input line 102.

So I tried to use \" instead of " but to no avail. Any ideas what
could be wrong and how to fix it? I just want \quotes to expand to the
standard double quotes.

And in which manual is p.192?

Thanks!

Lars Madsen

unread,
Jan 20, 2009, 8:34:20 AM1/20/09
to
Aaron Digulla wrote:
> Hello,
>
> When I run this file:
>
[snip]

no problems here, when compiling your example

Though those are the wrong quotes you use, I would recommend that I have
a look at the csquote package which can handle language specific quoting.


--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html

Enrico Gregorio

unread,
Jan 20, 2009, 8:35:27 AM1/20/09
to
Aaron Digulla <adig...@gmail.com> wrote:

I don't get any error. However you are making some mistakes in your
input.

Don't give one global option to \documentclass when you use that
option also for babel together with another. I prefer, in this case,

\documentclass[a4paper,twocolumn,10pt]{article}


\usepackage[T1]{fontenc}
\usepackage[american,german]{babel}

There has been recently a discussion on this topic.

The definition you are giving of \quotes is wrong. At the time of
your "definitions", the active language is german, so only the first
conditional is true and evaluated.

OTOH, the " character can be obtained (in the T1 encoding) with
\textquotedbl, independently from the language used. Thus

\newcommand{\quotes}{\textdblquote}

is what you are looking for.

> And in which manual is p.192?

The LaTeX manual by L. Lamport.

Ciao
Enrico

Aaron Digulla

unread,
Jan 20, 2009, 8:55:33 AM1/20/09
to
On 20 Jan., 14:35, Enrico Gregorio <grego...@math.unipd.it> wrote:

> I don't get any error.

Any ideas what could be causing the error? I'm using TeX for more than
10 years, now, but I've never seen an error like this. My guess is
that \iflanguage is broken but how could that happen?

> Don't give one global option to \documentclass when you use that
> option also for babel together with another. I prefer, in this case,
>
>   \documentclass[a4paper,twocolumn,10pt]{article}
>   \usepackage[T1]{fontenc}
>   \usepackage[american,german]{babel}

The file is not 100% identical to my use case. I need to be able to
switch between german and US english in the main file. The babel
package is included from a common file. Specifying the language in
documentclass was the only way to tell babel which language to use. Do
you know another way to achieve this?

> The definition you are giving of \quotes is wrong. At the time of
> your "definitions", the active language is german, so only the first
> conditional is true and evaluated.

As I said, I'm switching between the two languages depending on the
language of the "main" file. I would like to have as little code as
possible in the (generated) main file.

> OTOH, the " character can be obtained (in the T1 encoding) with
> \textquotedbl, independently from the language used. Thus
>
>   \newcommand{\quotes}{\textdblquote}
>
> is what you are looking for.

This gives me:

! Undefined control sequence.
\quotes ->\textdblquote

I've tried:

\newcommand{\quotes}{"}

before the babel package and this works but \newcommand in \iflanguage
will cause an error in TeXlive 2008.

Regards,

Aaron Digulla

unread,
Jan 20, 2009, 9:04:31 AM1/20/09
to
Okay, after some more testing, I can confirm that using \newcommand
inside of \iflanguage causes the error. I can put anything into the
parameters #1 and #2, it doesn't matter. Having this text "\newcommand
{\xxx}{yyy}" in there is enough to throw "\xxx already defined.". Any
ideas why?

Regards,

Lars Madsen

unread,
Jan 20, 2009, 9:45:08 AM1/20/09
to

as I said before look at csquotes instead of trying to implement it your
self, it does all that your are trying to do and works fluently with babel

anyway start by definint \quotes to do nothing, and then \renewcommand it.

Robin Fairbairns

unread,
Jan 20, 2009, 9:56:30 AM1/20/09
to

it's a mystery: your test file works for everyone who's posted
(including me), but not for you.

please add \listfiles to the preamble of your document, and post the
results -- i can't think of a recent change to babel that might have
caused this, but it would be good to eliminate that as a potential
source of problems.
--
Robin Fairbairns, Cambridge

Lars Madsen

unread,
Jan 20, 2009, 9:58:22 AM1/20/09
to
Lars Madsen wrote:
> Aaron Digulla wrote:
>> Okay, after some more testing, I can confirm that using \newcommand
>> inside of \iflanguage causes the error. I can put anything into the
>> parameters #1 and #2, it doesn't matter. Having this text "\newcommand
>> {\xxx}{yyy}" in there is enough to throw "\xxx already defined.". Any
>> ideas why?
>>
>> Regards,
>
> as I said before look at csquotes instead of trying to implement it your
> self, it does all that your are trying to do and works fluently with babel
>
> anyway start by definint \quotes to do nothing, and then \renewcommand it.
>
>

\documentclass[a4paper,twocolumn,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[english,ngerman]{babel}
\usepackage[babel,english=american,german=swiss]{csquotes}
\begin{document}
\enquote{Text.}

\selectlanguage{english}

\enquote{Text.}

\selectlanguage{ngerman}

\enquote{Text.}


\end{document}

Robin Fairbairns

unread,
Jan 20, 2009, 10:04:38 AM1/20/09
to
Aaron Digulla <adig...@gmail.com> writes:
>On 20 Jan., 14:35, Enrico Gregorio <grego...@math.unipd.it> wrote:
>
>> I don't get any error.
>
>Any ideas what could be causing the error? I'm using TeX for more than
>10 years, now, but I've never seen an error like this. My guess is
>that \iflanguage is broken but how could that happen?
>
>> Don't give one global option to \documentclass when you use that
>> option also for babel together with another. I prefer, in this case,
>>
>> =A0 \documentclass[a4paper,twocolumn,10pt]{article}
>> =A0 \usepackage[T1]{fontenc}
>> =A0 \usepackage[american,german]{babel}

>
>The file is not 100% identical to my use case. I need to be able to
>switch between german and US english in the main file. The babel
>package is included from a common file. Specifying the language in
>documentclass was the only way to tell babel which language to use. Do
>you know another way to achieve this?

\PassOptionsToPackage{american,german}{babel}
\usepackage{babel}

does it without the dodgy business of using class options.

>> The definition you are giving of \quotes is wrong. At the time of
>> your "definitions", the active language is german, so only the first
>> conditional is true and evaluated.
>
>As I said, I'm switching between the two languages depending on the
>language of the "main" file. I would like to have as little code as
>possible in the (generated) main file.
>
>> OTOH, the " character can be obtained (in the T1 encoding) with
>> \textquotedbl, independently from the language used. Thus
>>

>> =A0 \newcommand{\quotes}{\textdblquote}


>>
>> is what you are looking for.
>
>This gives me:
>
>! Undefined control sequence.
>\quotes ->\textdblquote

\usepackage{textcomp}
\newcommand{\quotes}{\textdblquote}

(enrico forgot the textcomp package -- the command is a ts1-encoding
thing, not t1-encoding.)

>I've tried:
>
>\newcommand{\quotes}{"}
>
>before the babel package and this works but \newcommand in \iflanguage
>will cause an error in TeXlive 2008.

use \renewcommand inside the \iflanguage, if the command's already
defined. most people would do it that way, actually -- define a
command (typically with no expansion), and then redefine it according
to options given.
--
Robin Fairbairns, Cambridge

Aaron Digulla

unread,
Jan 20, 2009, 10:46:46 AM1/20/09
to
To clear this up: This is not about quotes. This code also fails:

------------------- test.tex ----------------------------
\documentclass[a4paper,twocolumn,10pt,american]{article}
\usepackage[T1]{fontenc}
\usepackage[german,american]{babel}

\newcommand{\quotes}{y}
\iflanguage{german}%
{
\newcommand{\xXx}{y}
}{}
\iflanguage{american}%
{
\newcommand{\xXx}{z}
}{}

\begin{document}
\normalfont
\xXx{}Text2.\xXx{}
\end{document}
------------------- test.tex ----------------------------

with

-------------------- output -----------------------------
! LaTeX Error: Command \xXx already defined.


Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.13 }{}
-------------------- output -----------------------------

The command is most certainly not defined already :) Note that the
line of error is not the command definition but the "else" part of the
\iflanguage.

Here is the output of \listfiles:

*File List*
article.cls 2005/09/16 v1.4f Standard LaTeX document class
size10.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
babel.sty 2008/07/06 v3.8l The Babel package
english.ldf 2005/03/30 v3.3o English support from the babel system
germanb.ldf 2008/06/01 v2.6m German support from the babel system
***********

Regards,

Enrico Gregorio

unread,
Jan 20, 2009, 10:51:22 AM1/20/09
to
Robin Fairbairns <rf...@cl.cam.ac.uk> wrote:

> \usepackage{textcomp}
> \newcommand{\quotes}{\textdblquote}
>
> (enrico forgot the textcomp package -- the command is a ts1-encoding
> thing, not t1-encoding.)

No, the command has just a different name, \textquotedbl :(
(I shall write 100 times "I must use `copy and paste'")

Ciao
Enrico

Aaron Digulla

unread,
Jan 20, 2009, 10:52:16 AM1/20/09
to
On 20 Jan., 15:58, Lars Madsen <dal...@RTFSIGNATUREimf.au.dk> wrote:

> \documentclass[a4paper,twocolumn,10pt]{article}
> \usepackage[T1]{fontenc}
> \usepackage[english,ngerman]{babel}
> \usepackage[babel,english=american,german=swiss]{csquotes}
> \begin{document}
> \enquote{Text.}
>
> \selectlanguage{english}
>
> \enquote{Text.}
>
> \selectlanguage{ngerman}
>
> \enquote{Text.}
>
> \end{document}

Thanks for the input. All text in the file is in a single language, I
never have to switch. Here is how my main file looks like:

\documentclass[a4paper,twocolumn,10pt,american]{article}
% some settings, lengths, copyright date, etc.
\input{common}
\begin{document}
all text
\end{document}

The example I posted is basically "common.tex".

So I'm looking for the correct way select the language "american"
*outside* common.tex plus in common.tex, I need to check what the
current language is. So maybe I'm looking for a way to \selectlanguage
before babel is loaded.

Maybe I have to split the file :(

Thanks a lot,

Aaron Digulla

unread,
Jan 20, 2009, 11:06:40 AM1/20/09
to
On 20 Jan., 15:56, r...@cl.cam.ac.uk (Robin Fairbairns) wrote:

>  Aaron Digulla <adigu...@gmail.com> writes:
>
> >Okay, after some more testing, I can confirm that using \newcommand
> >inside of \iflanguage causes the error. I can put anything into the
> >parameters #1 and #2, it doesn't matter. Having this text "\newcommand
> >{\xxx}{yyy}" in there is enough to throw "\xxx already defined.". Any
> >ideas why?
>
> it's a mystery: your test file works for everyone who's posted
> (including me), but not for you.

Okay, I found it. I had a warning in babel that it couldn't load the
hypenation patterns for German. So I installed "collection-
langgerman". Now, the error is gone. The output of /listfiles hasn't
changed, though.

Any ideas how the two issues could be related?

Regards,

Lars Madsen

unread,
Jan 20, 2009, 11:10:32 AM1/20/09
to

this works just fine, you are just telling csquotes that under these
languages use these types of quotes (american is more or less an alias
ofr english)

\documentclass[a4paper,twocolumn,10pt,
%american,
german
]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}


\usepackage[babel,english=american,german=swiss]{csquotes}
\begin{document}
\enquote{Text.}

\end{document}

Heiko Oberdiek

unread,
Jan 20, 2009, 3:55:15 PM1/20/09
to
Aaron Digulla <adig...@gmail.com> wrote:

> To clear this up: This is not about quotes. This code also fails:
>
> ------------------- test.tex ----------------------------
> \documentclass[a4paper,twocolumn,10pt,american]{article}
> \usepackage[T1]{fontenc}
> \usepackage[german,american]{babel}
>
> \newcommand{\quotes}{y}
> \iflanguage{german}%
> {
> \newcommand{\xXx}{y}
> }{}
> \iflanguage{american}%
> {
> \newcommand{\xXx}{z}
> }{}

Ok, if you don't have the hyphenation patterns, then
\iflanguage fails, because it is pattern based. If babel doesn't find
the right hyphenation patterns it uses american as default
(language number 0). Therefore both \newcommands are executed.
The second causes the error of course.

Use package `iflang', if you want to be independent on the patterns
and want to compare the language name:

\IfLanguageName{german}{%
% languagename is german
}{%
% otherwise
}

Yours sincerely
Heiko <ober...@uni-freiburg.de>

Aaron Digulla

unread,
Jan 21, 2009, 5:20:59 AM1/21/09
to
On 20 Jan., 21:55, Heiko Oberdiek <oberd...@uni-freiburg.de> wrote:

> Aaron Digulla <adigu...@gmail.com> wrote:
> > To clear this up: This is not about quotes. This code also fails:
>
> > ------------------- test.tex ----------------------------
> > \documentclass[a4paper,twocolumn,10pt,american]{article}
> > \usepackage[T1]{fontenc}
> > \usepackage[german,american]{babel}
>
> > \newcommand{\quotes}{y}
> > \iflanguage{german}%
> > {
> >     \newcommand{\xXx}{y}
> > }{}
> > \iflanguage{american}%
> > {
> >     \newcommand{\xXx}{z}
> > }{}
>
> Ok, if you don't have the hyphenation patterns, then
> \iflanguage fails, because it is pattern based. If babel doesn't find
> the right hyphenation patterns it uses american as default
> (language number 0). Therefore both \newcommands are executed.
> The second causes the error of course.

It would be great if babel would fail with a useful error message in
this case :/ I'll file a bug.

Thanks a lot!

0 new messages