# Making Verbatim and Beamer play nice

I'm writing a beamer presentation on basic math type-setting in latex and I've been trying to use verbatim to display how math equations are typed. Using fragile this works, but I still get several annoying error messages every time I compile, so I'm never sure if I have an actual error or if beamer is just complaining about verbatim. The current offender would be:

\begin{verbatim}
$X := \bigcup_{n \in \Mb N}\coprod_{\lambda \in \Lambda} (X_\lambda \cap Y_\lambda ) \vee \Mb S^{n}.$
\end{verbatim}


I get error messages along the lines of:

LaTeX Font Warning: Font shape OT1/cmss/m/n' in size <4> not available
(Font)              size <5> substituted on input line 11.

[1{/home/schlatjj/.texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./Math.toc)
[2] (./Math.vrb

LaTeX Font Warning: Font shape OMS/cmss/m/n' undefined
(Font)              using OMS/cmsy/m/n' instead
(Font)              for symbol textbraceleft' on input line 6.

) [3] (./Math.vrb) [4] (./Math.vrb
! Undefined control sequence.
\test@single@character ...ken ->\def \math@format
##1{\mydollar ##1\mydollar...
l.10   \end{verbatim}


Are there any workarounds for this, something I can change in the code to make these error messages go away?

-
It seems that you use this hack of mine. (I told you that I wouldn't suggest using it ...) Does removing the hack make things work? –  Hendrik Vogt Dec 13 '10 at 18:37
Yes, it does. I removed it and it fixed the issue. It seemed like such an impressive hack at the time. Too bad I can't mark your comment as the answer, although since there wasn't really an issue to begin with. It might be appropriate to delete the question. –  JSchlather Dec 13 '10 at 18:47
If you regard it helpful, I can make my comment an answer. You can also upvote the comment. Moreover, it might help to use \protect at some appropriate places; for this you'd better post a minimal working example. –  Hendrik Vogt Dec 13 '10 at 18:55
@Hendrik: your comment would be fine as answer! Jacob could simply uncheck my answer (which rather deals with the warning) and then mark your answer as accepted. Would be perfectly fine. –  Stefan Kottwitz Dec 13 '10 at 19:01
That would be fine with me. –  JSchlather Dec 13 '10 at 19:39

It seems that you use this hack of mine. (I told you that I wouldn't suggest using it, but I feel honored that you like it ...) However, as I wrote there, the hack is designed for the CM fonts only, so you shouldn't use it with the standard beamer fonts.

That said, I can't reproduce the error. I used the code Stefan Kottwitz had in the first version of his answer, and added my hack in the preamble. This compiles nicely.

-

Edit: since the fragile option is obviously known by the OP, I removed that option suggestion.

At least regarding the warnings: the one oncerning the missing size 4 in cmss can be removed simply by

\let\Tiny\tiny


If you don't need size 4 and thus \Tiny, this could be sufficient.

-
The OP knows about fragile; forgot to mark this as code ... –  Hendrik Vogt Dec 13 '10 at 18:44
I am using fragile. It turns out it was an issue with some stray code I had in my macro package. –  JSchlather Dec 13 '10 at 18:46
@Hendrik, @Jacob: ah, I understand. I just did not see fragile when it wasn't marked as code. I edited my entry. I don't delete, perhaps somebody benefits from the tiny \Tiny workaround. –  Stefan Kottwitz Dec 13 '10 at 18:51