How to put a superscript in LaTeX outside math mode?

Superscripts are usually used in mathematics equations, chemical symbols, and sometimes in article writing. In this tutorial, we will discuss how superscript is used in LaTeX text mode.

Using single dollar for superscript

Usually for using superscripts in LaTeX, just use the ^ symbol in math mode. For example

\documentclass{article}
\begin{document}
  $$ a^n,\;a^2 $$
\end{document}

Output :

superscript in math mode in latex.

But without math mode, the ^ symbol doesn’t work. In that case, you can write superscript in inline mode using single dollar. take a look

\documentclass{article}
\begin{document}
  the n$^{th}$ element \\[4pt]
  1$^{st}$, 2$^{nd}$, 3$^{rd}$\\[4pt]
  What is the n$^{th}$ term formula for the number of triangles?
\end{document}

Output :

superscript using single dollar in latex.

But as you can see in the example above, the text formatting looks like math mode to use single dollar quotations. You can use the \mathrm{} command to remove this math mode formatting. And you don’t need to use any package for this.

\documentclass{article}
\begin{document}
  the n$^{\mathrm{th}}$ element \\[4pt]
  1$^{\mathrm{st}}$, 2$^{\mathrm{nd}}$, 3$^{\mathrm{rd}}$\\[4pt]
  What is the n$^{\mathrm{th}}$ term formula for the number of triangles?
\end{document}

Output :

using mathrm command.

Using \textsuperscript for superscript

LaTeX provides a command to use superscripts outside of math mode, which is \textsuperscript{}. By this command, you can easily use superscript in normal text mode without any dollar quotation.

This command can be used in both text mode and math mode and you don’t need to use any package for this.

\documentclass{article}
\begin{document}
  the n\textsuperscript{th} element \\[4pt]
  1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}\\[4pt]
  What is the n\textsuperscript{th} term formula for the number of triangles?
\end{document}

Output :

Using textsuperscript in latex.

Leave a Comment

Your email address will not be published. Required fields are marked *