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: fix vertical spacing for cpp:function. #10087
Latex: fix vertical spacing for cpp:function. #10087
Conversation
As described in the issue, there is a pair of `\pysigstartmultiline/\pysigstopmultiline` for each `desc_signature` element and thus there is extra spacing when multiple functions are documented. Fixes: sphinx-doc#9924.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I since re-read #9924 (comment) with much more attention, comparing what your PR does to LaTeX output with current Sphinx, and I sense I now understand better the matter. I see how my remark "this issue would go away from having a single pair of \pysigstartmultiline/\pysigstopmultiline
" is actually what you achieve. But my understanding is that what is needed is to let your PR enrich, not replace actual situation. Your PR recycles existing \pysigstopmultiline
mark-up but if we are to make possible this @jakobandersen suggestion:
So I guess the spacing should be:
- between `<desc>` nodes: moderate vertical gap - between `<desc_signature>` nodes (no matter `is_multiline`): a bit of extra vertical gap - between `<desc_signature_line>` nodes: no vertical gap, i.e., single line spacing
what seems to be needed is to keep former \pysigstartmultiline/\pysigstopmultiline
mark-up and add another one \pysigstartsignatures/\pysigstopsignatures
at higher level. I understand there is a stumbling block here as one needs to provide some LaTeX definitions...
My intention is thus to push to your branch some commit doing that once I get the time. Not sure now if in the end I will be content with same pdf output as from your proposal (i.e. single line spacing throughout multiple signatures sharing same content) or try to get some sort of better granularity as suggested by @jakobandersen. But at any rate the LaTeX placeholder mark-up at least will be in place allowing to achieve the control which is needed for that.
To be honest my pull request was intended as a starting point for a discussion. I would appreciate your help and I think the addition of |
This fixes sphinx-doc#9924 Removes sphinx-doc#9941 complex LaTeX macros, which incidentally had broken effect of sphinx-doc#9946 on issue sphinx-doc#9926, as they become unneeded after the refactoring of \pysigline/\pysiglinewithargs expansion context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have experimented with this source:
.. py:function:: __dpd_addsd3 (a, b)
__bid_addsd3 (a, b)
__dpd_adddd3 (a, b)
__bid_adddd3 (a, b)
__dpd_addtd3 (a, b)
__bid_addtd3 (a, b)
something
.. cpp:function:: _Decimal32 __dpd_addsd3 (_Decimal32 a, _Decimal32 b)
_Decimal32 __bid_addsd3 (_Decimal32 a, _Decimal32 b)
_Decimal64 __dpd_adddd3 (_Decimal64 a, _Decimal64 b)
_Decimal64 __bid_adddd3 (_Decimal64 a, _Decimal64 b)
_Decimal128 __dpd_addtd3 (_Decimal128 a, _Decimal128 b)
_Decimal128 __bid_addtd3 (_Decimal128 a, _Decimal128 b)
something
.. cpp:function:: template<typename T> \
_Decimal32 __dpd_addsd3 (_Decimal32 a, _Decimal32 b)
template<typename T> \
_Decimal32 __bid_addsd3 (_Decimal32 a, _Decimal32 b)
template<typename T> \
_Decimal64 __dpd_adddd3 (_Decimal64 a, _Decimal64 b)
template<typename T> \
_Decimal64 __bid_adddd3 (_Decimal64 a, _Decimal64 b)
template<typename T> \
_Decimal128 __dpd_addtd3 (_Decimal128 a, _Decimal128 b)
template<typename T> \
_Decimal128 __bid_addtd3 (_Decimal128 a, _Decimal128 b)
something
.. option:: -mmmx
-msse
-msse2
something
CI test failure seems unrelated to this PR. The failed tests pass at my locale
|
Generally it looks good, though for the multi-line declarations (the function templates) the gap between each of them feels a bit too large compare to the gap between the last one and then the description. |
thanks @jakobandersen can you check now? I have ensured exact same gap from last signature to description as for between signatures. Should I add a separate parameter for that? btw, achieving this required some strange LaTeX incantations, because we are pushing here the legacy logic of rendering signatures via another remark is that it would be quite complicated to try to put into place the small extra vertical separation between signatures only in case one of them is multiline. So the |
@jfbu, thanks for Latex haxing :-). Do you happen to have a screen shot similar to the last one? |
@jakobandersen sure here we go with some from a build of our own doc: |
% signature ending up separated from description (due to voodoo next) | ||
\penalty-100 | ||
% 2) some voodoo to separate last signature from description in a manner | ||
% robust with respect to the latter being itself a LaTeX list object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"being itself possibly a LaTeX list object"
Thanks! Too me it looks good, though I rarely use the Latex output my self so if someone who uses it more, have a strong opinion then please overrule :-). |
May I please ping this pull request? |
Sorry for late, I had forgotten this (as I reboot every two weeks) and viewing #10158 I was perplexed for a long time that I had a dim memory the |
Heh ;) Thanks for merging that and for help you provided. |
s described in the issue, there is a pair of
\pysigstartmultiline/\pysigstopmultiline
for eachdesc_signature
element and thus there is extra spacing when multiple functions
are documented.
With the patch applied, I can see the following rendering:
Fixes: #9924.