Commits

Georg Brandl committed 027ab24

#371: fix LaTeX output generated for return annotations.

  • Participants
  • Parent commits 3bb72d0

Comments (0)

Files changed (2)

sphinx/texinputs/sphinx.sty

   {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
 
 \newlength{\py@argswidth}
-\newcommand{\py@sigparams}[1]{%
-  \parbox[t]{\py@argswidth}{#1\code{)}}}
+\newcommand{\py@sigparams}[2]{%
+  \parbox[t]{\py@argswidth}{#1\code{)}#2}}
 \newcommand{\pysigline}[1]{\item[#1]\nopagebreak}
-\newcommand{\pysiglinewithargs}[2]{%
+\newcommand{\pysiglinewithargsret}[3]{%
   \settowidth{\py@argswidth}{#1\code{(}}%
   \addtolength{\py@argswidth}{-2\py@argswidth}%
   \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
 % how I've managed to get some aspects of this to work.  It will not

sphinx/writers/latex.py

         self.body.append(hyper)
         for child in node:
             if isinstance(child, addnodes.desc_parameterlist):
-                self.body.append(r'\pysiglinewithargs{')
+                self.body.append(r'\pysiglinewithargsret{')
                 break
         else:
             self.body.append(r'\pysigline{')
     def depart_desc_signature(self, node):
-        self.body.append('}')
+        self.body.append('}{}')
 
     def visit_desc_addname(self, node):
         self.body.append(r'\code{')
         pass
 
     def visit_desc_returns(self, node):
-        self.body.append(r' $\rightarrow$ ')
+        self.body.append(r'}{ $\rightarrow$ ')
     def depart_desc_returns(self, node):
         pass