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?
2 Answers
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}
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.
- 37,330
- 237,551
-
Is \scriptstyle defined as 30% of the text size in the current environment then? – NeoVandermonde Apr 18 '18 at 10:56
-
1@NeoVandermonde I don't know the actual numbers (which may also be font dependent), but the gist is "yes,"
\scriptstylewill be a fraction of the current math size. – Steven B. Segletes Apr 18 '18 at 11:12 -
-
@NeoVandermonde Indeed, the
\scriptscriptstyleis generally relevant for nested sub- or super-scripting. – Steven B. Segletes Apr 18 '18 at 11:20 -
Yes, it was nested subscripts in particular that led me to consider using
\scriptsizeor a related sizing command, and hence the difference with\scriptstyle. – NeoVandermonde Apr 18 '18 at 11:40 -
2@NeoVandermonde not really:
\scriptstyleis a tex primitive and specifies a complete style of math layour (it affects horizontal space as well as the font in use)\scritsizeis a latex macro usually defined in a document class which specifies anything that wants specifying and that named size, often the fonts but also some vertical spaces may be specified to depend on the last used size command. – David Carlisle Apr 18 '18 at 12:11
\scriptstyle is a tex primitive and gives a way to force switching to the style that is automatically used in subscripts. (There are eight math styles, display, text, script and scriptscript, plus "cramped" versions of those four)
The math setup defines which fonts to use for each math family (default, \mathrm etc) completely independently. It is common but in no way forced to specify smaller fonts in scriptstyle that text style.
Conversely \scriptsize is a latex macro defined in the document class that specifies whatever the document class wants to specify for text at that size.
the standard classes such as article specify vertical spaces around math and lists as well as font size so \small for example is
\newcommand\small{%
\@setfontsize\small\@ixpt{11}%
\abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
\abovedisplayshortskip \z@ \@plus2\p@
\belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ \@plus2\p@ \@minus2\p@
\parsep 2\p@ \@plus\p@ \@minus\p@
\itemsep \parsep}%
\belowdisplayskip \abovedisplayskip
}
For sizes such as \scriptsize that are less likely to be used for large blocks article does in fact just set the font size, \scriptsize is
\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
that is, 7pt font on an 8pt baselineskip,
- 757,742
-
Thanks, this is quite interesting. It explains why
\scriptsizeseemed to function strangely inmathenvironments. – NeoVandermonde Apr 18 '18 at 13:42

scriptsizeis 7pt if the base size is 10 pt, and 8pt if it is 11 or 12pt. – Bernard Apr 18 '18 at 10:17