How to remove or change the header of jupyter notebooks pdf in Visual Studio Code?
Question:
I am in Visual Studio Code and I have created the following jupyter notebook:
I would like to know how to remove or modify the pdf header (circled in red below) produced when I export this notebook to pdf with VSCode.
I know this is a similar header to a latex document produced with maketitle
, but I don’t know how to remove it or how to change the title, add authors or change the date. I would also like to know how to reduce the margins of the pdf produced (in my latex document I use geometry
for).
Thanks for your help :
Answers:
In fact, the best way to convert jupyter files to PDF is not through vsocd or notepad. We can open jupyter files through Chrome browser, and then convert them to PDF by printing, so that no title can be adjusted, and row spacing can be adjusted in print.
I didn’t find a satisfying solution: you would have to edit the notebook’s metadata (in JSON).
For now, I:
-
export the notebook as LaTeX source (e.g. jupyter-nbconvert --to latex my_notebook.ipynb
)
-
edit the generated .tex
file to adjust title and author.
-
compile it to pdf (pdflatex
or your favorite tool).
I am in Visual Studio Code and I have created the following jupyter notebook:
I would like to know how to remove or modify the pdf header (circled in red below) produced when I export this notebook to pdf with VSCode.
I know this is a similar header to a latex document produced with maketitle
, but I don’t know how to remove it or how to change the title, add authors or change the date. I would also like to know how to reduce the margins of the pdf produced (in my latex document I use geometry
for).
Thanks for your help :
In fact, the best way to convert jupyter files to PDF is not through vsocd or notepad. We can open jupyter files through Chrome browser, and then convert them to PDF by printing, so that no title can be adjusted, and row spacing can be adjusted in print.
I didn’t find a satisfying solution: you would have to edit the notebook’s metadata (in JSON).
For now, I:
-
export the notebook as LaTeX source (e.g.
jupyter-nbconvert --to latex my_notebook.ipynb
) -
edit the generated
.tex
file to adjust title and author. -
compile it to pdf (
pdflatex
or your favorite tool).