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?


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 Feb 5 '17 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. – Tim Hoffmann Feb 7 '17 at 20:13
  • Hi, I installed texstudio-2.12.4-win-qt5.6.2.exe but still getting the same problem. – stegzzz Mar 30 '17 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.