Fix #2351: latex crashes if enumerated lists are placed on footnotes

This commit is contained in:
Takeshi KOMIYA
2016-06-09 11:30:15 +09:00
parent 8ad8803263
commit 54e0db9cbe
2 changed files with 7 additions and 3 deletions
+1
View File
@@ -11,6 +11,7 @@ Bugs fixed
* #2622: Latex produces empty pages after title and table of contents
* #2640: 1.4.2 LaTeX crashes if code-block inside warning directive
* Let LaTeX use straight quotes also in inline code (ref #2627)
* #2351: latex crashes if enumerated lists are placed on footnotes
Release 1.4.3 (released Jun 5, 2016)
+6 -3
View File
@@ -961,9 +961,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_collected_footnote(self, node):
self.in_footnote += 1
if 'footnotetext' in node:
self.body.append('\\footnotetext[%s]{\sphinxAtStartFootnote%%' % node['number'])
self.body.append('\\footnotetext[%s]{\sphinxAtStartFootnote%%\n' % node['number'])
else:
self.body.append('\\footnote[%s]{\sphinxAtStartFootnote%%' % node['number'])
self.body.append('\\footnote[%s]{\sphinxAtStartFootnote%%\n' % node['number'])
def depart_collected_footnote(self, node):
self.body.append('}')
@@ -1303,12 +1303,15 @@ class LaTeXTranslator(nodes.NodeVisitor):
depart_field_body = depart_definition
def visit_paragraph(self, node):
# insert blank line, if the paragraph follows a non-paragraph node in a compound
index = node.parent.index(node)
if (index > 0 and isinstance(node.parent, nodes.compound) and
not isinstance(node.parent[index - 1], nodes.paragraph) and
not isinstance(node.parent[index - 1], nodes.compound)):
# insert blank line, if the paragraph follows a non-paragraph node in a compound
self.body.append('\\noindent\n')
elif index == 0 and isinstance(node.parent, nodes.footnote):
# don't insert blank line, if the paragraph is first child of a footnote
pass
else:
self.body.append('\n')