[R] \lstdefinelanguage error: undefined control sequence

Marius Hofert marius.hofert at math.ethz.ch
Fri Nov 2 14:46:17 CET 2012


Dear expeRts,

I'm trying to use the package SweaveListingUtils, but the rather minimal example
below leads to

,----
| ./minimal.tex:43: Undefined control sequence.
| l.43 \lstdefinelanguage
|                        {Rd}[common]{TeX}%
| ?
`----

Why?

Cheers,

Marius

\documentclass[article]{jss}

\author{foo \And bar}
\Address{
  foo
  \bigskip
  bar
}
\title{foo bar}
\Plainauthor{foo, bar}
\Plaintitle{foo bar}
\Abstract{foo and bar.}
\Keywords{\R, foo, bar}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[american]{babel}
\usepackage{microtype}
\usepackage{Sweave}
\usepackage{fancyvrb}
% do *not* delete the following line! see https://stat.ethz.ch/pipermail/r-help/2009-July/204747.html
% this comment persuades Sweave not to insert \usepackage{Sweave}

% Sweave
\fvset{listparameters={\setlength{\topsep}{-2pt}}}
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}

% SweaveListingUtils
\SweaveOpts{keep.source=TRUE}
<<label=SweaveListingsPreparations, results=tex, echo=FALSE, strip.white=false>>=
require(SweaveListingUtils)
SweaveListingPreparations()
@

\begin{document}
<<foo_bar>>=
f <- function(n) runif(n, min=-1, max=1)
mean(f(100))
@
\end{document}

<<cleanup, echo=FALSE>>=
unloadNamespace("SweaveListingUtils")
@



More information about the R-help mailing list