[R] Formatting Sweave in R-News
Gregor Gorjanc
gregor.gorjanc at bfro.uni-lj.si
Wed Aug 22 09:20:54 CEST 2007
Arjun Ravi Narayan <contact <at> arjunnarayan.com> writes:
> I am editing a document for submission to the R-news newsletter, and
> in my article my Sweave code inserts a dynamically generated PDF
> report that my R program generates.
>
Slightly off Arjuns topic is a problem with Schunk, Sinput and Soutput
environments. They just use to much inline space. I have tweade this
problem with sed (see bellow for Makefile content), but wonder if there
is a better solution.
Thanks, Gregor
default: Sweave fixTex
texi2pdf --clean wrapper.tex && evince wrapper.pdf
Sweave: # Sweave myPaper.Rnw
R CMD Sweave myPaper.Rnw
fixTex: Sweave # Change all S* environments to smallverbatim
@cat myPaper.tex | sed -e '/\\begin{Sinput}/d' \
-e '/\\end{Sinput}/d' \
-e '/\\begin{Soutput}/d' \
-e '/\\end{Soutput}/d' \
-e 's/\\begin{Schunk}/\\begin{smallverbatim}/g' \
-e 's/\\end{Schunk}/\\end{smallverbatim}/g' \
> myPaper2.tex
@mv -f myPaper2.tex myPaper.tex
More information about the R-help
mailing list