Why does LaTeX issue \scriptsize warnings in math mode?
Doug McKenna
doug at mathemaesthetics.com
Thu May 7 20:56:15 CEST 2020
Thanks for the helpful responses.
The combination of \scriptstyle, \scriptscriptstyle, and \mathtt{} seems to work equivalently, as long as the characters are all letters or digits. But what can be placed between the delimiters of \verb| ... | and what can be placed inside a \mathtt{ ... } are not the same, and I'm pretty sure the characters inside \mathtt{ ... } are more restricted.
My problem is that I don't have control over the characters I want to be verbatimed; they are coming from somewhere else and being inserted into the LaTeX document. And I definitely want to be able to use a piece of verbatim text as a superscript or a subscript, and yes I know that's not the "right" thing for a math formula, except that in what I'm doing, it really is.
So the following all seem to do what I want, and there are no LaTeX warnings or errors:
\documentclass{letter}
\begin{document}
\verb|box7|
$\hbox{\verb|box7|}$
{\setbox7=\hbox{\verb|box7|}$\box7$}
{\setbox7=\hbox{\scriptsize \verb|box7|}$2^{\box7}$}
{\setbox7=\hbox{\tiny \verb|box7|}$2^{2^{\box7}}$}
\end{document}
The second example works but is questionable according to previous responses. Are there downsides for the other examples that build the verbatim text in a box first, outside of math mode?
Doug McKenna
Mathemaesthetics, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20200507/d6728ae3/attachment.html>
More information about the texhax
mailing list.