Writing an IPython notebook to HTML or PDF with Table Of Content

前端 未结 2 1687
旧巷少年郎
旧巷少年郎 2021-01-12 07:04

Im trying to create a report from my IPython notebook. Im using the toc extension to create a toc for my nb. I already converted the notebook to html, but the toc is not sh

2条回答
  •  执念已碎
    2021-01-12 07:56

    I used a method without the nb extension to write the ToC to pdf (through Latex). I don't think it'd work when exporting as HTML though.

    I added this cell at the top of the notebook:

    %%latex
    \tableofcontents
    

    And then converted to pdf based on this answer

    jupyter nbconvert --to pdf --TemplateExporter.exclude_input=True my_notebook.ipynb
    

提交回复
热议问题