Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
then you didn't put it into braces: ^{16}_{32}. That was the behaviour Alan already pointed out. –  Herbert 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
add comment

3 Answers

up vote 9 down vote accepted

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

share|improve this answer
    
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. –  Herbert 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
add comment

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}
share|improve this answer
add comment

Math mode:

sometext$^1_2$

or (with amsmath):

$\text{sometext}^1_2$
share|improve this answer
1  
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
add comment

Your Answer

 
discard

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.