Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

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

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

add comment

3 Answers

up vote 3 down vote accepted

Add the following to the preamble of your script:

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

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

\tiny

to whatever font size you are looking for.

share|improve this answer
    
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
    
Thanks again! That was very helpful. –  wvxvw Sep 14 '13 at 20:28
add comment

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

\usepackage{fancyvrb}
\fvset{fontsize=\footnotesize}
\RecustomVerbatimEnvironment{verbatim}{Verbatim}{}

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

\begin{verbatim}[fontsize=\huge]

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

\fvset{fontsize=\normalsize}

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].

share|improve this answer
    
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
add comment

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

\usepackage{verbatim}
\makeatletter
\def\verbatim@font{\scriptsize\ttfamily}
\makeatother

which changes the size of all verbatims to scriptsize.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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