TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I use vim-latexsuite to indent my .Rnw files, the Sweave blocks get indented, which causes them not to work properly. What I need is a way to ensure that the vim indent scheme puts these blocks at start of lines. The emacs mode does this well, but I'm trying out vim lately, and would like to have vim work properly as well.

I have only minimal skill with vim, and am not sure how to edit my ~/.vim/indent/tex.vim file to handle this. Any ideas? It seems to me that the indentation is being set after lines are formatted (i.e. getting ready for the next line), which doesn't help. But, as I say, I'm just learning about vim, so I may be all off-kilter [kind of like my resultant Rnw file :-)]

share|improve this question
Indentation causes the R code not to work? I didn't think indentation mattered in R... – Seamus Jan 14 '11 at 13:47
@Seamus: thanks for the comment. The procedure is to get R to scan the file, using the "Sweave" command. That command passes all normal text through to a .tex file, except for blocks that start with ^<<.*>>== (a regular expression that starts at column 1). In other words, R demands that these codes start at column 1 of the file. This is by design, because it lets you enter such content at other columns without triggering Sweave. (By the way, what happens for these special blocks is that R runs them, and it puts the R output into the tex file.) – dank Jan 15 '11 at 15:31
up vote 1 down vote accepted

The update to vim's R plugin now works fine, as of yesterday. The author found a problem that, as I understand it, had to do with interactions with the tex plugin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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