在 IPython 笔记本中显式加载 AMSmath 会导致“[数学处理错误]"; [英] Loading AMSmath explicitly in IPython notebook causes "[Math Processing Error]"
问题描述
我是一个相对较新的 IPython Notebook 用户,我正在使用 IPython 3.2.1.因此,如果我没有仔细阅读一些文档,我深表歉意!
我正在尝试在我的笔记本中排版一些 LaTeX,用于演示.我试图利用 MathJax 的功能比默认情况下(假定)可用的功能更好,因此尝试明确地结合 MathJax 附带的其他扩展.特别是,我尝试通过以下步骤序列让我的 IPython Notebook 加载 AMScd.js、AMSsymbols.js 和 unicode.js:
- 从最新的 MathJax (v2.5) 源获取这些扩展的 .js 文件
- 将它们添加到我的 ~/.ipython/nbextensions
- 通过附加
IPython.load_extensions("AMScd")
等修改~/.ipython/profile_<mine>/static/custom中的custom.js.
现在,所有这些工作都很好,我可以在我的 IPython 笔记本中很好地排版交换图.因此,尽管如此,我还是决定包含/加载 MathJax 附带的 AMSmath.js,这是有问题的.(对我来说,鉴于其他扩展运行良好,这似乎是一件很自然的事情!)但是,尝试通过 IPython.load_extensions("AMSmath")
包含 AMSmath.js 会导致我的笔记本中出现 LaTeX 数学到处显示[数学处理错误].这是我的最小示例以及包含和不包含 IPython.load_extensions("AMSmath")
的输出.
标记:
## 一个最小的工作示例\[Delta u = f ext{ on } Omega\]
(我完全想在这里包含图片,唉,我不是这里社区的积极参与者,这让我的声望甚至不到 10!)
那么,我在这里缺少什么?为什么包含 AMSmath 存在问题?任何帮助,将不胜感激!谢谢!
它应该可以在没有额外配置的情况下工作.看看
它是如何加载的?
IPython/Jupyter notebook 预加载了一些 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:
- Obtain the .js files for these extensions from the latest MathJax (v2.5) source
- Add them to my ~/.ipython/nbextensions
- 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 ext{ 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 ext{ on } Omega$
(Or if you want the equation centered in their own line you can use $$...$$)
$$Delta u = f ext{ 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 会导致“[数学处理错误]";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!