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

How can I write the following code more concisely, without an ifcase statement? Please assume the command will only be called with integer arguments between 1 and 8, inclusive. Sorry for asking such a basic question---I'm new to macros.

\renewcommand{\@fnsymbol}[1]{\ifcase#1\or ^0 \or ^1\or ^2\or
                 ^3\or ^4\or ^5\or ^6\or ^7 \or ^8 \fi\relax}
share|improve this question
Do you mean something like \newcommand{\mysuperscript}[1]{$^{#1}$}? Do you plan on using this in text mode or in math mode? – Neo Jan 23 '13 at 3:38
LaTeX provides \textsuperscript{<stuff>} which "returns its argument as a superscript." – Werner Jan 23 '13 at 4:00
Welcome to TeX.SE. It might be helpful if you included some details as to exactly what you are trying to accomplish as there might be an easier way to do what you want. Also, for the way you have specd it, what do you want to happen if the parameter is not a single digit? – Peter Grill Jan 23 '13 at 4:15
Thanks, here's some context: I'm using a .cls file that defines a custom footer symbol. I don't like those footer symbols though, so I'm redefining the command (@fnsymbol) that generates the footer symbols. My command appears above, in the question. It works, but seems ridiculous to use "ifcase", just to write a command that returns its argument as a superscript. So I'm looking for a better way to duplicate the functionality of the above command. – Jeff Jan 23 '13 at 4:20
How about including a minimal working example (MWE) which would provide even more context to your current discussion? – Werner Jan 23 '13 at 4:43
up vote 3 down vote accepted

Is probably as concise as you could get as an answer to the question, although given the command name you used, you need a bit more as it needs to work with count registers not just literal digits \@fnsymbol{33} would work but not \@fnsymbol\c@footnote and it needs to work out of math mode so you need


But \textsuperscript is a better option as it uses the text fonts not the math ones.

share|improve this answer
Awesome! Thanks. – Jeff Jan 25 '13 at 0:43

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.