[R] Sweave: change tab size

Duncan Murdoch murdoch.duncan at gmail.com
Tue Feb 1 12:47:13 CET 2011


On 11-01-31 6:51 AM, Sascha Vieweg wrote:
> When Sweave outputs function code that spreads across many lines,
> the default indent of inner lines is 4 spaces (plus the prompt).
> How can I change that default to 2 spaces? I tried to adjust my
> Sweave.sty with the option tabsize but that doesn't show an
> effect. Also the Sweave documentation did not provide a cue.
> Thanks for hints, *S*
>

If you use the keep.source=TRUE option it won't change the formatting, 
so you can use any indentation you like.  If you don't, it will use 
deparse() to format your functions, and deparse() has the indentation 
hard coded.  You'd have to build your own copy of R to change it.  The 
function that matters is printtab2buff() in src/main/deparse.c.

Duncan Murdoch



More information about the R-help mailing list