21

I would like to show both super and subscript together some text.

I tried this sometext\textsuperscript{1}\textsubscript{2}

But 2 does not show up right below 1.

Thanks for your help. Also how can I show 1 & 2 in front of sometext as well.

regards Aku

I tried some both the answers posted below and here is the attachment. I was trying to put 2 digit number 16 and 32 in superscript and subscript. alt text

alt text

  • then you didn't put it into braces: ^{16}_{32}. That was the behaviour Alan already pointed out. – user2478 Jan 4 '11 at 19:51
  • This is also an argument in favour of never leaving the braces off after ^ and _ in answering these types of questions. :-) – Alan Munn Jan 4 '11 at 21:38
18

without using directly math and with colors:

\documentclass{article}
\usepackage{fixltx2e}
\usepackage{xcolor}
\def\SPSB#1#2{\rlap{\textsuperscript{\textcolor{red}{#1}}}\SB{#2}}
\def\SP#1{\textsuperscript{\textcolor{red}{#1}}}
\def\SB#1{\textsubscript{\textcolor{blue}{#1}}}

\begin{document}
\huge
sometext\SPSB{1}{2} more text

sometext\SP{1} more\SB{2} text\SP{1}

\end{document}

alt text

  • Why it is reducing the text size of "sometex" & "more text" to scriptsize. It should be in the normal size and only sub-superscript should reduce in size – Aku Jan 4 '11 at 20:31
  • @Aku: I cannot see it. Give an example. – user2478 Jan 4 '11 at 20:41
  • sorry, it was the document view, because of which I thought it coming as scriptsize. It works just fine – Aku Jan 4 '11 at 22:53
12

use it in math mode, digits are always set in upright mode.

\documentclass{article}
\usepackage{fixltx2e}
\begin{document}
\Huge
sometext\textsuperscript{1}\textsubscript{2}

sometext$^1_2$ \qquad$^1_2$sometext

\end{document}
8

Math mode:

sometext$^1_2$

or (with amsmath):

$\text{sometext}^1_2$
  • 2
    Remember that if you need non-numeric sub- and superscripts, you'll need to enclose them in text{} (from amsmath). e.g. sometext$^{\text{super}}_{\text{sub}}$ otherwise the text won't come out correctly. – Alan Munn Jan 4 '11 at 17:51
  • That's right. But it's not clear whether sometext\textsuperscript{1}\textsubscript{2} should be in text mode. Afterall, numbers are always typeset in the same typeface by default. – Leo Liu Jan 6 '11 at 4:59

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.