git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Jupyter Notebook -> PDF with A4 pages?


Martin Sch??n <martin.schoon at gmail.com> writes:

> 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

What does this report? Compare if there is a difference between home and work.

from jupyter_core.paths import jupyter_path
print(jupyter_path('notebook','templates'))

And maybe also
print(jupyter_path('nbconvert','templates'))
-- 
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]