Zum Inhalt springen

Introduction

The use of superscripts and subscripts is very common in mathematical expressions involving exponents, indexes, and in some special operators. This article explains how to write superscripts and subscripts in simple expressions, integrals, summations and so forth.

Definite integrals are some of the most common mathematical expressions, so let's see an example:

\[ \int\limits_0^1 x^2 + y^2 \ dx \]

 Open this example in Overleaf.


This LaTeX code produces:

\[ \int\limits_0^1 x^2 + y^2 \ dx \]

By convention, superscripts and subscripts in LaTeX are created using the characters ^ and _ respectively; for example, the exponents applied to \(x\) and \(y\) in the code fragment above. Those characters can also be used with mathematical symbols, such as the integral (\int) included in the example above where _ is used to set the lower limit and the ^ for the upper limit.

The command \limits changes the way the limits are displayed in the integral, if not present the limits would be next to the integral symbol instead of being on top and bottom:

\[ \int_0^1 x^2 + y^2 \ dx \]

 Open this example in Overleaf.


This LaTeX code produces:

\[ \int_0^1 x^2 + y^2 \ dx \]

More detailed examples

The symbols _ and ^ can also be combined in the same expression, for example:

\[ a_1^2 + a_2^2 = a_3^2 \]

 Open this example in Overleaf.


This LaTeX code produces:

\[ a_1^2 + a_2^2 = a_3^2 \]

If the expression contains long superscripts or subscripts, these need to be collected in braces, as LaTeX normally applies the mathematical commands ^ and _ only to the following character:

\[ x^{2 \alpha} - 1 = y_{ij} + y_{ij}  \]

 Open this example in Overleaf.

This LaTeX code produces:

\[ x^{2 \alpha} - 1 = y_{ij} + y_{ij} \]

Subscripts and superscripts can be nested and combined in various ways. When nesting subscripts/superscripts, however, remember that each command must refer to a single element; this can be a single letter or number, as in the examples above, or a more complex mathematical expression collected in braces or brackets. For example:

\[ (a^n)^{r+s} = a^{nr+ns}  \]

 Open this example in Overleaf.

This LaTeX code produces:

\[ (a^n)^{r+s} = a^{nr+ns} \]

Operators using subscripts and superscripts

Some mathematical operators may require subscripts and superscripts. The most frequent cases are those of the integral \int (check the introduction) and the summation (\sum) operators, whose bounds are typeset precisely with subscripts and superscripts.

\[ \sum_{i=1}^{\infty} \frac{1}{n^s} 
= \prod_p \frac{1}{1 - p^{-s}} \]

 Open this example in Overleaf.


This LaTeX code produces:

\[ \sum_{i=1}^{\infty} \frac{1}{n^s} = \prod_p \frac{1}{1 - p^{-s}} \]

For other frequently used operators that require subscripts/superscripts check the reference guide.

Open all code fragments in Overleaf

Use the link provided below to open all the examples above as a single Overleaf project:

Here are some examples of simple usage of subscripts and superscripts:

\[ \int\limits_0^1 x^2 + y^2 \ dx \]

\vspace{1cm}

Using superscript and subscripts in the same expression

\[ a_1^2 + a_2^2 = a_3^2 \]

\vspace{1cm}

Longer subscripts and superscripts:

\[ x^{2 \alpha} - 1 = y_{ij} + y_{ij}  \]

\vspace{1cm}

Nested subscripts and superscripts

\[ (a^n)^{r+s} = a^{nr+ns} \]

\vspace{1cm}

Example of a mathematical equation with subscripts and superscripts

\[ \sum_{i=1}^{\infty} \frac{1}{n^s} = \prod_p \frac{1}{1 - p^{-s}} \]

\vspace{1cm}

Squared root usage

\[ \sqrt[4]{4ac} = \sqrt{4ac}\sqrt{4ac} \]

 Open all the examples above as a single Overleaf project.


Reference guide

Additional examples and operators

LaTeX markup Renders as
a_{n_i}
\int_{i=1}^n
\sum_{i=1}^{\infty}
\prod_{i=1}^n
\cup_{i=1}^n
\cap_{i=1}^n
\oint_{i=1}^n
\coprod_{i=1}^n

There are also bigcup and bigcap commands similar to cup and cap but those are used for larger expressions.

Further reading

For more information see

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX