Pandoc IPython笔记本丢失了一些Mathjax [英] Pandoc IPython notebook loses some Mathjax

查看:109
本文介绍了Pandoc IPython笔记本丢失了一些Mathjax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我有一个IPython笔记本,其中包含一些用MathJax编写的公式.在笔记本本身中可以很好地渲染它,但是当我尝试导出它时,我的大部分公式都消失了!

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:

我输入

$ \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?

我的环境:

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

推荐答案

在pandoc中,您需要在开盘美元后面加上一个非空格字符,并在闭盘美元前面要求一个非空格字符.

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

文档

两个$字符之间的任何字符都将被视为TeX数学.这 开头的$必须在其右边立即有一个字符,而 结束$必须在其左侧紧跟一个字符.因此,$ 20,000 而$ 30,000不会解析为数学.如果出于某种原因您需要 用文字$字符括住文本,反斜杠转义它们,然后它们 将不会被视为数学定界符.

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.

这篇关于Pandoc IPython笔记本丢失了一些Mathjax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆