Making Verbatim and Beamer play nice

2,442

Solution 1

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.

Solution 2

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.

Share:
2,442

Related videos on Youtube

JSchlather
Author by

JSchlather

Updated on December 15, 2020

Comments

  • JSchlather
    JSchlather almost 3 years

    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?

    • Hendrik Vogt
      Hendrik Vogt almost 13 years
      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?
    • JSchlather
      JSchlather almost 13 years
      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.
    • Hendrik Vogt
      Hendrik Vogt almost 13 years
      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.
    • Stefan Kottwitz
      Stefan Kottwitz almost 13 years
      @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.
    • JSchlather
      JSchlather almost 13 years
      That would be fine with me.
    • Hendrik Vogt
      Hendrik Vogt almost 13 years
      @Jacob: Can you please add a minimal example that exhibits the error? (Don't include my hack as it's too long; just indicate where you include it.)
    • Martin Thoma
      Martin Thoma about 9 years
  • Hendrik Vogt
    Hendrik Vogt almost 13 years
    The OP knows about fragile; forgot to mark this as code ...
  • JSchlather
    JSchlather almost 13 years
    I am using fragile. It turns out it was an issue with some stray code I had in my macro package.
  • Stefan Kottwitz
    Stefan Kottwitz almost 13 years
    @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.