I'm using a number of \Sexpr statements in my Rnw file. They contain $ symbols and this results in e.g.

green highlighting

The result is very messy green highlighting in inappropriate places and a hard to read file. Is there a way for TexStudio to ignore $ within \Sexpr statements?

1 Answer 1


Will be fixed in the next release.

Until then, you can work around this by manually changing the language definition:

  1. Create a folder languages in your settings directory
  2. Download the updated file tex.qnfa and put it in this directory.
  • Hi, thanks for this. I tried your work around but it doesn't seem to make any difference. Can I check that I made the settings directory in the right place? I made the directory as %APPDATA%\texstudio\languages, this is a subdirectory of the directory in which texstudio.ini resides. Do I need to do anything else in texstudio apart from restart?
    – stegzzz
    Commented Feb 5, 2017 at 10:29
  • Sorry. The workaround does actually not work because the languages are nested: tex highlighting is imported by sweave highlighting. However, these relative imports do not use the languages directory. If you really would want to make it work now, you'd have to download sweave.qnfa, put it in the languages directory and replace <embed target="(La)TeX"> by the content of the <QNFA> tag in tex.qnfa. It's a bit of a mess though. Commented Feb 7, 2017 at 20:13
  • Hi, I installed texstudio-2.12.4-win-qt5.6.2.exe but still getting the same problem.
    – stegzzz
    Commented Mar 30, 2017 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .