Makes minor adjustments to the LaTeX layout.

  • Increases the whitespace above function signatures by 5px, to prevent the function visually merging with the previous one.

  • Remove unnecessary indentation and allow “raggedright” for the fields in the body of functions, which prevents ugly whitespace and line breaks.

  • Disables justification for function signatures. This is a backport of changes from Sphinx 4 added in sphinx-doc/sphinx#8997.

    New in version 2.12.0.

  • With Sphinx 3.5, doesn’t add \sphinxAtStartPar before every paragraph. The change in sphinx-doc/sphinx#8781 was to solve an issue with tables, but it isn’t clear why it then gets added for every paragraph so this extension removes it.

    New in version 2.13.0.

  • Configures hyperref to apply correct page numbering to the frontmatter.

    New in version 2.14.0.

  • Optionally, configures the needspace package.

    The needspace_amount option can be set in to add the \needspace{} command before each addnodes.desc node (i.e. a function or class description). The amount of space is set by the needspace_amount option, e.g.:

    needspace_amount = r"4\baselineskip"

    New in version 3.0.0.

New in version 2.10.0.

Enable sphinx_toolbox.tweaks.latex_layout by adding the following to the extensions variable in your

extensions = [

For more information see .

Changed in version 3.0.0: The functionality has moved to sphinx_toolbox.latex.toc. Please use that extension instead.


Setup sphinx_toolbox.tweaks.latex_layout.


app (Sphinx) – The Sphinx application.

Return type