2

Possible Duplicate:
Definining commands/abbreviations that contain numbers

I'm having some difficulty with setting a command using \newcommand. The command I'm trying to create is as follows:

\newcommand{
        checklist1Start
    }
    {
        \begin{description}[style=multiline,
            itemsep=\itemSeparationDistance,
            leftmargin=\leftMarginDistance,
            itemindent=\itemIndentDistance,
            labelindent=\labelIndentDistance,
            font=\normalfont]
    }

The distances shown are defined using other other uses of \newcommand, in the following manner:

\newcommand{\leftMarginDistance}{9 cm}

The error returned on attempting to compile is as follows:

! Missing number, treated as zero

Could you point me in the right direction on using \newcommand properly here?

Many preemptive thanks for any assistance

  • 1
    Basically, you can't (or at least shouldn't) define commands whose name contains numbers. See tex.stackexchange.com/questions/9718/… – lockstep Aug 14 '12 at 19:48
  • 2
    Since those "inner commands" are in fact lengths, why dont you define them as lengths? E.g. \newlength\leftMarginDistance and \setlength\leftMarginDistance{9cm} – JLDiaz Aug 14 '12 at 19:55
  • 1
    Are you using enumitem? Why not create a new custom list type? A simple example is found in tex.stackexchange.com/questions/37740/enumerate-with-properties/… – Torbjørn T. Aug 14 '12 at 19:56
  • @lockstep, true, but that is not the case here. – JLDiaz Aug 14 '12 at 19:58
  • @JLDiaz Seems like "checklist1Start" to me. (I didn't spot it instantly, too.) – lockstep Aug 14 '12 at 20:00
12

The token in the first argument of \newcommand has to be a single token such as \zzzz not a sequence of white space, letters and numbers. You get the same error message for any definition you make in the second argument. You get exactly the same error for

 \newcommand{ checklist1Start }{}
| improve this answer | |
  • 2
    Specifically, the token must include the leading backslash. Bites me every time. – hertzsprung Mar 17 '15 at 10:39

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