Is there a simple way of reducing the size of the font of the R output in Lyx/Sweave? It should be simple, but I can't get anything to work. Placing\huge or \tiny in front of code chunk doesn't change the output.
My reply:
The trick is in what Sweave actually does. Sweave replaces the R code with the code and results, but as Sinput and Soutput environments, i.e.,<<>Becomes>=
1 + 1
@\begin{Schunk}Therefore, I think you need to modify the Sinput and/or Soutput tex environments
\begin{Sinput}
> 1 + 1
\end{Sinput}
\begin{Soutput}
[1] 2
\end{Soutput}
\end{Schunk}
defined in the Sweave.sty file. However, I have never done anything like that. I think there are some R packages on CRAN that did some of this things - I remember seeing green output etc.
4 comments:
Green output would be awesome - do you remember where you saw that?
Take a look at
http://cran.r-project.org/web/packages/SweaveListingUtils/index.html
there is also some fine material at
http://biostat.mc.vanderbilt.edu/wiki/Main/SweaveConvert
http://biostat.mc.vanderbilt.edu/wiki/Main/SweaveLatex
http://biostat.mc.vanderbilt.edu/wiki/Main/SweaveTemplate
It's easy if you use a font size environment instead of a marco, e.g.
<<>>=
rnorm(20)
@
\begin{small}
<<>>=
rnorm(20)
@
\end{small}
\begin{huge}
<<>>=
rnorm(20)
@
\end{huge}
At least it works for me.
Yihui, nice solution!
Post a Comment