Escaping dollar sign in ipython notebook

2020-02-26 14:09发布

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.

ANy ideas on how to get just the dollar sign?

Thanks

7条回答
啃猪蹄的小仙女
2楼-- · 2020-02-26 14:44

I was not able to get most of these solutions working. One that did work, though, is explained here. It refers to a SO question here and is as simple as:

<span class="tex2jax_ignore">$900 vs $4,500</span>

Hope this helps someone!

查看更多
▲ chillily
3楼-- · 2020-02-26 14:47

You can escape $ with math mode by using a backslash. Try $\$$

查看更多
贼婆χ
4楼-- · 2020-02-26 14:48

Put two backslashes in front of dollar signs. For example:

Some prices: \\$3.10, \\$4.25, \\$8.50.

(running Jupyter notebook server 5.7.0)

查看更多
趁早两清
5楼-- · 2020-02-26 14:58

Add a backward slash before the dollar sign: \$

查看更多
成全新的幸福
6楼-- · 2020-02-26 14:58

Did you try using the equivalent HTML entity instead?:

enter image description here

e.g.

enter image description here

查看更多
We Are One
7楼-- · 2020-02-26 14:59

I'm aware that this topic is old, but it's still somehow the first google result and its answers are incomplete.

You can also surround the $ with `backticks`, the same way that you would display code in Jupyter.

So $ becomes `$`, and should display without error

查看更多
登录 后发表回答