I have started learning Python and I want to record my sessions through Jupyter Notebooks used in VS Code, as well as to export them to PDF. However, I am unable to do so because it requires Latex and it does not seem to be so easy to install as a regular library such as numpy.
I get the following message when exporting to PDF:
[error] If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions please look https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.To avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers "Print to PDF" feature.
It also says I’m missing Pandoc although I have installed it. (I believe this has to do with not having TeX). I have checked the link that shows up, but I don’t know how to set up Latex in Windows. I have installed MikTex and a couple extensions in VS (Latex and Latex Workshop). How can I install it successfully to be able to export to PDF?
Also, I have used Latex online with Overleaf, and every time I wanted to include a package, I just used includepackage{…}. Would this work in the same way in VS? Since it’s not online I’m not sure if it would be that easy to download packages.
2
Answers
Do you have the correct tex library installed?
Please follow the step according to the document.
If you are using windows, you can download here.
If you are familiar with Git you can also clone the repository using the command line or your favorite Git fontend tool:
select html when exporting
Open the exported
name.html
file with a browserCtrl+P to open the printed page, use
Print to PDF
to export it as a pdf fileIf you still want to export to pdf directly in vscode, you can check this answer, there are detailed steps.