Jupyter Notebook -> PDF with A4 pages?

Martin Schöön martin.schoon at gmail.com
Mon Oct 14 15:57:06 EDT 2019


Den 2019-10-13 skrev Piet van Oostrum <piet-l at vanoostrum.org>:
> Martin Schöön <martin.schoon at gmail.com> writes:
>
>> 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
>
< snip >

> Make a directory ~/.jupyter/templates and put a file A4article.tplx inside it:
>
> #############
> ((=- Default to the notebook output style -=))
> ((* if not cell_style is defined *))
>     ((* set cell_style = 'style_jupyter.tplx' *))
> ((* endif *))
>
< snip >

> c.LatexExporter.template_file = 'A4article'
> c.PDFExporter.latex_count = 3
> c.PDFExporter.template_file = 'A4article'
> c.PDFExporter.latex_command = ['pdflatex', '{filename}']
> #############
> Replace 'pdflatex' with 'xelatex' if you prefer that.
> You can leave out the c.LatexExporter.template_file line if
> you don't want the LaTeX exporter to generate A4.
>
Thanks a lot.

That worked right away -- at home but not at work. Both are 
Linux systems but there are differences in both Python and
LaTeX installations. Shouldn't be too hard to figure out --
I hope.

/Martin



More information about the Python-list mailing list