Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Welcome to TeX.SX! –  Papiro Jul 18 '13 at 11:30
    
Are all those <br\>s really in your document and the log? –  Loop Space Jul 18 '13 at 11:36
    
Ah, no, sorry about that, I added them by mistake when I was writing this post. Thanks for pointing this out! –  Lochness Monster Jul 18 '13 at 11:40
3  
Your \newenvironment is not complete and this can lead to disaster. Add {}{} after [Definition]. –  Ulrike Fischer Jul 18 '13 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. –  Ulrich Schwarz Jul 18 '13 at 11:57
add comment

1 Answer 1

up vote 12 down vote accepted

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

share|improve this answer
    
Wow! I salute your detective work. –  Loop Space Jul 18 '13 at 12:13
2  
@Andrew: make enough mistakes, eventually you'll have seen most of them before. ;) –  Ulrich Schwarz Jul 18 '13 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! –  Lochness Monster Jul 18 '13 at 12:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.