[Tex/LaTex] Difference between \scriptsize and \scriptstyle

fontsfontsize

I know that "scriptstyle" is a style, and "scriptsize" is a font size, but what are the main differences between the two? Is it merely that "scriptstyle" should be used in math mode, and "scriptsize" should generally not? I also understand that both are defined as 30% reduced from the default font size, or no?

Best Answer

While it is true that one is to be used in text mode, the other in math mode, also remember, smaller than \scriptsize is \tiny, but a script of a \scriptstyle is a \scriptscriptstyle. Thus, the context of the two terms (\scriptsize and \scriptstyle), while both using the word script, is actually different. One refers to font size, the other to sub- and super-scripting.

We can see that they are fundamentally different in the following MWE, where \scriptstyle does not produce something in \scriptsize if one was already in \scriptsize to begin with. That is to say, the final X is not in \scriptsize, even though \scriptstyle is invoked at the time.

\documentclass{article}
\begin{document}
$X \scriptstyle X$
versus
\scriptsize$X \scriptstyle X$
\end{document}

enter image description here

As to how it is brought about in TeX, know that \scriptstyle is one of the boxes built via \mathchoice (the other three are \displaystyle, \textstyle, and \scriptscriptstyle) whereas none of that process applies to the invocation of \scriptsize which changes the font size characteristics. You could even say that \scriptstyle shares more in common with \displaystyle (in terms of how it is implemented) than with \scriptsize.