Ipython: Can't escape multiple dollar signs in a markdown cell

Created on 18 Apr 2013  ·  7Comments  ·  Source: ipython/ipython

I have a markdown cell in iPython that contains four dollar signs. iPython interprets anything between dollar signs as a MathJax expression, which is not what I want. How do I escape the dollar signs? Escaping them with a backslash prevents MathJax from kicking in, but the backslash shows in the compiled Markdown.

bug notebook

Most helpful comment

Huh... depend if I copy your raw comment or if I copy the rendered thing on github.

The one with Dollar-BackSlash-Dollar works for me, the Dollar-BackSlash-BackSlash-Dollar Do not.
capture decran 2014-02-08 a 23 14 27
capture decran 2014-02-08 a 23 14 35

All 7 comments

This is pretty tricky - I guess this is the reason that Mathjax specifically recommends against using $ as the delimiter, which IPython uses. I can't figure out a way to get multiple plain text text dollar signs as it is, so the best I have come up with after a bit of fiddling is $\$\$\$\$$, which will give you dollar signs in the mathjax font.

fixed by #3428

This is still an issue when you have multiple dollar signs that are not consecutive (i.e. in different parts of a sentence. For example, the following:

Several starting pitchers have signed or been extended this offseason, and those who would be expected to provide similar value to Jimenez commanded contracts of $$$10-13M per year for contracts ranging from one year (Colon) to four (Garza). A 2-year contract in the range of $$$12-14M annually would be on the higher end of market value, yet cap the total risk to the team below $$$30M. Moreover, the length of the contract might incentivize the player to play for another contract in the near future.

gets rendered as:

dollar signs

In other words, works fine for the first dollar sign, or multiple in the same MathJax expression, but gets confused at multiple separate ones.

@fonnesbeck the example you gave is working correctly in master. What version are you using?

Mine is from master no more than 2 weeks old (__version__ just says says '2.0.0-dev'). I will update again.

Just updated from master now, and I get the same thing. Configuration issue?

Huh... depend if I copy your raw comment or if I copy the rendered thing on github.

The one with Dollar-BackSlash-Dollar works for me, the Dollar-BackSlash-BackSlash-Dollar Do not.
capture decran 2014-02-08 a 23 14 27
capture decran 2014-02-08 a 23 14 35

Was this page helpful?
0 / 5 - 0 ratings