Georg Brandl avatar Georg Brandl committed 027ab24

#371: fix LaTeX output generated for return annotations.

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
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.