mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#371: fix LaTeX output generated for return annotations.
This commit is contained in:
parent
71a985c06c
commit
f470bd38e6
@ -227,14 +227,14 @@
|
|||||||
{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
|
{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
|
||||||
|
|
||||||
\newlength{\py@argswidth}
|
\newlength{\py@argswidth}
|
||||||
\newcommand{\py@sigparams}[1]{%
|
\newcommand{\py@sigparams}[2]{%
|
||||||
\parbox[t]{\py@argswidth}{#1\code{)}}}
|
\parbox[t]{\py@argswidth}{#1\code{)}#2}}
|
||||||
\newcommand{\pysigline}[1]{\item[#1]\nopagebreak}
|
\newcommand{\pysigline}[1]{\item[#1]\nopagebreak}
|
||||||
\newcommand{\pysiglinewithargs}[2]{%
|
\newcommand{\pysiglinewithargsret}[3]{%
|
||||||
\settowidth{\py@argswidth}{#1\code{(}}%
|
\settowidth{\py@argswidth}{#1\code{(}}%
|
||||||
\addtolength{\py@argswidth}{-2\py@argswidth}%
|
\addtolength{\py@argswidth}{-2\py@argswidth}%
|
||||||
\addtolength{\py@argswidth}{\textwidth}%
|
\addtolength{\py@argswidth}{\textwidth}%
|
||||||
\item[#1\code{(}\py@sigparams{#2}]}
|
\item[#1\code{(}\py@sigparams{#2}{#3}]}
|
||||||
|
|
||||||
% This version is being checked in for the historical record; it shows
|
% This version is being checked in for the historical record; it shows
|
||||||
% how I've managed to get some aspects of this to work. It will not
|
% how I've managed to get some aspects of this to work. It will not
|
||||||
|
@ -483,12 +483,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.body.append(hyper)
|
self.body.append(hyper)
|
||||||
for child in node:
|
for child in node:
|
||||||
if isinstance(child, addnodes.desc_parameterlist):
|
if isinstance(child, addnodes.desc_parameterlist):
|
||||||
self.body.append(r'\pysiglinewithargs{')
|
self.body.append(r'\pysiglinewithargsret{')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.body.append(r'\pysigline{')
|
self.body.append(r'\pysigline{')
|
||||||
def depart_desc_signature(self, node):
|
def depart_desc_signature(self, node):
|
||||||
self.body.append('}')
|
self.body.append('}{}')
|
||||||
|
|
||||||
def visit_desc_addname(self, node):
|
def visit_desc_addname(self, node):
|
||||||
self.body.append(r'\code{')
|
self.body.append(r'\code{')
|
||||||
@ -503,7 +503,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def visit_desc_returns(self, node):
|
def visit_desc_returns(self, node):
|
||||||
self.body.append(r' $\rightarrow$ ')
|
self.body.append(r'}{ $\rightarrow$ ')
|
||||||
def depart_desc_returns(self, node):
|
def depart_desc_returns(self, node):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user