List of extensions#

You can activate and configure the notebook extensions by clicking on the Nbextensions tab. There you have access to the extensions, which can be activated/deactivated via checkboxes. In addition, documentation and configuration options are displayed for each extension.

Configuration of the notebook extensions

Hereinafter I will give a brief overview of some of the notebook extensions.

(some) LaTeX environments for Jupyter notebook

enables the use of Markdown cells for LaTeX commands and environments. In addition, two menus are added: LaTeX_envs for quick selection of the suitable LaTeX environment and Some configuration options for further options:

LaTeX environment

The notebook can then be exported as an HTML or LaTeX document.

The configuration of the LaTeX environments is done in user_envs.json and for the styles in latex_env.css. Additional environments can be added in user_envs.json or in thmsInNb4.js (→ LaTeX-Environments doc).

jupyter-autopep8

formats/beautifies Python code in cells. The extension uses autopep8 and can therefore only be used with a Python kernel.

A Code Prettifier

formats/beautifies code notebook code cells. The current notebook kernel is used, which is why the Prettifier package used must be available in this kernel. Sample implementations are provided for ipython, R, and Javascript kernels.

Limit Output

limits the number of characters that a code cell outputs as text or HTML. This also breaks endless loops. You can set the number of characters with the ConfigManager:

from notebook.services.config import ConfigManager
cm = ConfigManager().update('notebook', {'limit_output': 1000})
Nbextensions edit menu item

adds an edit menu to open the configuration page of nbextensions.

Printview

adds an icon to display the print preview of the current notebook in a new browser tab.

Ruler

adds a ruler after a certain number of characters. The number of characters can be specified with the ConfigManager:

from notebook.services.config import ConfigManager
ip = get_ipython()
cm = ConfigManager(parent=ip)
cm.update('notebook', {"ruler_column": [80]})
Scratchpad notebook extension

adds a note cell to the notebook. In this cell you can run code from the current kernel without changing the document.

Snippets

adds a configurable menu item to notebooks to insert snippets, boilerplate and code examples.

Snippets menu

You can also define your own menu items, see also Snippets.

Table of Contents (2)

makes it possible to collect all headings and display them in a floating window, as a sidebar or in a navigation menu.

If headings shouldn’t be displayed in the table of contents, you can do this with:

## My title <a class="tocSkip">

The table of contents can also be exported by specifying a corresponding template, e.g.

$ jupyter nbconvert mynotebook.ipynb --template toc2

General documentation on templates can be found in Customizing exporters.

Tree-filter

filters in the Jupyter dashboard by file name.

A 2to3 converter

converts Python2 to Python3 code in a code cell using the lib2to3 library.

Codefolding

enables code folding in code cells.

Codefolding

Usually code folding is retained when exporting with nbconvert. This can either be changed in jupyter_nbconvert_config.py with:

c.CodeFoldingPreprocessor.remove_folded_code=True = True

or on the command line with:

$ jupyter nbconvert --to html --CodeFoldingPreprocessor.remove_folded_code=True mynotebook.ipynb
Collapsible Headings

enables notebooks to have collapsible sections separated by headings.

Datestamper

inserts the current time and date in one cell.

Hinterland

enables autocompletion.

Variable Inspector

collects all defined variables and displays them in a floating window.

Purpose

automatically loads a series of latex commands from the latexdefs.tex file when a notebook is opened.