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.

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

Possible Duplicate:
How to typeset subscript in usual text mode?

I sometimes want to typeset something simple like $N_2$ or $3^2$ in a Heading, other times in a paragraph of normal text. I want all of it to be typeset in the surrounding font. In normal text this works quite good with $\textrm{N}^\textrm{2}$, even though it is too complicated. For Headings I have to know how my headings are typeset (if they use sans, italic, bold, etc.) And if I then use the appropriate command and later change my mind about heading formatting, I have to redo it. Is there a command to somehow "step out" of math into whatever is the highermost level of current formatting?

So far I could only find answers like: use this package, or this command (that only solves a specialized case). I am looking for a more general understanding of what's going on, does someone have a link at hand to a short summary to the fonts and their interaction in LaTeX?

share|improve this question

marked as duplicate by percusse, Tom Bombadil, diabonas, clemens, Harish Kumar Sep 13 '12 at 3:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See tex.stackexchange.com/q/1013/16895 – Guido Sep 10 '12 at 16:06
up vote 5 down vote accepted

Type your superscripts and subscripts using \textsuperscript and \textsubscript respectively. The former is defined in latex.ltx while the latter could be defined similarly:

enter image description here

% \textsubscript defined equivalent to \textsuperscript in latex.ltx
\section{Section $N^2$ and $N_2$}
\section{Section N\textsuperscript{2} and N\textsubscript{2}}

fixltx2e also provides the above defintion by default. So, adding

\usepackage{fixltx2e}% http://ctan.org/pkg/fixltx2e

to your document preamble would allow you to use \textsubscript.

share|improve this answer
fixltx2e defines \textsubscript: I'd always load this package for the fix to \( ... \) anyway. – Joseph Wright Sep 12 '12 at 6:36

To avoid the complicated phrases, which I often encounter when I want multi-character subscripts, I would normally put macros like these at the start of the document.

% Italic text with italic exponent
% Normal text with normal exponent
% Italic text with italic multi-character subscript index
% Normal text with normal subscript index

They can be used inside or outside of the math environments.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.