[TxMt] Syntax highlighting problem with .rnw file (SWeave bundle)

Gregory Penn gregory.penn at gmail.com
Wed Aug 24 14:23:43 UTC 2011


Thanks to Eric Cheng, I was able to update my SWeave bundle from github and it's commands seem to be working correctly. So on to the next problem . . .

TextMate's syntax highlighting in foo.rnw isn't recognizing R code between the "<<>>=" and "@" tags that delimit it, instead it is treated as LaTeX code. This is a problem because R makes frequent use of the "$" symbol, which toggles math-mode in LaTeX. As a result, where I have an odd number of "$"s in a chunk of R code, any LaTeX following that R code will appear highlighted green, as though it were in math mode.

I've read the documentation for scopes and languages, but didn't understand it well enough to figure out where this is going wrong and how to fix it.

Thanks in advance,
Gregory Penn


More information about the textmate mailing list