/David
You can use the Verbatim environment (uppercase "V" -- it's part of the
fancyvrb package), which allows some options, including font size control:
\usepackage{fancyvrb}
\begin{Verbatim}[fontsize=\small]
... verbatim material ...
\end{Verbatim}
Regards,
Vilar Camara Neto
> How do I control the font size in a verbatim environment?
There are reasons for using extended verbatim, but this
is not one of them. With straight LaTeX:
\makeatletter
\renewcommand\verbatim@font{\large\normalfont\ttfamily}
\makeatother
Donald Arseneau as...@triumf.ca
\documentclass{article}
\begin{document}
\noindent David Rasmussen wants to change the font size of the verbatim environment.
{
\small
\begin{verbatim}
Surely he knows that to change font sizes,
he simply needs a preceeding font size changing command.
\end{verbatim}
}
\noindent Perhaps lshort.pdf would be a good reference for him.
\end{document}
Thanks :)
I actually tried something along those lines after asking here, but it
didn't work. With small. It works with other sizes, so I conclude that
the verbatim font size is "small" (my document is 12pt). Or?
/David
or something (verbatim font size is normally that of surrounding
text). try it with \tiny in place of \small to see the effect to its
starkest extent.
what's wrong here, and may be putting you off, is that the code as
written applies the \baselineskip appropriate to \small to the
paragraph above the verbatim (see
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=baselinepar). what tex
sees is
text at 10pt
open group
\small, implying \baselineskip change
\par (inside verbatim code)
verbatim stuff
\par (inside verbatim code)
close group, restoring \baselineskip
more text
since the \baselineskip changes before the end of the first paragraph,
it affects the whole of the paragraph. at the point the paragraph
after the verbatim happens, the size is back to normal and (other
things being equal) the paragraph is set to the correct \baselineskip.
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge
> David Rasmussen <david.r...@gmx.net> wrote in message news:<40fed2a0$0$161$edfa...@dtext02.news.tele.dk>...
> > How do I control the font size in a verbatim environment?
> >
> > /David
>
> \documentclass{article}
> \begin{document}
> \noindent David Rasmussen wants to change the font size of the verbatim environment.
> {
> \small
> \begin{verbatim}
\begin{verbatim} closes the current paragraph. Now TeX is typesetting
the previous paragraph with current settings, i.e. a smaller
baselineskip.
> Surely he knows that to change font sizes,
> he simply needs a preceeding font size changing command.
> \end{verbatim}
> }
Also the closing group after \end{verbatim} is problematic, so that
you have to specify \noindent to suppress indentation.
> \noindent Perhaps lshort.pdf would be a good reference for him.
> \end{document}
Solutions: packages verbatim, alltt, fancyvrb, listings, ...
Yours sincerely
Heiko <ober...@uni-freiburg.de>