diff options
author | marxin <mliska@suse.cz> | 2022-01-11 17:20:59 +0300 |
---|---|---|
committer | marxin <mliska@suse.cz> | 2022-01-11 17:25:13 +0300 |
commit | 5295c5d4e84751e7ec083924b597ad635be862cb (patch) | |
tree | 7f75070c92fc7c8001d4b83f3546fa6f4075f613 /sphinx/writers/latex.py | |
parent | e79681c76843c1339863b365747079b2d662d0c1 (diff) |
Latex: fix vertical spacing for cpp:function.
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: #9924.
Diffstat (limited to 'sphinx/writers/latex.py')
-rw-r--r-- | sphinx/writers/latex.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 46f736f3f..1f7962b1e 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -304,6 +304,7 @@ class LaTeXTranslator(SphinxTranslator): self.in_parsed_literal = 0 self.compact_list = 0 self.first_param = 0 + self.in_desc_signature = False sphinxpkgoptions = [] @@ -737,18 +738,17 @@ class LaTeXTranslator(SphinxTranslator): else: hyper = '' self.body.append(hyper) - if not node.get('is_multiline'): - self._visit_signature_line(node) - else: + if not self.in_desc_signature: + self.in_desc_signature = True self.body.append('%' + CR) self.body.append(r'\pysigstartmultiline' + CR) + if not node.get('is_multiline'): + self._visit_signature_line(node) + def depart_desc_signature(self, node: Element) -> None: if not node.get('is_multiline'): self._depart_signature_line(node) - else: - self.body.append('%' + CR) - self.body.append(r'\pysigstopmultiline') def visit_desc_signature_line(self, node: Element) -> None: self._visit_signature_line(node) @@ -757,7 +757,10 @@ class LaTeXTranslator(SphinxTranslator): self._depart_signature_line(node) def visit_desc_content(self, node: Element) -> None: - pass + assert self.in_desc_signature + self.body.append('%' + CR) + self.body.append(r'\pysigstopmultiline') + self.in_desc_signature = False def depart_desc_content(self, node: Element) -> None: pass |