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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

share|improve this question

marked as duplicate by lockstep, Martin Schröder, Marco Daniel, percusse, yo' Aug 23 '12 at 6:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

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 }{}
share|improve this answer
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.