more_autosummary.column_widths

Sphinx extension to allow customisation of column widths in autosummary tables with the LaTeX builder.

New in version 3.0.0.

Usage

This extension provides the autosummary-widths directive. This sets the autosummary table’s column widths with the LaTeX builder until the end of the current reStructuredText document, or until the next autosummary-widths directive.

.. autosummary-widths::

Set the width of the autosummary table’s columns with the LaTeX builder.

The directive takes up to two arguments – the column widths as vulgar fractions (e.g. 5/10). If only one argument is provided, this sets the width of the first column, and the width of the second column is calculated from it. If both arguments are provided, they set the width of the first and second columns respectively.

Examples:

.. autosummary-widths:: 5/10
.. autosummary-widths:: 3/10, 7/10
.. autosummary-widths:: 35/100

Attention

This directive ignores the autosummary_col_type configuration option.

API Reference

Classes:

AutosummaryWidths(name, arguments, options, …)

Customised autosummary directive with customisable width with the LaTeX builder.

WidthsDirective(name, arguments, options, …)

Sphinx directive which configures the column widths of an autosummary table for the remainder of the document, or until the next autosummary-widths directive.

Functions:

configure(app, config)

Configure sphinx_toolbox.more_autosummary.column_widths.

setup(app)

Setup sphinx_toolbox.more_autosummary.column_widths.

class AutosummaryWidths(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Bases: PatchedAutosummary

Customised autosummary directive with customisable width with the LaTeX builder.

Attention

This directive ignores the autosummary_col_type configuration option.

Methods:

get_table(items)

Generate a proper list of table nodes for autosummary:: directive.

get_table(items)[source]

Generate a proper list of table nodes for autosummary:: directive.

Parameters

items (List[Tuple[str, str, str, str]]) – A list produced by self.get_items.

Return type

List[Node]

class WidthsDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Bases: SphinxDirective

Sphinx directive which configures the column widths of an autosummary table for the remainder of the document, or until the next autosummary-widths directive.

Methods:

parse_widths(raw_widths)

Parse a width string (as a vulgar fraction) into a list of 2-element (numerator, denominator) tuples.

run()

Process the directive’s arguments.

static parse_widths(raw_widths)[source]

Parse a width string (as a vulgar fraction) into a list of 2-element (numerator, denominator) tuples.

For example, '5/10' becomes (5, 10).

Parameters

raw_widths (Iterable[str])

Return type

List[Tuple[int, int]]

run()[source]

Process the directive’s arguments.

Return type

List

configure(app, config)[source]

Configure sphinx_toolbox.more_autosummary.column_widths.

Parameters
  • app (Sphinx) – The Sphinx application.

  • config (Config)

setup(app)[source]

Setup sphinx_toolbox.more_autosummary.column_widths.

Parameters

app (Sphinx) – The Sphinx application.

Return type

SphinxExtMetadata