[R] SweaveListingUtils question

Karsten Weinert k.weinert at gmx.net
Tue Jul 14 23:23:27 CEST 2009


Hello group,
recently I read about the SweaveListingUtils package and now I would
like to try it out. However I can not make it run...
Below is a minimal example. The problem seems the following line,
generated by the package:

\ifthenelse{\boolean{Sweave at gin}}{\setkeys{Gin}{width=0.6\textwidth}}{}%

If I comment it out, it works. What can I do about it?

I am not sure if this is the right mailing list for this question
since it touches both R and LaTeX. Sorry if I am wrong...

Any hint appreciated,
kind regards,
Karsten.

%% begin example
\documentclass[9pt]{beamer}

\usepackage{fancyvrb}
\usepackage{listings}

% choose language and char set
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}

\SweaveOpts{prefix.string=Routput/parcel, keep.source=TRUE}
\begin{Scode}{results=tex, echo=FALSE}
require(SweaveListingUtils)
SweaveListingoptions(intermediate = FALSE)
SweaveListingPreparations()
\end{Scode}

\begin{document}
\begin{frame}[fragile]
\frametitle{Your title}
\begin{lstlisting}options(digits=3)
set.seed(1)
require(Hmisc)
age <- rnorm(1000,50,10)
sex <- sample(c('female','male'),1000,TRUE)
out <- histbackback(split(age, sex), probability=TRUE, xlim=c(-.06,.06),
                    main = 'Back to Back Histogram')
#! just adding color
barplot(-out$left, col="red" , horiz=TRUE, space=0, add=TRUE, axes=FALSE)
barplot(out$right, col="blue", horiz=TRUE, space=0, add=TRUE, axes=FALSE)
\end{lstlisting}
\end{frame}

\begin{Scode}{echo=FALSE}
  unloadNamespace("SweaveListingUtils")
\end{Scode}

\end{document}
%% end example




More information about the R-help mailing list