# How to prevent adding subscript from italicizing the text thereafter?

When I try to add subscript(I write O_L and O_R to denote left and right ) in my text all the text after that becomes italicized. Any ideas what might be causing this?

-
–  Caramdir Jun 8 '11 at 17:27
i'm surprised that nobody has mentioned the fact that unless O_L and O_R are entered in math mode, the job should stop with the error message ! Missing $inserted. that's an unambiguous indication that math mode is being entered as tex tries to recover. the _ and what's being subscripted need to be explicitly in math mode to avoid side effects. – barbara beeton Jun 9 '11 at 12:35 add comment ## 4 Answers \documentclass{article} \begin{document} Age of empire: O$_\textrm{\scriptsize R}$and O$_\textrm{\scriptsize L}$. What is next? \end{document}  - It worked ! Thanks – rty Jun 8 '11 at 17:13 Semantically there is a better solution. Check the link Caramdir posted in a comment above (this question is a duplicate of that question). – N.N. Jun 8 '11 at 17:33 add comment You can't use the subscripts in text mode but only in math mode, so you have two options: the one suggested by xport or using the specific command given by the babel package. For example if you write in italian, the package babel allows you to use the command \ped in this way: \documentclass{article} \usepackage[italian]{babel} \begin{document} Hi\ped{hi} \end{document}  I think it will exist a similar command for your language too! ## EDIT: It looks like that the \ped and \ap commands are defined only for italian! If you want to use them you can copy the definitions from the babel manual. So the next example will work: \documentclass{article} \usepackage[<your language>]{babel} \makeatletter \DeclareRobustCommand*{\bbl@ap}[1]{\textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}% \DeclareRobustCommand*{\bbl@ped}[1]{\textormath{$_{\mbox{\fontsize\sf@size\z@ \selectfont#1}}$}{_\mathrm{#1}}}% \let\ap\bbl@ap \let\ped\bbl@ped \makeatother \begin{document} Hi\ped{hi}\ap{hi}$Hi_{hi}^{hi}\$
\end{document}


As you can see the positions of subscript and superscript together is a bit different than the one in math mode!

-

The way I use subscript and superscript in regular text is using the following two commands

\newcommand{\sur}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\sous}[1]{\ensuremath{_{\textrm{#1}}}}


Then it's just a matter of using

O\sur{superscript}
O\sous{subscript}


Of course, you can name those as you want, you don't hate to keep the french names I use :)

-
You need to override this behavior whenever you have a multi-character identifier, a multi-character subscript, a multi-character superscript, or any other multi-character entity and TeX is in math mode. There are lots of ways to accomplish this. All of them temporarily throw TeX back into LR (text) mode. One simple approach is to put the entity in a box. Another, and my personal choice, is to use the \text command provided by the AMS math package. Then again, that is because I \RequirePackage{amsmath} or \usepackage{amsmath} in all of my LaTeX documents.