# In math mode, how can I display subscripts and superscripts in a different font from other math?

I came across something interesting in Advanced Engineering Mathematics by Erwin Kreyszig. As you can see in this image, subscripts are in a different font from the rest of the math:

How can I achieve this in LaTeX?

Any guidance would be appreciated. Thanks.

• @Mico Yet the n does look different in the subscript, it's not only the size. Don't misunderstand me: I don't find this particularly desirable. If I sum terms over an index n I want to use the same n (modulo size) everywhere. Using different font shapes or family for the same index doesn't strike me as particularly useful. – campa Feb 27 '18 at 14:25
• Yes, it's a prime example of bad typography. – egreg Feb 27 '18 at 14:31
• @campa - You're right. I had initially focused just on the upright vs. italic difference, and I completely failed to notice that Computer Modern (or a close relative) is used in first-level subscripts even though Times Roman is employed for text-style material. I fully agree with you that this setup is anything but desirable. – Mico Feb 27 '18 at 16:05
• @kreyszig-anon Please do not misunderstand us (I think I can speak for Mico and egreg too): your question ("how can I achieve this in LaTeX?") is legitimate. It's just that we think this shouldn't be achieved at all... :-) – campa Feb 27 '18 at 19:37

Only because egreg said it was a bad idea, not because I think you should do this

\documentclass{article}

\begin{document}
\sbox0{\scriptsize \ttfamily \xdef\tmp{\scriptfont1=\the\font}}\tmp

$x_{abc} = p^2 = abc_{abc}^{10}$

\end{document}


you could of course use something other than \ttfamily for the font to use.