Pandoc IPython notebook loses some Mathjax

断了今生、忘了曾经 提交于 2019-12-13 05:02:22

问题


The problem I have is that I have an IPython notebook with some formulas written in MathJax. It is rendered fine in the notebook itself, but when I try to export it, most of my formula is gone!

Here's a small reproducible example:

I type

$ \int \cfrac{ 2 p(\vec{x}) d\vec{x}}  { \frac{1}{P(\omega_1 | \vec{x})} + \frac{1}{P(\omega_2 | \vec{x})} }$

It renders well inside the notebook:

But when I click file -> print preview, what I get is just a lonely plus sign:

In the sources I see this:

<p>$  {  +  }$</p>

So the entire formula is gone! What could be the reason?

My environment:

  • Windows 7
  • Anaconda-2.0.1-Windows-x86_64
  • Python 2.7.7
  • IPython 2.3.0
  • pandoc 1.13.1

回答1:


In pandoc you require a non-space character after the opening dollar and a non-space chacter before the closing dollar.

From the documentation

Anything between two $ characters will be treated as TeX math. The opening $ must have a character immediately to its right, while the closing $ must have a character immediately to its left. Thus, $20,000 and $30,000 won’t parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they won’t be treated as math delimiters.



来源:https://stackoverflow.com/questions/26464819/pandoc-ipython-notebook-loses-some-mathjax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!