使用适用于IPython Notebook的MathJax排版数学 [英] Typesetting Math using MathJax for IPython Notebook Web page

查看:137
本文介绍了使用适用于IPython Notebook的MathJax排版数学的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我选择学习在IPython Notebook中编写数学表达式,然后坐下来探索学习资源.我找到了此官方链接.

我在本地的IPython笔记本上复制了整个教程,然后将其发布到了网站.我还在博客文章中解释了为实现这一目标而进行的整个努力.

不幸的是,无论我做什么,我都无法使网页完全渲染/显示数学表达式 .我不确定为什么当最后几个单元格给出正确的输出时,整个笔记本电脑都无法显示方程式的显示.

我还检查了源网页和我的网页中,发现<script>代码位于我的位置.

我根本不了解JavaScript和L A T E X!有人可以帮忙吗!

再次是我的网页,我在其中复制了源教程.

还有,ipython nbconvert是将.ipynb文件转换为html的最佳方法吗?

解决方案

您面临的问题是,当前的pandoc(文档转换器)在将markdown单元格转换为html时会剥离原始胶乳,请参见 PR 转换为pandoc,以便在转换时不剥离原始胶乳如果提供了--mathjax选项,则为html.但是,除非您从源代码构建pandoc,否则要花费一些时间才能使用此功能.

是的,nbconvert是将.ipynb文件转换为html的正确(也是最好的)工具!

I chose to learn to write mathematical expressions in IPython Notebook and sat to explore learning resources. I found this official link.

I reproduced the whole tutorial on my IPython NoteBook locally and then published it on my website. I also explained the whole struggle I went into while trying to achieve this in my blog post.

Unfortunately, whatever I do, I am not able to get the web page render/display the math expressions at all. I am not sure why the whole notebook failed to show the display of equations when the last couple cells gave the right output.

I also checked both the html codes of the source web page and my web page to find that the <script> code is where it has to be in mine.

I do not know JavaScript and LATEX at all! Can someone help please!

Again, this is the Source link. And this is my webpage where I copied the source tutorial.

Also, is the ipython nbconvert the best and the right way to convert .ipynb files into html?

解决方案

The problem you face is that currently pandoc (the document converter) strips raw latex when converting the markdown cells to html, see docu. Math in pandoc needs to be inside $..$ or $$..$$ delimiters.
The last couple of cells have explicit $s and thus convert fine. The other cells don't have this latex markup and thus get stripped during the conversion. You can try to embed the not working equations in $$s to prevent their removal (not tested).

There is a very recent PR to pandoc, to not strip raw latex when converting to html if the --mathjax option is supplied. Nevertheless, it will take some time to get this feature available unless you build pandoc from source.

And yes, nbconvert is the right (and best) tool to convert .ipynb files to html!

这篇关于使用适用于IPython Notebook的MathJax排版数学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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