This page was generated from doc/gallery/gallery-with-nested-documents.ipynb. Interactive online version: . Download notebook.

# Gallery With Nested Documents

You can create thumbnail galleries in reST files, but you can also create such galleries in Jupyter notebooks by adding the `nbsphinx-gallery` cell tag or metadata, which is used just like the nbsphinx-toctree cell tag/metadata. For possible options, see the toctree notebook.

Note

In LaTeX output this behaves just like `toctree`, i.e. no thumbnail gallery is shown, but the linked files are included in the document.

Like with `toctree` you should avoid adding content after a gallery (except other toctrees and galleries) because this content would appear in the LaTeX output after the content of all included source files, which is probably not what you want.

The following cell has the `nbsphinx-gallery` tag, which creates a thumbnail gallery. The first section title in that cell (if available) is used as `caption` (unless it is already given in the metadata).

The notebooks in the following gallery describe different ways how to select which images are used as thumbnails. The notebooks are added as sub-sections under the current section, just like when using `toctree`. If you want to create a gallery from links to notebooks that are already included somewhere else, you can use nbsphinx-link-gallery.

This is a thumbnail gallery with sub-documents:

Last Image Is Used by Default
Using a Cell Tag to Select a Thumbnail
Using Cell Metadata to Select a Thumbnail and Provide a Tooltip
Choosing from Multiple Outputs
No Thumbnail Available
Specifying a Thumbnail File