13

this is an easy question, but I couldn't find the answer just from other similar questions.

A lot of people often get an error in the form:

    LaTeX Error: Command \XYZ already defined. 
                 Or name \end... illegal, see p.192 of the manual.

usually, the problem is that they are using something that is defined in 2 different packages, so LaTeX is confused about what to do with the command.

My symptoms are similar: after lines

88     \begin{definition}
89     The distribution of a random variable $X$ is usually described by giving its {\bf distribution function}, $f(x) = P(X \leq x)$.
90     \end{definition}

my TeXShop is saying:

   89:LaTeX Error: Command \c@T already defined.
                   Or name \end... illegal, see p.192 of the manual.

So, I tried to find where could command \c@T be defined. I'm only using

    \usepackage{amssymb,amsmath}
    \usepackage{changepage} 

and I don't really see how they could both define command c@T.

I looked at the list of all commands in LaTeX, at http://www-sop.inria.fr/marelle/tralics/doc-c.html#cmd-citetype, and I haven't even found such command, but it looked like some kind of counting is the problem. So, I admit that I also have

    \begin{document}
    \newenvironment{definition}[1][Definition]
    \newcounter{definition}

which might be the place where I defined something in the wrong way, but I don't see why wouldn't this problem come up in the previous definitions.

If anyone had patience to solve this old problem again and explain it to me, I would really appreciate it.

4
  • Are all those <br\>s really in your document and the log? Jul 18, 2013 at 11:36
  • Ah, no, sorry about that, I added them by mistake when I was writing this post. Thanks for pointing this out! Jul 18, 2013 at 11:40
  • 3
    Your \newenvironment is not complete and this can lead to disaster. Add {}{} after [Definition]. Jul 18, 2013 at 11:55
  • 3
    \c@(thing) is an internal part of the counter called (thing), namely the part that stores the value. In your case, that would mean you ahve two \newcounter{T} in your code. Jul 18, 2013 at 11:57

1 Answer 1

16

What's apparently happening is the following: as @Ulrike remarks, your \newenvironment lacks its two mandatory arguments. It will instead pick up \newcounter and definition, since that is what follows.

What this does is that when you call \begin{definition}, you inadvertently call \newcounter, so

\begin{definition} The thing

turns into, with some technicalities omitted,

\newcounter The thing

i.e.

\newcounter{T}he thing

and that's where your counters come from and that's why you get an error: you probably have to definitions that start with "T"!

(To backtrack and solve your problem: I think you really mean to look at the amsthm package and its \newtheorem command?)

3
  • Wow! I salute your detective work. Jul 18, 2013 at 12:13
  • 3
    @Andrew: make enough mistakes, eventually you'll have seen most of them before. ;) Jul 18, 2013 at 12:15
  • Thank you very much, Ulrike and Ulrich! It was enough, as Ulrike suggested, to add {}{} after \newenvironment{definition}[1][Definition]{}{} Thanks to Ulrich's explanation, I see how did the \c@T appear. Also, looking at the amsthm package will be useful for the future. Vielen Dank! Jul 18, 2013 at 12:23

You must log in to answer this question.

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