在IPython笔记本中显式加载AMSmath会导致“[Math Processing Error]” [英] Loading AMSmath explicitly in IPython notebook causes "[Math Processing Error]"

查看:1169
本文介绍了在IPython笔记本中显式加载AMSmath会导致“[Math Processing Error]”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个相对较新的IPython Notebook用户,我使用的是IPython 3.2.1。如此前瞻,如果我没有仔细阅读一些文档,我表示歉意!



我正在尝试在我的笔记本中排版一些LaTeX用于演示。我试图更好地利用MathJax功能,而不是默认使用的(假设)可用,因此尝试将MathJax附带的其他扩展明确地结合在一起。特别是,我尝试让我的IPython Notebook通过以下步骤加载AMScd.js,AMSsymbols.js和unicode.js:


  1. 从最新的MathJax(v2.5)源获取这些扩展名的.js文件

  2. 将它们添加到我的〜/ .ipython / nbextensions

  3. 通过附加 IPython.load_extensions(AMScd)等修改〜/ .ipython / profile_< mine> / static / custom中的custom.js。

现在,所有这些工作正常,我能够在我的IPython笔记本中很好地排版交换图。所以,尽管如此,我决定还包括/加载MathJax附带的AMSmath.js,这是有问题的。 (对我来说,这似乎是一件很自然的事情,因为其他扩展可以很好地工作!)但是,试图通过包含AMSmath.js IPython.load_extensions(AMSmath)导致我的笔记本中的LaTeX数学在任何地方显示 [数学处理错误] 。这是我的最小示例和输出,包括和不包括 IPython.load_extensions(AMSmath)



加价:

  ##最小工作示例

\\ [
\Delta u = f \text {on} \ Omega
\\]

(我非常想在这里包含图片,唉,我不是社区的积极参与者,这使我甚至没有10个声誉!)



那么,我在这里错过了什么?为什么包含AMSmath会有问题?任何帮助,将不胜感激!谢谢!

解决方案

无需额外配置即可使用。看看



如何加载?



IPython / Jupyter笔记本预加载一些 MathJax扩展包括您要加载的扩展程序。此扩展名不是IPYthon / Jupyter扩展名,因此如果您尝试将此MathJax扩展名加载为IPython / Jupyter扩展名,则该扩展名不应该有效。请参见此处了解有关如何加载其他MathJax扩展的更多信息。


I am a relatively new IPython Notebook user and I am using IPython 3.2.1. So upfront, my apologies if I did not read some documentation carefully!

I am trying to typeset some LaTeX in my Notebook intended for a presentation. I tried to utilize MathJax capabilities better than what's (supposedly) available by default and so tried incorporating other extensions that come with MathJax explicitly. In particular, I tried getting my IPython Notebook to load AMScd.js, AMSsymbols.js and unicode.js through the following sequence of steps:

  1. Obtain the .js files for these extensions from the latest MathJax (v2.5) source
  2. Add them to my ~/.ipython/nbextensions
  3. Modify custom.js in ~/.ipython/profile_<mine>/static/custom by appending IPython.load_extensions("AMScd"), etc.

Now, all these work fine, and I am able to typeset commutative diagrams nicely in my IPython notebook. So, while at all this, I decided to also include/load AMSmath.js that comes along with MathJax and this is problematic. (To me, this seems like a natural thing to do given that other extensions work well!) However, attempting to include AMSmath.js via IPython.load_extensions("AMSmath") causes LaTeX math in my Notebook to display [Math Processing Error] everywhere. Here's my minimal example and the output with and without including IPython.load_extensions("AMSmath").

Markup:

## A minimal working example

\\[
\Delta u = f \text{ on } \Omega
\\]

(I would totally like to include images here, alas, my not being an active participant in the community here leaves me with not even 10 reputation!)

So, what am I missing here? Why is this inclusion of AMSmath problematic? Any help would be appreciated! Thanks!

解决方案

It should work without extra configuration. Have a look here.

Your example in a markdown cell should be

(If you want the equation inline you can use $...$)

Inline equation $\Delta u = f \text{ on } \Omega$

(Or if you want the equation centered in their own line you can use $$...$$)

$$\Delta u = f \text{ on } \Omega$$

The result of both snippets in the same markdown cell is rendered as:

How it is loaded?

IPython/Jupyter notebook preloads some MathJax extensions including the extension you want to load. This extension is not an IPYthon/Jupyter extension so it shouldn't work if you try to load this MathJax extension as an IPython/Jupyter extension. See here to know more about how to load other MathJax extensions.

这篇关于在IPython笔记本中显式加载AMSmath会导致“[Math Processing Error]”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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