Double superscript
Introduction
By convention, LaTeX uses the circumflex character (^
) to typeset a superscript, such as $a^b$
which produces $a^b$. If you write $a^bcde$
, only the first character, b
, is superscript, as in $a^bcde$, because LaTeX does not assume you want to superscript the entire set of characters bcde
. To typeset multiple items (tokens) as superscripts, you need to tell LaTeX by enclosing them in a group {...}
, like this: $a^{bcde}$
, which produces $a^{bcde}$.
Double superscript error
The double superscript error arises when LaTeX is asked to add a superscript to a piece of mathematics which already has a superscript attached to it. This error is usually resolved through the use of braces {...}
, which, within math mode, generate a so-called subformula—a term used to describe a fragment of the mathematical expression you are trying to typeset.
For example, writing $a^b^c$
generates the following double superscript error:
This particular error can be fixed in several ways through the use of braces {...}
—the results vary according to where the braces are positioned:
$a^{b^c}$
typesets $a^{b^c}$${a^b}^c$
typesets ${a^b}^c$$a^{bc}$
typesets $a^{bc}$
Double superscript error: special cases
Superscripts and accents
A question on tex.stackexchange
contains a surprising example of the double subscript error whose underlying cause, and solution, also applies to double superscripts. The following example fails to compile, even though braces are used:
\documentclass{article}
\begin{document}
\({\vec a^b}^c\)
\end{document}
Open this error-generating example in Overleaf
As with the double subscript error, one way to fix the problem is to add the accents
package to your document preamble (as suggested here):
\documentclass{article}
\usepackage{accents}
\begin{document}
\({\vec a^b}^c\)
\end{document}
Open this corrected example in Overleaf
Using primes with superscripts
Another common cause of the error is the use of primes with superscripts, which is particularly troublesome for tensor notation—as shown below:
\documentclass{article}
\begin{document}
\[T'_{\nu_{1}\nu_{2}\ldots\nu_{p}}^{\mu_{1}\mu_{2}\ldots\mu_{q}}\]
\end{document}
Open this error-generating example in Overleaf
This example triggers the following error:
In math mode, LaTeX will interpret the primed symbol T'
as T^{\prime}
—i.e., it adds a superscript to the T
. When LaTeX subsequently inputs the circumflex character, ^
, as it reads ^{\mu_{1}\mu_{2}\ldots\mu_{q}}
, it detects an attempt to add a second superscript to the T
, and that triggers the error.
The correct way to write the above expression is demonstrated in the next example:
\documentclass{article}
\begin{document}
\[T_{\nu_{1}\nu_{2}\ldots\nu_{p}}^{\prime\mu_{1}\mu_{2}\ldots\mu_{q}}\]
\end{document}
Open this corrected example in Overleaf
This example produces the following output (enlarged for clarity):
More on superscripts
Further levels of superscripts can be typeset by writing LaTeX such as a^{b^{c^{d^e}}}
which typesets $a^{b^{c^{d^e}}}$. All superscripts at or above the second level are typeset using the same font size (in points), whereas first-level superscripts use a slightly larger font (point size). To learn more about superscripts, visit Overleaf's help page dedicated to that topic.
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