choochoo
choochoo

Reputation: 81

Jupyter download as PDF via LaTeX cutting off code at margins

New to Jupyter Notebook and trying to download the .ipynb file as a PDF via LaTex. I am trying to use pre-made templates so that the code in the cells aren't getting cut off at the margins when it converts to a PDF file. So far, I have tried two solutions (listed below) but running into errors, maybe someone can point me in the right direction?

Attempted Solution #1: I followed the README in a pre-made template here: https://github.com/t-makaro/nb_pdf_template Then in Jupyter Notebook: File > Download As > PDF via LaTex and get this error, see screenshot below. Am I placing the template files in the wrong folder and thus Jupyter Notebook is somehow not picking it up?

enter image description here

Attempted Solution #2: I followed the steps in this guy's solution also: https://www.markus-beuckelmann.de/blog/customizing-nbconvert-pdf.html but then I get some error: ! LaTeX Error: File `tcolorbox.sty' not found.

Upvotes: 3

Views: 1849

Answers (1)

ClaudiaR
ClaudiaR

Reputation: 3424

I tried replicating the error following the steps at the GitHub linked on a Google Colab notebook. I've added the installation of additional libraries that are needed by nbconvert in order to unlock further capabilities.

!pip install nb_pdf_template

!python -m nb_pdf_template.install

!apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic

!jupyter nbconvert --to pdf ../testing.ipynb --template classic

This works without any problems on my end.

Upvotes: 1

Related Questions