我正在尝试将 jupyter 笔记本转换为 pdf。
我可以使用 jupyter nbconvert MyFile.ipynb --to pdf 来完成此操作,但输出会去除文本中的所有颜色。更不用说我的要点格式也被破坏了。
nbconvert pdf - /image/y72b5.jpg
原NB-/image/MIY1R.jpg
我进行了大量的搜索,但没有找到任何东西。有人能指出我正确的方向吗?我现在不知道要搜索什么
编辑:这是我的一些 latex / Markdown 代码
**(Joyce, 2017 Chapter 4)** April 3rd, 2019
> A <font color='#0b7c29'>**group $G$**</font> has an underlying set, also denoted $G$, and a binary operation $G\times G \rightarrow G$ that satisfies three axioms.```
最佳答案
我在使用jupyter nbconvert
时遇到了同样的问题,我尝试了一个名为Ipypublish
的插件,我工作得很好并且有一些非常好的功能(非常易于使用):
安装:pip install ipypublish
简单转换:nbpublish -pdf -lb example/notebooks/Example.ipynb
更新:
Jupyter 将笔记本转换为 PDF,方法是将其转换为 LaTeX,然后使用本地 Latex 将其转换为 pdf,因此,如果 nbconvert
和 Ipypublish
都导致同样的问题,问题出在您本地的 Latex 上,所以这是检查和修复它的方法:
1-
jupyter nbconvert example.ipynb --to latex
2- then you can use your local latex to convert it to PDF and debug the file (
latex example.tex
), you can even use overleaf to make that conversion online if your Local latex is missing some libraries or something
了解更多:Documentation
关于python - nbconvert jupyter笔记本到pdf(带颜色),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55544148/