Skip to content

Instantly share code, notes, and snippets.

So I say to you, walk with the wind, brothers and sisters, and let the spirit of peace and the power of everlasting love be your guide.

John Lewis RIP

@binary10
binary10 / cocalc-nbconvert-to-latex.md
Last active November 29, 2022 19:01
How can I export PDFs with custom LaTeX templates using the export button in cocalc?

The problem

Cocalc exports notebooks to LaTeX using a default provided by nbconvert when File > PDF via LaTeX is clicked in the menu.

I wanted to be able to customize the default LaTeX settings (found at /ext/jupyter/nbconvert/templates/latex), however this contains read-only files on the system. So, I created a local config, but they do not automatically override the system settings. After interpreting the docs, I found how to override the system default.

The recipe

  1. First, copy the folder /ext/jupyter/nbconvert/templates/latex to /home/user/.local/share/jupyter/nbconvert/templates/latex.
# A model of computation
for(i in 1:2)
{
print("To calculate two times two, please enter: 2*2")
scan(what="char")
print("Sorry, that's incorrect.")
}
print("To calculate two times two, please enter: 2*2")
scan(what="char")