Jupyter Notebook -> PDF with A4 pages?

David Lowry-Duda david at lowryduda.com
Mon Oct 14 18:29:11 EDT 2019


> Is there a way to do "Download as PDF" and get A4 pages instead
> of Letter? Yes, I know I can do "Download as LaTeX" and edit the
> result to get A4 but if there is a setting I have missed I save
> work and time.

I typically use the "nbconvert" tool (that one typically installs at the 
same time as installing jupyter). Behind the scenes, this goes through 
latex (and through pandoc in particular). It seems most natural to 
convert to latex.

One can specify a template to be used in nbconvert. See

    https://nbconvert.readthedocs.io/en/latest/usage.html

for a bit more on this. The template is really used in the same way that 
templates are passed with pandoc. Alternately, if you didn't want to 
muck around with figuring out how to specify your own template, you 
could just modify the first line of the generated tex file to something 
like

    \documentclass[12pt, a4paper]{article}


If you wanted a completely different (and perhaps lackluster) approach, 
you could just view the notebook in your favorite browser and 
print-to-pdf.

Good luck!

DLD

--
David Lowry-Duda <david at lowryduda.com> <davidlowryduda.com>



More information about the Python-list mailing list