Skip to content

LaTeX: the py:class directive renders badly in PDF when used for generics with typing #12735

Closed
@jfbu

Description

@jfbu

Describe the bug

With 7.4.0 and current Sphinx I obtain:

Capture d’écran 2024-08-05 à 14 22 22

while with 7.0.1 I obtain

Capture d’écran 2024-08-05 à 14 19 53

(intermediate 7.1.0, 7.2.0, and 7.3.0 raise an error when building the minimal example).

Perhaps my mark-up is not legit? But this copied over from tests/test_builders/test_build_latex.py::test_one_parameter_per_line.

The 7.4.0 HTML build is ok (like PDF from 7.0.1).

How to Reproduce

index.rst

domain-py-maximum_signature_line_length
=======================================

text

.. py:class:: MyGenericClass[X]

   A very nice class.

.. py:class:: MyList[T](list[T])

   Another very nice one.

Environment Information

Python version:        3.12.3 (v3.12.3:f6650f9ad7, Apr  9 2024, 08:18:48) [Clang 13.0.0 (clang-1300.0.29.30)])
Python implementation: CPython
Sphinx version:        7.4.0
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

none

Additional context

I tested also with DocUtils 0.19 and DocUtils current master same output.

Same output with current Sphinx also.

I am not one hundred percent sure this is a bug because I never used directly the py:class directive always via autodoc. Ping @picnixz for advice.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions