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

6
  • 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, 2015 at 18:56
  • 1
    So, please, add a minimal example showing the problem. Maybe with a printscreen of your highlighted code.
    – Sigur
    Jun 25, 2015 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, 2015 at 19:19
  • 1
    Current version is 2.9.4. Upgrade and see is the issue is resolved. Jun 25, 2015 at 19:46
  • 1
    @Sigur It was a version issue. Jun 27, 2015 at 19:18

2 Answers 2

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.

1
  • Well i tried using a %$ sign at the end. Is there another way i am supposed to format it? Jun 25, 2015 at 19:09
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.

You must log in to answer this question.

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