Why does LaTeX issue \scriptsize warnings in math mode?

Thu May 7 10:48:52 CEST 2020

Because it is math mode, \scriptsize is a text command.

I'm quite surprised that actually compiles as \verb|mmm| normally dies when used in arguments.

Perhaps you should start by explaining what your end goal is here? Why are you writing verbatim in math mode? And even in super-/subscripts.

If it is just the font, use \mathtt{...}

Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University

________________________________
From: texhax <texhax-bounces+daleif=imf.au.dk at tug.org> on behalf of Doug McKenna <doug at mathemaesthetics.com>
Sent: 07 May 2020 10:39
To: texhax <texhax at tug.org>
Subject: Why does LaTeX issue \scriptsize warnings in math mode?

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20200507/02748779/attachment.html>