table of contents

Create a table of content for your presentation.

To create the structure of your presentation you could use the following function: - section(‘Section title’) - subsection(‘Subsection title’) - subsubsection(‘Subsubsection title’)

from beampy import *

# Remove quiet=True to get Beampy render outputs
doc = document(quiet=True)

section('Introduction')
with slide('Table of content'):
    tableofcontents()

section('The main topic')
subsection('Argument 1')
with slide('Display only the current section'):
    tableofcontents(currentsection=True)

subsubsection('Demonstration 1')

with slide('Current subsection'):
    tableofcontents(currentsubsection=True)

subsection('Argument 2')
subsubsection('Demonstration 1')
subsubsection('Demonstration 2')

section('Conclusion')
with slide('Two columns table of contents'):
    with group(width='45%', x='auto', y='center') as t1:
        tableofcontents(x=0, y=0, sections=[1, 2],
                        section_style='square',
                        subsection_style='round')

    with group(width=t1.width, x='auto', y=t1.top+0) as t2:
        tableofcontents(x=0, y=0, sections=3,
                        section_style='square')

    t1.add_border()
    t2.add_border()

display_matplotlib('slide_0')
save('./examples_html_outputs/toc.html')
../_images/sphx_glr_plot_TOC_001.png

HTML output

Module arguments

class beampy.tableofcontents(sections=[], subsection=True, subsubsection=True, currentsection=False, currentsubsection=False, hideothersubsection=False, **kwargs)

Create the table of content for your presentation. This function print the TOC tree as defined in your presentation by the functions: section(), subsection(), subsubsection()

Parameters:
  • sections (list of section number or int, optional) – List of sections to be displayed (the default is an empty list which displays all the section in the TOC). If an integer is given, only the given section is displayed.
  • subsection (boolean, optional) – Display subsections (the default is True).
  • subsubsection (boolean, optional) – Display the subsubsections (the default is True).
  • currentsection (boolean, optional) – Highlight the current section (the default is False). When True, all other section (and their subsections/subsubsections) are shaded with the hidden_opacity value, except for the subsections/subsubsections of the current section.
  • currentsubsection (boolean, optional) – Highlight the current subsection (the default is False). Same as currentsection except that the subsection/subsubsection not already presented are also shaded.
  • hideothersubsection (boolean, optional) – Hide all the subsections/subsubsections of the section other than the current one (the default is False).
  • x (int or float or {'center', 'auto'} or str, optional) – Horizontal position for the TOC (the default theme sets this to ‘25px’). See positioning system of Beampy.
  • y (int or float or {'center', 'auto'} or str, optional) – Vertical position for the TOC (the default theme set this to ‘center’). See positioning system of Beampy.
  • width (int or float or None, optional) – Width of the TOC (the default is None, which implies that the width is the parent group with).
  • height (int or float or None, optional) – Height of the TOC (the default is None, which implies that the heihgt is the parent group height)
  • section_yoffset (int or float, option) – The vertical offset in pixel between two sections (the default theme sets this value to 50).
  • subsection_xoffset (int or float, optional) – The horizontal offset in pixel between the section and its subsections (the default theme sets this to 20). For subsubsections the xoffset = 2 * subsection_xoffset.
  • subsection_yoffset (int or float, optional) – The vertical offset in pixel between subsections. (the default theme sets this to 10).
  • section_style ({'round','square','number'} or None, optional) –

    The decoration displayed in front of the sections. (the default theme sets this to ‘round’).

    Possible decorcations are: - ‘round’, display a circle of radius section_decoration_size

    filled with section_decoration_color color.
    • ’square’, display a circle of length 2 x section_decoration_size filled with section_decoration_color color.
    • ’number’, display section number with the color section_number_color
    • None, display nothing.
  • subsection_style ({'round','square','number'} or None, optional) –

    The decoration displayed in front of the subsections. (the default theme sets this to None).

    Possible decorcations are: - ‘round’, display a circle of radius subsection_decoration_size

    filled with subsection_decoration_color color.
    • ’square’, display a circle of length 2 x subsection_decoration_size filled with subsection_decoration_color color.
    • ’number’, display section number with the color subsection_text_color
    • None, display nothing.
  • section_decoration_color (string, option) – Section decoration color (the default theme sets this to THEME[‘title’][‘color’]).
  • section_decoration_size (int or float, optional) – Section decoration size in pixel (the default theme sets this to 13).
  • section_number_color (string, optional) – Section number color (the default theme sets this to ‘white’).
  • section_text_color (string, optional) – Section text color (the default theme sets this to THEME[‘title’][‘color’]).
  • subsection_text_color (string, optional) – Subsection text color (the default theme sets this to THEME[‘text’][‘color’]).
  • subsection_decoration_color (string, optional) – Subsection decoration color (the default theme sets this to ‘gray’).
  • subsection_decoration_size (int or float, optional) – Subsection decoration size in pixel (the default theme sets this to 13/2).
  • hidden_opacity (float, optional) – Hidden element opacity (the default theme sets this to 0.2). Opacity is between 0 (fully hidden) to 1.

Gallery generated by Sphinx-Gallery