tags:

views:

686

answers:

2

Hi I'm trying to fancyvrb environment. I'm using a fully upgraded Unbuntu 9.04.

If I issue a simple Verbatim environment, for example:

\begin{Verbatim}
  foobar
\end{Verbatim}

it works. However, if I try to pass in a parameter, for example, setting the font size:

\begin{Verbatim}[fontsize=8]
  foobar
\end{Verbatim}

This is ignored. If I try to set the color:

\begin{Verbatim}[formatcom=\color{red}]
  foobar
\end{Verbatim}

I get the following error:

Running `LaTeX' on `test' with ``latex  -interaction=nonstopmode "\input" test.tex''
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(./test.tex (/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.6, with DG/SPQR fixes <1998/07/17> (tvz)
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
No file fancyvrb.cfg.
) (./test.aux)
! Undefined control sequence.
\FancyVerbFormatCom ->\color 
                             {red}\relax 
l.20 \begin{Verbatim}[formatcom=\color{red}]

[1] (./test.aux) )
(see the transcript file for additional information)
Output written on test.dvi (1 page, 644 bytes).
Transcript written on test.log.

LaTeX exited abnormally with code 1 at Mon Sep  7 15:19:05

I'm starting my way with LaTeX, and I'm not sure if I'm misusing it, or if I have something install incorrectly.

Thanks

+2  A: 

Colors are provided by the color package. Try adding \usepackage{color}

Boojum
+2  A: 

Two parts to your problem:

  1. The fontsize option only accepts LaTeX font sizes such as \small and \large
  2. As mentioned by others, you need to load the color package (or the xcolor package) to get colours to work.

Here's an example that works:

\documentclass{article}
\usepackage{color,fancyvrb}
\begin{document}
\begin{Verbatim}
  foobar
\end{Verbatim}
\begin{Verbatim}[fontsize=\small]
  foobar
\end{Verbatim}
\begin{Verbatim}[formatcom=\color{red}]
  foobar
\end{Verbatim}
\end{document}
Will Robertson