TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I am trying to use the chosen solution shown here, for being able to use numbers in the alias I need for \newcommand. (That one is not able to use numbers in the alias directly strikes me as ... well, let me remain polite).

Anyway, even if I implement the top solution there, I get an error and the code cannot compile. My usage:

And so \H1 is now equal to foo.

Perhaps there is something small I am missing, (I am a tex noob), and so any help would be appreciated.

share|improve this question
See here tex.stackexchange.com/a/9720 – Sigur May 15 '13 at 15:12
up vote 9 down vote accepted

Your first problem is that \H is already defined. (Indeed, if you look at your compilation log, you'll see it says "LaTeX Error: Command \H already defined.") So you should change it to a different name, say, \Hankel. (Alternatively, you can overwrite the previous definition by using \renewcommand in place of \newcommand. But if you do, use caution, because some parts of your document might be relying on the old definition without you realising it.)

Your second problem is that superscripts (^) and subscripts (_) only work in math mode. You can toggle math mode using the $ character. So try replacing \Hankel1 with $\Hankel1$. Alternatively, you can make the macro work both inside and outside math mode, by using \ensuremath like so:

share|improve this answer
You are a genius! This works like I envisioned. Danke! ;-) – TyranaSaur May 15 '13 at 15:26

Your Answer


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.