Convert ipynb to pdf in Jupyter

后端 未结 9 1243
臣服心动
臣服心动 2021-01-31 08:23

I am new to ipython notebook, and I would like to convert my ipynb to pdf. But I get the following error when I try to Download as PDF via LaTex.

nbconvert faile         


        
相关标签:
9条回答
  • 2021-01-31 09:16

    As said by Thomas K in the comments, you need to have Latex installed, and after add the path to the directory containing pdflatex.exe file to the PATH variable of your system.

    I have looked for a lightweight distribution and tried installing TeXworks, but I didn't find any pdflatex.exe file.
    So I have tried TeX Live, which worked fine creating the pdflatex.exe file under the target installation directory. This path should be like C:\...\texlive\2016\bin\win32.
    Finally, you should just add this path to the PATH environment variable of your system (you can use the link shared by Thomas K).

    As said here, you need to quit jupyter notebook and open a new command prompt after making any path changes, in order for jupyter to find the newly added item to the PATH.

    Then, in Jupyter, you can check your environment variables by running the following (refer to this link for details):

        import os
        os.environ['PATH'].split(';')
    

    and check if it contains the path to pdflatex.exe file.

    If you get some trouble when exporting your notebook to pdf due to missing files/packages (this happened to me), refer to this link to search and install them under TeX Live.

    0 讨论(0)
  • 2021-01-31 09:16

    Instead of using nbconvert what you can do is :

    1. Download your ipynb file as HTML from File option.
    2. Right-click and select print or use Ctrl+P.
    3. Save as PDF

    Easy.

    0 讨论(0)
  • 2021-01-31 09:18

    I know my solution is not at a level. But it works !!

    in your browser of notebook tab, simply do "ctrl + p" to get download in pdf

    0 讨论(0)
提交回复
热议问题