Evan Kim
Evan Kim

Reputation: 829

nbconvert jupyter notebook to pdf (with color)

I am trying to convert a jupyter notebook into a pdf.

I am able to get this done with the jupyter nbconvert MyFile.ipynb --to pdf, BUT the output strips all the color in my text. Not to mention my bullet point formatting gets ruined too.
nbconvert pdf - https://i.sstatic.net/y72b5.jpg
original nb - https://i.sstatic.net/MIY1R.jpg

I did a fair amount of searching and wasn't able to find anything. Can someone point me into the right direction here? I don't know what to search for at this point

Edit: Here is some of my latex/markdown code

**(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.```

Upvotes: 1

Views: 3518

Answers (1)

user10434643
user10434643

Reputation:

I had the same issues using jupyter nbconvert, I tried a plugin called Ipypublish, I works perfectly and has some quite good features (very easy to use):

Installation : pip install ipypublish

Simple conversion : nbpublish -pdf -lb example/notebooks/Example.ipynb

UPDATED:

Jupyter converts a notebook to PDF by converting it to LaTeX, and then using your local latex to convert it to pdf, so if both nbconvert and Ipypublish resulted in the same issue, the problem is with you local Latex, so here's the way to check and fix it:

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

To know more : Documentation

Upvotes: 3

Related Questions