# Why does LaTeX issue \scriptsize warnings in math mode?

Doug McKenna doug at mathemaesthetics.com
Thu May 7 10:39:05 CEST 2020

I've been trying to put a LaTeX verbatim quote in a superscript or subscript.  Here's a simple MWE:

% !TEX TS-program = pdflatex

\documentclass{letter}
\begin{document}

\verb|normal|, $10^{\scriptsize \verb|foo|}$, $A_{\scriptsize \verb|bar|}$, or $2^{2^{-{\tiny \verb|foobar|}}}$

\end{document}

It seems to work quite well or at least as expected, except that LaTeX issues the following warning messages which, given that it seems to work, don't make much sense:

LaTeX Font Warning: Command \scriptsize invalid in math mode on input line 6.

LaTeX Font Warning: Command \scriptsize invalid in math mode on input line 6.

LaTeX Font Warning: Command \tiny invalid in math mode on input line 6.

What is it that one needs to do better or correctly to keep such warnings at bay?

Doug McKenna
Mathemaesthetics, Inc.