Fix #2526: LaTeX writer crashes if the section having only images

This commit is contained in:
Takeshi KOMIYA 2016-05-05 16:17:38 +09:00
parent 885653a35d
commit 7c0b7e1ff1
3 changed files with 7 additions and 1 deletions

View File

@ -51,6 +51,7 @@ Bugs fixed
* #2501: Unicode subscript numbers are normalized in LaTeX
* #2492: Figure directive with :figwidth: generates incorrect Latex-code
* The caption of figure is always put on center even if ``:align:`` was specified
* #2526: LaTeX writer crashes if the section having only images
Release 1.4.1 (released Apr 12, 2016)

View File

@ -782,7 +782,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
elif isinstance(parent, nodes.section):
short = ''
if node.traverse(nodes.image):
short = '[%s]' % ' '.join(clean_astext(node).split()).translate(tex_escape_map)
short = ('[%s]' %
u' '.join(clean_astext(node).split()).translate(tex_escape_map))
try:
self.body.append(r'\%s%s{' % (self.sectionnames[self.sectionlevel], short))

View File

@ -16,3 +16,7 @@ another blah
Other [blah] |picture| section
------------------------------
other blah
|picture|
---------
blah blah blah