嗨,我正在尝试fancyvrb环境。我正在使用完全升级的Ubuntu 9.04。
如果我发布一个简单的Verbatim环境,例如:
\begin{Verbatim}
foobar
\end{Verbatim}
它有效。但是,如果我尝试传入参数,例如,设置字体大小:
\begin{Verbatim}[fontsize=8]
foobar
\end{Verbatim}
这被忽略了。如果我尝试设置颜色:
\begin{Verbatim}[formatcom=\color{red}]
foobar
\end{Verbatim}
我收到以下错误:
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
我正在开始使用LaTeX,我不确定我是否误用了它,或者我是否安装了错误的东西。
答案 0 :(得分:2)
颜色包提供颜色。尝试添加\usepackage{color}
答案 1 :(得分:2)
问题的两个部分:
fontsize
选项仅接受LaTeX字体大小,例如\small
和\large
这是一个有效的例子:
\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}