I'm writing a LaTeX document using Sweave (a Beamer presentation, really), which weaves R code and LaTeX. Is there a way to make my chunks of code and its output highlighted? I could use listings package but that would mean I would have to rummage through the .tex file and wrap all Schunks so I'm looking for perhaps more elegant solutions if currently available.

1 Answer 1


The SweaveListingUtils package contains additions to Sweave that enables pretty-printing input and output using the LaTeX listings package. Example usage can be found in the vignette.

Another alternative is to override the Schunk, Sinput and Soutput environments using \renewenvironment so that they do whatever you want them to.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .