[ESS] synthax higlighting \Sexpr in .Rnw files

Douglas Bates bates at stat.wisc.edu
Thu Nov 19 13:58:20 CET 2009


On Wed, Nov 18, 2009 at 11:24 AM, Emanuel Heitlinger
<emanuelheitlinger at googlemail.com> wrote:
> Hi List,
>
> editing the .Rnw files of Sweave/Noweb I have a problem with
> \Sexpr{whatever$name}:

An equivalent, and less problematic, expression is

\Sexpr{whatever[["name"]]}

It's a bit more typing but it doesn't have the problem of LaTeX-mode
and R-mode fighting over the interpretation of the $ symbol.

In some ways the surprising thing about a hybrid like Sweave and ESS
support of Sweave is not that sometimes some aspects get confused but
that it works at all.

> The $ makes Latex-mode use font-latex-math-face (according to M-x
> describe-text-properties).
>
> How to make Latex-mode aware of \Sexpr?
> Where to look for the Regexp that control highlighting in Latex-mode?
> Or is there another workaround to be defined in Noweb-mode?
> I would be happy to learn something about emacs solving this problem!
>
> Thanks for your help!
> Emanuel
>
> here is the output of M-x describe-mode in the tex-region of a .Rnw:
>
> Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
> Column-Number Diff-Auto-Refine File-Name-Shadow
> Global-Auto-Composition Global-Font-Lock Global-Highlight-Parentheses
> Highlight-Parentheses Line-Number Noweb Noweb-Font-Lock Reftex
> Shell-Dirtrack Tooltip Transient-Mark
>
> (Information about these minor modes follows the major mode info.)
>
> LaTeX mode:
> Major mode in AUCTeX for editing LaTeX files.
> ...
>
> --
> Emanuel Heitlinger
>
> University of Karlsruhe (IT)
> Zoological Institute 1 Ecology/Parasitology
> Kornblumenstr. 13
> 76131 Karlsruhe
> Germany
> Telephone +49 (0)721-608 7654
>
> http://www.scienceblogs.de/alles-was-lebt/
>
> or
> University of Edinburgh
> Institute of Evolutionary Biology
> Kings Buildings, Ashworth Laboratories, West Mains Road
> Edinburgh EH9 3JT
> Scotland, UK
> Telephone:+44 (0)131-650 6761
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>



More information about the ESS-help mailing list