Convert notebook to pdf

I have just started using jupyterlab and I am having problems exporting my notebook to pdf and it shows me the error message below. I need your help if someone has been able to solve this problem. thank you in advance

nbconvert failed: PDF creating failed, captured latex output:
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<> .\notebook
.tex -quiet
! Emergency stop.
> .\notebook
.tex -quiet
No pages of output.
Transcript written on ?.

Is <> .\notebook somewhere in your notebook? Not an expert but could it be that there’s a string in your notebook that causes the latex to fail to compile? If it works in Jupyter notebook but not Jupyter lab than that’s probably not it.

I encountered the same problem as you when using TexLive 2019. The following link looks good to me.

Problem in Converting Jupyter notebook to pdf · Issue #144 · jupyter/jupyter_core · GitHub

It says:

However, attempting to convert to pdf from jupyter lab still gave the same error. I tracked down the offending line of code here:
Line 66

#writer = Instance("nbconvert.writers.FilesWriter", args=(), kw={'build_directory': '.'})
writer = Instance("nbconvert.writers.FilesWriter", args=(), kw={'build_directory': ''})

Changing the 'build_directory' : '.' to 'build_directory' : '' solves the issue for me… apparently it was looking in the wrong location for the file, ie:

xelatex .\notebook.tex


xelatex notebook.tex


Hope this works


Thinks, i find the same problem just now. Under :the anconda installation path\Lib\site-packages\nbconvert\exporters\ as you said. It works.