[Tex/LaTex] LaTeX Error: Command \c@T already defined


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


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


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.

Best Answer

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


\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?)