how to define such command ?

I've tried the \newcommand{\csname 1999 \csname}{saysomething}.

but it brings an error.

  • 3
    \expandafter\newcommand\expandafter{\csname 1999\endcsname}{Foo}. Bit you will not be able to use it as \1999, you have to use it as \csname 1999\endcsname or similar (\makeatletter\@nameuse{1999}\makeatother). In general I would say digits in command names are not worth it. – moewe Aug 9 at 5:42
  • 1
    In theory one could turn digits into letters for TeX so that they are allowed in control sequence names, but that brings with it all sort of other issues so that I can't really recommend that. See tex.stackexchange.com/q/317328/35864. – moewe Aug 9 at 5:45
  • 2
    Related: tex.stackexchange.com/q/9718/134144 – leandriis Aug 9 at 5:45
  • 1
    You could use Roman numerals instead of Arabic ones. – Peter Wilson Aug 9 at 16:37

TeX has it's idea that only letters can be part of longer (not one-character) command names. You can fool around redefining digits to be letters, or some such, but that will produce more problems than what it is worth.

Just write out your numbers in e.g. Roman (XIX for 19 and so) or use some English abbreviation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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