Italicize superscripts and subscripts in math mode

italicsubscriptssuperscripts

I'm pretty new in LaTeX, but I was surprised when in math mode subscripts and superscripts weren't italic. How can I solve this issue?

Here's my code:

$(Z(\bm{\mathrm{s}}\textsubscript{1}), ...,
Z(\bm{\mathrm{s}}\textsubscript{n}))\textsuperscript{\mathit{T}}$

code_sub_sup

I'm talking about the "1", the "n" and the "T" characters. Thank you all.

Best Answer

As the name implies, the commands \textsubscript and \textsuperscript are used to typeset subscripts and superscripts in text mode, not in math mode. Indeed, compiling your code in the minimal document

\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
$(Z(\bm{\mathrm{s}}\textsubscript{1}), ..., Z(\bm{\mathrm{s}}\textsubscript{n}))\textsuperscript{\mathit{T}}$
\end{document}

yields the error

LaTeX Error: \mathit allowed only in math mode. [...tsubscript{n}))\textsuperscript{\mathit{T}}]

because \mathit is a math command, whereas \textsuperscript expects its argument to be text.

To typeset subscripts and superscripts in math mode, you should use _ and ^ respectively. So your code should rather be something like the following.

\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
$(Z(\bm{\mathrm{s}}_1), ..., Z(\bm{\mathrm{s}}_n))^T$
\end{document}

Then the "n" and the "T" are italic, as usual math characters.