Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX: excessive whitespace since v4.4.0 #10158

Closed
rhssk opened this issue Feb 3, 2022 · 5 comments
Closed

LaTeX: excessive whitespace since v4.4.0 #10158

rhssk opened this issue Feb 3, 2022 · 5 comments

Comments

@rhssk
Copy link

rhssk commented Feb 3, 2022

Describe the bug

Hi,

I'm using Sphinx together with Breathe and Doxygen to generate LaTeX -> PDF documentation.

Since v4.4.0 I've noticed that undocumented variables/structure members have large amount of whitespace added below them.
Bisecting shows that this is caused by b230365 (#9941).

HEAD (799385f):
4 x_HEAD
With revert:
4 x_revert_b23036570

How to Reproduce

Input RST:

.. cpp:class:: Data

   .. cpp:union:: @data

      .. cpp:var:: int a

      .. cpp:var:: double b

MWE.zip

Expected behavior

No response

Your project


Screenshots

No response

OS

Linux

Python version

3.10.2

Sphinx version

v4.4.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@rhssk rhssk added the type:bug label Feb 3, 2022
@jakobandersen
Copy link
Contributor

It indeed looks excessive, but note that the layout is tuned for when you have documentation of the entities, e.g.,

.. cpp:class:: Data

   A class that models either this or that.

   .. cpp:union:: @data

      A nested union storing the data different in this and that.

      .. cpp:var:: int a

         If it models a this, then this member is valid.

      .. cpp:var:: double b

         If it models a that, then this member is valid.

@jfbu may be able to provide at bit more details in what is going on with the whitespace and may be doable.

@jfbu
Copy link
Contributor

jfbu commented Feb 14, 2022

Hi thanks for report. In fact the problem caused by the commit you identified (#9941) had already been fixed at #10087 which I have now merged into 4.x, so whitespace will be better at 4.5.0:
Capture d’écran 2022-02-14 à 20 58 39

@jfbu jfbu added this to the 4.5.0 milestone Feb 14, 2022
@jfbu
Copy link
Contributor

jfbu commented Feb 14, 2022

Fixed at 6768577

@jfbu jfbu closed this as completed Feb 14, 2022
@rhssk
Copy link
Author

rhssk commented Feb 15, 2022

Hi. I've applied the fix locally and it indeed improves the spacing issues but does not completely bring spacing back to the pre-v4.4.0 state.

Here's a comparison of v4.4.0, current HEAD (b8789b4) and the revert of b230365 (left-to-right):
screenshot-2022-02-15_12-51-46

Nevertheless, this is good enough for me, so thanks for the fix.

@jfbu
Copy link
Contributor

jfbu commented Feb 15, 2022

Thanks for the feedback and nice visual diff! Yes indeed the merge of #10087 is not a revert of b230365, and deliberately injects some more spacing for better grouping, see #10087 (comment).

Although there is no way to reproduce exactly former behaviour (which had quite a few issues, and the LaTeX code has been changed significantly), it might be that adding this to conf.py

latex_elements = {
    'preamble': r'\setlength{\sphinxsignaturesep}{0pt}',
}

will mimick close enough. The default setting \smallskipamount rather than 0pt is responsible for some extra vertical whitespace. It is very difficult to provide a customizable interface because Sphinx sticks to legacy situation that object descriptions are rendered using LaTeX list/\item syntax which in hindsight is not adapted for such things, in particular to get multiple such "labels" share a common description, which is what #10087 in particular is about.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants