I want to convert ipynb notebooks to pdf. They include code (with unicode symbols), latex and plots. On Windows. To make this work, I did the following and I wonder if there is a simpler way:
1. install Quarto, rsvg-convert.exe (put in path), Fira Code
2. In MiKTeK, install Fira packages and recreate font files
3. quarto convert C.ipynb
4. add the following to the first yaml string in C.qmd
format:
pdf:
pdf-engine: xelatex
keep-tex: true
mainfont: "STIX Two Text"
mathfont: "STIX Two Math"
monofont: "Fira Code"
execute:
echo: true
output: true
5. quarto render C.qmd
If you just want an ipynb->pdf conversion, I’ve made a Typst package that might be useful: callisto: it can render notebooks to PDF using Typst instead of quarto/LaTeX. For example to render notebook.ipynb using the font settings from your example, you could compile the following document with Typst:
#import "@preview/callisto:0.2.3"
#set text(font: "STIX Two Text")
#show math.equation: set text(font: "STIX Two Math")
#show raw: set text(font: "Fira Code")
#callisto.render(nb: json("notebook.ipynb"))
I guess it makes things a bit simpler since Typst is so easy to install (just one static binary) and has excellent support for Unicode. The default callisto template is very basic, but then you can customize it directly in Typst (it’s fun and easy compared to LaTeX). So you just need one .typ file for the styling and rendering of the notebook, and the Typst binary to compile the file.
On the other hand, quarto ships with nice templates and you can also tell quarto to render the PDF with Typst (and customize the quarto Typst template). Also quarto can execute the notebook for you, while callisto will just render whatever is in the ipynb file so you have to execute it yourself in Jupyter.