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
First, copy the folder
/ext/jupyter/nbconvert/templates/latex
to/home/user/.local/share/jupyter/nbconvert/templates/latex
.
mkdir -p /home/user/.local/share/jupyter/nbconvert/templates/ cp -r /ext/jupyter/nbconvert/templates/latex /home/user/.local/share/jupyter/nbconvert/templates/
Create a config file at
.jupyter/jupyter_nbconvert_config.json
with the following contents:
"version": 1, "Exporter": { "template_path": [ "/home/user/.local/share/jupyter", "/home/user/.nbconvert", "." ], "template_paths": ["/home/user/.local/share/jupyter/nbconvert/templates/latex"], "preprocessors": [ "jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor", "jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor" ] } }
The result
Now you will be able to edit the config files for LaTeX documents in /home/user/.local/share/jupyter/nbconvert/templates/latex
and the cocalc system will use those settings when you click File > PDF via LaTeX
. It also appears that defaults for other export types are not broken by this process, only the LaTeX export is changed.