writing inline math in new visual R markdown editing: how to not escape $ character?

Background:
I am using the new visual R markdown editing for writing a long-form scientific document, and really like the live rendering of math. The default in visual R markdown seems to escape the $ character (the raw form displays \$ when I type $). To write inline math, I have two options - point and click at the insert menu, or use the catch-all ⌘ / keyboard short and then get to inline math mode.

My question:
Because I have to write many inline equations, it would be useful if there was a way to not automatically escape the $ character and use it for writing inline math by writing $...$ in the visual markdown mode itself. Is there a way of accomplishing this?

Note that the same issue does not arise for equation blocks, which can be input in the visual editing mode by moving to a new line and entering $$...$$.

Thanks!

In the visual editor you can type inline math by typing $ then your equation content then $ again.
It will then identify the block as an inline equation.

Is that not working for you ?

Thank you for the reply. No, this is not working for me.

Which version of the RStudio IDE do you have ?

I am using RStudio Desktop Version 1.4.1103.
OS: MacOS High Sierra 10.13.2
R version 4.0.2

This what I got with last daily version (1.4.1527)
inline-math

I suppose it should work that way already in 1.4

If you want to try the last daily, it is there: https://dailies.rstudio.com/

If it does not work, you can open a new issue in the RStudio IDE repo I think

I think the issue, even in the daily version, is that this works fine the first time inline math occurs on a line, but does not work if inline math is input on the same line again.

RstudioBug

Am I making a mistake? If not, I'll open an issue. Thank you!

No I got the same.

I think you have all the material with the gif to open an issue. Just check that there is none opened already.

Thank you! I've submitted a new issue. Could not find anything similar.

Hi @skandgoel50—a similar issue was filed a few days ago: https://github.com/rstudio/rstudio/issues/8810
However, I've copied your animated GIF to it, as it's very helpful!

Sorry about that - probably did not use the right criteria while searching. Thanks for pointing it out and copying the GIF!

1 Like

This is fixed here: https://github.com/rstudio/rstudio/commit/2bce9bd186ddf77bea8dc38de79bf2c6054979df (thanks again for reporting!). The fix should be in the next daily build and in the next patch release for v1.4.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.