85

How to put a symbol above (on the head of) another? For example, I want to produce something like this in one line.

a
#

i.e., a above #.

The effect should be almost the same with $#^a$ except that a is on the top instead of top right of #.

Mateusz Piotrowski
  • 8,029
  • 10
  • 53
  • 79
day
  • 2,292
  • 1
  • 20
  • 23
  • Do you want them both to be the same size? And how should they appear in relation to the surrounding text? Should the # be in line with the text, or should the midpoint between a and # be in line with it? – Artelius Jun 23 '10 at 03:12
  • Thanks for the quick reply Artelius. About their size, the above one is smaller would be preferred. The effect should be the same as $#^a$ except that 'a' is on the top of '#' other than on the top right of '#'. – day Jun 23 '10 at 03:26
  • Ah, thanks for the reminder. Gonna read the FAQ. – day Jun 23 '10 at 04:04
  • 2
    This was closed as off topic. I think it should be migrated to TeX.se. It may not be able to, because it's too old. At the time of its posting it was accepted that LaTeX was a programming language and that such questions were welcome here. – Geoff Dec 04 '13 at 13:51
  • 1
    For future: http://tex.stackexchange.com/ – Martin Thoma Jun 28 '16 at 11:34

3 Answers3

116

Use \overset{above}{main} in math mode. In your case, \overset{a}{\#}.

Artelius
  • 48,337
  • 13
  • 89
  • 105
25
${a \atop \#}$

or

${a \above 0pt \#}$
Alexey Malistov
  • 26,407
  • 13
  • 68
  • 88
  • 1
    Alexey, LaTeX complains the two commands are foreign. Also, the two symbols are put equal size which is not what I wanted. Artelius's answer matches my needs perfectly. Anyway, thank you all the same. – day Jun 26 '10 at 06:58
25

If you're using # as an operator, consider defining a new operator for it:

\newcommand{\pound}{\operatornamewithlimits{\#}}

You can then write things like \pound_{n = 1}^N and get:

alt text

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Geoff
  • 7,935
  • 3
  • 35
  • 43