Subscripts and Superscripts in LaTeX - Complete Guide
Master subscripts and superscripts in LaTeX. Learn proper notation for indices, exponents, chemical formulas, and complex mathematical expressions.
Master subscripts and superscripts in LaTeX for mathematical expressions, scientific notation, and technical documentation. This comprehensive guide covers everything from basic usage to advanced techniques for complex notation.
Quick start: Use _ for subscripts and ^ for superscripts. For multiple characters, enclose in braces: x_{12} and x^{2n}.Prerequisites: Basic LaTeX knowledge. For math mode basics, see Mathematical Expressions.
\documentclass{article}\usepackage{amsmath}\begin{document}% Single character subscript$x_1$, $x_2$, $x_n$% Multiple character subscript (requires braces)$x_{12}$, $x_{n+1}$, $x_{max}$% Variables with subscripts$a_i$, $b_j$, $c_{ij}$% Greek letters with subscripts$\alpha_1$, $\beta_{n}$, $\gamma_{i,j}$\end{document}
\documentclass{article}\usepackage{amsmath}\begin{document}% Single character superscript$x^2$, $x^n$, $x^*$% Multiple character superscript (requires braces)$x^{10}$, $x^{2n}$, $x^{n+1}$% Common exponents$e^x$, $2^n$, $10^{-3}$% Special notations$x^{\prime}$, $x^{\dagger}$, $x^{\ast}$\end{document}
\documentclass{article}\usepackage{amsmath}\begin{document}% Both subscript and superscript$x_1^2$, $a_n^m$, $x_i^{j+1}$% Order doesn't matter$x_1^2 = x^2_1$% Complex combinations$x_{n+1}^{2m}$, $a_{ij}^{kl}$% With operators$\sum_{i=1}^n$, $\int_0^{\infty}$% Tensor notation$T_{\mu\nu}^{\rho\sigma}$\end{document}
\documentclass{article}\usepackage{amsmath}\begin{document}% Single prime$f'(x)$, $y'$% Multiple primes$f''(x)$, $f'''(x)$% Alternative notation$f^{\prime}(x)$, $f^{\prime\prime}(x)$% With subscripts$x'_1$, $x''_n$% Prime on subscript$x_{n'}$, $x_{n''}$\end{document}
\documentclass{article}\usepackage{fixltx2e} % For \textsubscript\begin{document}% In text modeH\textsubscript{2}O is water.E = mc\textsuperscript{2} is Einstein's equation.% Or use math modeH$_2$O is water.E = mc$^2$ is Einstein's equation.% Ordinals1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}% Footnote markersText\textsuperscript{a}, Reference\textsuperscript{1}\end{document}