I am using TeXstudio to typeset some R code with environment Rcode, Routput and command \Rinline (provided by SASnRdisplay package). Whenever there is a $ sign appears in the code, TeXstudio will recognize it as the beginning of inline math and render everything after that differently. It does not affect the compiled file but it can be annoying while editing.

I can make Rcode and Routput to act like verbatim by changing the the custom highlighting option. However it does not work for \Rinline since it is not an environment. Is there a workaround for this?

  • 2
    One mitigation of the problem would be to only use \( x \) for (inline) math and to customize TXS to not render $ as math. – henry Mar 5 '15 at 14:23

It is currently not possible to prevent detection of $ within commands as math mode.

As a workaround, you can add the special comment %$ to the end of the line. This at least limits the incorrect highlighting to the line.

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.