I'm trying to read through the Beamer manual, but I don't even really know what I'm looking for, so please help.

How do I change globally (but even if it is a per-frame, it will be still good) size of the verbatim blocks?

migrated from stackoverflow.com Sep 15 '13 at 15:02

This question came from our site for professional and enthusiast programmers.


Add the following to the preamble of your script:

\def\verbatim{\tiny\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}

This should globally change any verbatim environment in your document. Just change


to whatever font size you are looking for.

  • Thanks a lot! I have a follow-up question, somewhat related. I tried to add :BEAMER_envargs: [size=small] property to the particular frame (it contained only verbatim block). Wouldn't there be any way to define this on a per-frame level? – wvxvw Sep 14 '13 at 18:56
  • 1
    you should be able to define a new command. Something like \newcommand\totiny{\tiny\selectfont}. You can then add the \totiny command to any frame that you are creating. A frame in which the \totiny command is used will have tiny font. A frame in which the command is not used will use the default settings. – joemienko Sep 14 '13 at 19:23

Alternatively you could try to use the 'verbatim' package. I do this with:


which changes the size of all verbatims to scriptsize.

  • Thanks for the info! Since I'm relatively new to LaTeX, would you mind telling how do you discover what packages are there and what features they provide? – wvxvw Sep 15 '13 at 13:48
  • This will change the font also in all inline \verb commands. Loading verbatim is not necessary, as \verbatim@font is a feature of the LaTeX kernel. – egreg Sep 15 '13 at 15:12

The best strategy for this is to load the fancyvrb package; with


your verbatim environments will all be printed using \footnotesize. If you want to override the setting for a particular environment, you can say


(well, maybe not \huge, that's only to give the idea); or issue


inside a frame for the setting to hold only in that frame.

Of course you know that frames containing verbatim material should be announced by \begin{frame}[fragile].

  • Can I ask you please to move it back to SO? This question was specific to org-mode of Emacs. It was by chance that it was possible to solve it through using some LaTeX code directly, but my original intention / expectation was that it would be possible to solve it by the means of org-mode (eg. through properties). Also, as a side effect of moving this question you made it impossible for the authors of other answers to reply to the comment, if there will be any. – wvxvw Sep 15 '13 at 19:10
  • @wvxvw What has the Beamer manual to do with Emacs' org-mode? What has org-mode to do with the typesetting of LaTeX material? – egreg Sep 15 '13 at 19:18
  • org-mode has settings to export to TeX, and then to export TeX to PDF. Beamer manual was a poor choice of words, I was referring to orgmode.org/worg/exporters/beamer/ox-beamer.html (Worg manual) on Beamer export. – wvxvw Sep 15 '13 at 19:21
  • @wvxvw Changing the font size must be done on the LaTeX side nonetheless. – egreg Sep 15 '13 at 19:22
  • The page I'm referring to, for example, shows how to change font weight, maybe there's also an option to change the size? I don't know, but it seems fairly reasonable to believe there might be one. I mean, what if there is already a function for it in org-mode, but I simply don't know it's there? It may as well just do the same what has been suggested here. – wvxvw Sep 15 '13 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.