0

I used to use an extension in classic mode to embed my table of contents such that when I export the notebook as a PDF, the TOC remains linked to the internal sections. In Jupyter Lab, I see the TOC on the left but there doesn't seem to be a way to get it into the notebook? I feel like there must be a shortcut I'm missing; re-coding the entire thing manually defeats the purpose I'd like to use jupyter for.

I tried:

jupyter contrib nbextension install --user
usage: jupyter-contrib [-h] [--debug] [--show-config] [--show-config-json] [--generate-config] [-y]
                       [--log-level JupyterContribApp.log_level] [--config JupyterContribApp.config_file]
                       [extra_args ...]
jupyter-contrib: error: argument --user: expected one argument

I think there's an issue between downloading nbextensions and getting it installed with its associated JavaScript and CSS files, but I'm not sure where to go from here.

Old things I tried that appear deprecated:

1
  • Important to note that jupyter_contrib_nbextensions is not for current Jupyter. Unless you are using NbClassic, it's no longer an approach that should be considered. So it is no longer the 'usual' extension and should not be considered such. Please mention versions in posts as Colonel's answer touches on Jupyter Notebook 7+ being a completely different beast. v7+ is built on JupyterLab components. Commented Oct 16 at 18:22

1 Answer 1

0

You can use nbconvert[webpdf] for jupyterlab.
you need Jupyter Lab 4+ / Notebook 7+ version for this.

1. Install the dependencies
pip install --upgrade jupyterlab nbconvert[webpdf]

then launch your notebook in jupyer lab and check the markdown heading by clicking on table of content in left sidebar(book icon). once you verify the headings. then simply open cmd or terminal and run this command:

jupyter nbconvert your_notebook.ipynb --to webpdf

you will see that you notebook is exported to PDF in same folder where your notebook.ipynb is present. Hope this will helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.