Hello, recently I read about the SweaveListingUtils package and now I want to try it out. However, I can not make it work... Below a minimal example. The problem seems to be the following line (generated by SweaveListingPreparations()?): \ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.6\textwidth}}{}% If I comment out this line, it works. What can I do about this? I am using the \begin{Scode} notation instead of Rnw files. May this be the problem? For some technical reason, I would like to stick on this notation. Any help 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 [[alternative HTML version deleted]]
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@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 [[alternative HTML version deleted]]
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
Hi Karsten, as you will know, SweaveListingUtils is a contributed package, so it is a good habit to address the package maintainer (which is me in this case) directly. I clearly do not mind discussing this on r-help, but maybe this already quite busy mailing list should not be bothered too much with packages (like mine) which are "only" contributed. A note for future questions: In case of SweaveListingUtils (and similarly for other contributed packages I am the maintainer of), this package is developped under r-forge, https://r-forge.r-project.org and on this platform, I have set up an archieved mailing list devoted to package development of SweaveListingUtils: distr-swvlistutils at lists.r-forge.r-project.org Please address this list for future questions concerning this package.> recently I read about the SweaveListingUtils package and now I would > like to try it out. However I can not make it run...Let's see why...> 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}}{}%Actually, this is part of the TeX style file Sweave.sty shipped out with R; now for our special definitions of environments Sinput, Soutput, and Scode, we decided to only insert those parts of Sweave.sty which still are necessary and issue these ourselves within the output of SweaveListingPreparations(). So we need to prevent Sweave() (the R command) to insert a "\usepackage{Sweave}" before \begin{docoment} in order to avoid redefinitions (which caused your error). This can be done by inserting % % this comment persuades Sweave not to insert \usepackage{Sweave} % to your .Rnw / .Rtex file. (Sweave() will find this and think this is not in comments...) Then everything should work; hopefully, at least. Kind regards, Peter