latex

How to Create Subscripts in LaTeX

A subscript refers to a number, figure, or symbol written below the line. When working with scientific documents, you should expect Subscripts at some point or the other.

In this tutorial, we shall discuss using LaTex features to write subscript texts in our documents.

How to Write and Display Subscripts In LaTeX

To write a subscript, you start by telling math to enter math mode. Use the \[ to enter math mode.

However, if you do not need math mode, you can use \( formulae \). To write a subscript in LaTex, use the _{subscript value}

For example, consider the code below:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

The chemical formulae for water is \(H_{2}O\)

\end{document
}

You can also use $_${subscript value}

For example:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

The chemical formulae for water is H$_2$O

\end{document}

Examples

Let us look at a few examples.

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

The following equation shows the combustion of Heptane:

\[C_{7}H_{16} + O_{2} \rightarrow CO_{2}(g) + H_{2}O(g)\]

\end{document}

Here is another example:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

\[

\sqrt{

{\frac{\sum(x_{i} - \mu)^2}{N}}

}

\]

\end{document}

And now for a simple example:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

\[ \sum_{i=1} ^ {\infty \]

\end{document}

Final example:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}

The precipitation of Lead (II) Chloride

\[ Pb(NO_{3})_{2}(aq) + NaCl(aq) \rightarrow NaNO_{3}(aq) + PbCl_{2}(s) \]

\end{document}

The code above displays the output below:

Conclusion

In this tutorial, we discussed how to insert subscripts in LaTex documents.

Thank you for reading!

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list