9

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.

13

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.