0

Latex sudo noob here. I had a question regarding the answer to the question TeXstudio recognize $ in R code as that of the math mode

How does one create the special comment listed in the answer?

It is used to reduce the incorrect highlighting in a minted like space for RStudio. I am trying to document some bash scripts and environemental variable references cause TexStudio to highlight whole swaths of text to math mode. The solution about would mitigate some of this but I don't know how to implement it.

Thanks,

Will

EDIT 1: So the obvious answer would be to add a "%$" to the end of the line. This does not work at least for me. This would make my question "Am I doing it wrong?" or "Is there another solution?"

EDIT 2: Below is an image of the problem: Image of Minted/Math Mode problem with bash code

Here it is with the suggested modification from the previous question:

enter image description here

  • 1
    Welcome! What's the problem exactly? You just write %$ at the end of the affected lines. At least, that's how I understand the answer. Have you tried that? Is the problem that it doesn't work? Or...? – cfr Jun 25 '15 at 18:56
  • 1
    So, please, add a minimal example showing the problem. Maybe with a printscreen of your highlighted code. – Sigur Jun 25 '15 at 19:10
  • I can not reproduce your problem. It works here. What version of TSX are you using? Did you check for some option in Configure menu? – Sigur Jun 25 '15 at 19:19
  • I am using version 2.6.6. I thought it was the latest but maybe not.

    Also I see no command options in the configure window.

    – crazywill32 Jun 25 '15 at 19:31
  • 1
    Current version is 2.9.4. Upgrade and see is the issue is resolved. – R. Schumacher Jun 25 '15 at 19:46
  • 1
    @Sigur It was a version issue. – crazywill32 Jun 27 '15 at 19:18

2 Answers2

1

Since you are using $ as part of some script (for example $USER) TeXstudio will interpret that dollar sign as opening math mode and will highlight as well.

So if you insert %$ at the end of the line containing $ in the script code it will not have effect since it is a comment (%).

And according to the solution you cited (I didn't tested) it should correct the highlight.

Sigur
  • 37,330
0

So as was suggested by @Sigur and @R. Schumacher in the origional post comments this was a version error... ProTex does not come with the latest TexStudio (2.6.6). Downloading the newest version (2.9.4) solved the issue.