Subscripts and superscripts
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
- List of Greek letters and math symbols
- Operators
- Integrals, sums and limits
- Mathematical fonts
- Brackets and Parentheses
- The Great, Big list of LaTeX Symbols (a full list of available mathematical symbols in the amssymb package)
- The not so short introduction to LaTeX2ε
- Aligning equations with amsmath
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class