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

This is what I want to achieve:

{ 2 \pow -(n+4) } --> {2^{-(n+4)}}

This is what I know how to do:


This is what I don't like about it:

\pow{2}{-(n+4)} is ugly to me.

Now, I know that plain TeX can do things like this due to:

\over, \choose, \above



"shows that such commands are internals."

I have dug into the TeX book (chapter 20), but do not see examples of how arguments can be to the left, i.e. I want something like:

\def #1\pow #2 {{#1}^{#2}}

Then, I tried things like:

\def \pow #1 \} {^{#1}\}}

However, neither of these work. Is it possible to define pow s.t.

{ 2 \pow -(n+4) } --> {2^{-(n+4)}}
share|improve this question
\over is a primitive, and therefore does not implement the syntax in macros. Alexey's solution may work for you, but in TeX arguments have to come after the macro processing them (so in your case more complex 'before' parts may go wrong). – Joseph Wright Aug 18 '11 at 10:18
\newtoks \powtoks
\def \pow {\afterassignment\powhelp \powtoks=\bgroup }
\def \powhelp{^{\the\powtoks} \egroup }
share|improve this answer

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.