[ESS] Syntax highlighting problems when using ESS+Auctex+knitr

Cássio M. M. Pereira cassiomartini at gmail.com
Tue Jul 10 18:08:07 CEST 2012


Hi,

I'm using a combination of emacs + ESS + Auctex + knitr to edit .Rnw files.
It's working fairly well with the addition of a small function to call
my makefile and generate the final pdf.

A problem I'm encountering is with the syntax highlighting. I think
it's connected to the parsing of the latex input.

Here's an example:

--- article.Rnw ---
\documentclass[a4paper]{article}

\begin{document}

\title{test}

\maketitle

<<chunk1>>=
a = list(x = 1, y = 2)
b = a$x
@

this is the test continued...

\end{document}
--- end article.Rnw ---

After the @ everything gets the same color. I think the parser is
getting confused because it expects another dollar sign after a$x, but
that's not latex math notation, it's an R command to select an item
from a list.

Here's the relevant portions of my .emacs and my package versions:

--- .emacs ---
(require 'ess-site)
(ess-toggle-underscore nil) ; desabilite <- no modo ESS.
(setq inferior-R-args "--no-save --no-restore-data") ; dont restore workspace
(setq TeX-PDF-mode t) ; use pdflatex
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq ess-ask-for-ess-directory nil) ;otherwise you are prompted each
time you start an interactive R session
--- end .emacs ---

Software versions:
emacs 24.1-2
emacs-ess 12.04.4-1
auctex 11.86-3

Any ideas how to solve this?

Thanks,
Cássio
-- 
Cássio M. M. Pereira



More information about the ESS-help mailing list