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.

It's easy to make subscripts in math mode: $a_i$.

How do I make a subscript outside math environment, likethis?

share|improve this question
add comment

10 Answers 10

Note that \textsubscript enters math mode as well. This might produce problems in PDF strings where math is not allowed, for instance in bookmarks. If you used hyperref and simply used \textsubscript in a section heading, hyperref would complain about the math shift. The command \texorpdfstring comes to the rescue:

\documentclass{article}
\usepackage{fixltx2e}
\usepackage{hyperref}
\begin{document}
\section{\texorpdfstring{like\textsubscript{this}}{like this}}
\end{document}

That applies to math and math symbols in sectioning headings of course as well.

share|improve this answer
4  
Useful to know! NB: just to be clear, the \texorpdfstring command is in the hyperref package. Would any other package have problems with this? –  Loop Space Aug 4 '10 at 14:12
1  
pdftex could have problems. Try \pdfoutline goto page 1 {/Fit} count 0 {like\textsubscript{this}} and have a look at the bookmark. –  Stefan Kottwitz Aug 4 '10 at 14:31
    
this is a neat trick ! I've had problems with math in section headers before. –  Suresh Aug 4 '10 at 17:40
add comment

This is included in the fixltx2e package:

\documentclass{article}
\usepackage{fixltx2e}

\begin{document}
like\textsubscript{this}
\end{document}

Interestingly (?), there's a \textsuperscript command already in LaTeX.

This is included already in the KOMA-Script bundle. If you want to typeset chemical formulas, have a look at the mchem package.

(Thanks to Caramdir for those last two.)

share|improve this answer
    
In @StefanKottwitz 's answer, he has used the same fixltx2e package. But he's also used the hyperref package. Is there a redundancy somewhere or am I missing something? –  Shashank Sawant Oct 15 '12 at 17:42
1  
@ShashankSawant Stefan's answer is: "if you use hyperref then you might want to do it like ..." So if you are already using hyperref and you want the subscript in headers, use his solution. Otherwise, this one ought to work. –  Loop Space Oct 15 '12 at 19:17
add comment

If you don't want to use additional packages you can use the following syntax:
like $_{\text{this}}$.

Alternatively, you can define a command \textunderscript in the beginning of your document:

\newcommand{\textunderscript}[1]{$_{\text{#1}}$}
share|improve this answer
    
\text needs the amstext package: perhaps you are thinking of \textup? –  Joseph Wright Aug 4 '10 at 14:06
    
Yes, for \text you need one of ams packages (amsmath is enough), but I don't carry about that because I use amsmath in virtually all my latex documents. –  fiktor Aug 4 '10 at 20:40
    
Something funny's happened to all the HTML entities in your answer! –  Loop Space Aug 4 '10 at 20:52
    
2Andrew: Thank you. Now they're right –  fiktor Aug 4 '10 at 22:14
    
Or you could use \mathrm{}, or even nothing... It's so tiny no-one will notice... =P –  daviewales May 15 '13 at 23:21
add comment

In ConTeXt, you can write

like\low{this}
share|improve this answer
add comment

Since I've always been bugged by the fact that LaTeX's sscripts need math mode (setting normal text inside math mode have issues with LuaTeX's directionality), motivated by this question, I "stole" the subscript/superscript code from ConTeXt which is set entirely in text mode, with quick hacks to get it work with plain TeX (needs pdftex/luatex though), it is here for now, if there is interest may be it can be turned into some package.

share|improve this answer
2  
As a bonus, it also provides a command, \lohi, to set sub and superscripts simultaneously. –  Khaled Hosny Sep 3 '10 at 12:56
    
Neat. I vote for a package. –  sgmoye Dec 15 '13 at 13:21
add comment

LaTeX provides \raisebox{<len>}{<stuff>} (based on TeX's \raise) which raises (and boxes) <stuff> by <len>. A negative <len> drops the contents:

enter image description here

\documentclass{article}
\begin{document}
It's easy to make subscripts in math mode: $a_i$.

How do I make a subscript outside math environment, 
like\raisebox{-.4ex}{\scriptsize this}?
\end{document}​
share|improve this answer
    
It seems like this nice trick does not work inside captions and tikz, am I wrong? –  mmj Jun 15 '13 at 16:34
1  
@mmj: Since it forms part of a moving argument, you have to use \protect\raisebox{..}{...}. –  Werner Jun 15 '13 at 16:41
add comment

If you use the $\text{}$ version and you have selected a different font (other than roman serif) then $\textnormal{}$ matches the font of the document. If you are using the default fonts, \text{} will work great.

share|improve this answer
add comment

Just for the record: Before of the already cited fixltx2e package, the command \textsubscript was also supplied by the little package subscript that still is working and included in TeX Live:

\documentclass{article}
\usepackage{subscript}
\begin{document}
like\textsubscript{this}
\end{document}
share|improve this answer
1  
This is exactly the same as Andrew's answer. –  Werner Dec 15 '13 at 1:53
    
@Werner I don't think so. Andrew's answer is about the fixltx2e, I mention the older package subscript. I have not seen any mention to this package in any other answer. (and yes, I know that the command is exactly the same in both packages, I said "just for the record" for this reason...). –  Fran Dec 15 '13 at 2:59
add comment

The way I do it is by using mathrm inside math environment:

$\mathrm{like_{this}}$
share|improve this answer
2  
Welcome to TeX.SX! –  egreg Jan 21 at 10:05
add comment

I get this done by using the mhchem package. It's normally used for writing chemical formulas, but you can use it for this problem, too.

\usepackage[version=3]{mhchem}
\begin{document}
\ce{like_{this}}
\end{document}

mhchem doesn't print spaces when you put them in the subscript part. To get the spaces in the subscript part, you'll have to escape them using backslashes:

\usepackage[version=3]{mhchem}
\begin{document}
\ce{like_{this\ and\ this\ and\ this}}
\end{document}
share|improve this answer
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.