python - nbconvert jupyter笔记本到pdf(带颜色)

标签 python jupyter-notebook

我正在尝试将 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,因此,如果 nbconvertIpypublish 都导致同样的问题,问题出在您本地的 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/

相关文章:

python - python初始条件中的快速排序算法

python - 在 IPython 中创建弹出窗口小部件

python - 如何在不使用选项卡的情况下在 jupyter notebook 中获得自动完成功能?

python - 每个进程中的管道是否独立?

python - cx_freeze:ImportError:DLL加载失败:找不到此指定的模块

python - pywintypes.error : (50, 'GetFileSecurity' , 'The request is not supported.' ) 在网络驱动器上使用 Jupyter Notebook

python - 无法加载 ipython magic 扩展 Sparkmagic : module not found

python - 使用networkx.algorithms.approximation.steinertree.steiner_tree提取斯坦纳树时出错

python - Pandas - 重新采样/按日期时间索引进行分组并执行计算

Python:使用字典来表示 matplotlib 颜色和阴影