Possible Duplicate:
\newcommand name cannot include numbers, e.g., \Mycomand123

I am trying to define commands \s1, \s2, etc. Right now the the substitution is very simple but the idea would be to replace it for something that would make for sense later.

This is what I have now


and I get the following error:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.52 \newcommand{\s1}{s1}

If I comment the line with the newcommand definition it works fine. (And I other other newcommands defined in the same location, and I do have a \begin{document})

Any idea of what I am doing wrong?

  • 1
    command names have to be all letters – David Carlisle Dec 6 '12 at 16:33
  • 1
    LaTeX internal macros use the trick of using roman numerals for numbered macros. In your case \si, \sii, \siii, \siv etc – JLDiaz Dec 6 '12 at 16:35

Only letters (and @ in some cases) can be parts of names of commands defined by \newcommand. You have to use the lower-level macro \@namedef:

\makeatletter % to make \@namedef accessible
\makeatoter % to revert \makeatletter

However, you wouldn't be able to use such command as \s1, you would have to always write \csname s1\endcsname. I don't think it is of any use for you, just stick to letters.

Remark: I made several simplifications in the answer. I know I did. But this is the basic idea.

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