Andrew Redd
Andrew Redd

Reputation: 4692

Is there a way to colorize comments/code in Sweave?

I found that I can keep comments in the Sweave code chunks by specifying keep.source in the \SweaveOpts, but is there a way to make the code listing look nice like with grayed out comments?

Upvotes: 8

Views: 1319

Answers (2)

Ben Bolker
Ben Bolker

Reputation: 226182

the pgfSweave package can produce syntax-highlighted code.

Upvotes: 3

kmm
kmm

Reputation: 6310

There are several options illustrated at Vanderbilt University's Department of Biostatistics sweave templates site: http://biostat.mc.vanderbilt.edu/wiki/Main/SweaveTemplate

I found the Sweavel style to be the most flexible.

The highlight package is another option.

Upvotes: 5

Related Questions