In a Sweave document, code chunks in R are set off from the main text like so:
Catz are well known for their fur & pur.
<<echo = false>>=
catz <- 1 + 2
@
I’d like to run spell check for the LaTeX part (and flag “Catz”) but have it skip the code chunks (not flag “catz”). In a long document, hitting “SPC” for each “misspelling” in the code section gets tedious.
Try adding this to your emacs init file:
Edit (Re Michael Hoffman’s comments):
If Flyspell is enabled, these two additional expressions will also be needed:
For other modes, replace the
latex-modein the last expression with the appropriate major mode names.