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
  • 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
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.

  • Well i tried using a %$ sign at the end. Is there another way i am supposed to format it? – crazywill32 Jun 25 '15 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.

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.