diff --git a/CHANGES b/CHANGES index b7987975d..7c1692dbe 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 8a1d40722..692e5c509 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -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)) diff --git a/tests/roots/test-image-in-section/index.rst b/tests/roots/test-image-in-section/index.rst index a69db0a77..08416d671 100644 --- a/tests/roots/test-image-in-section/index.rst +++ b/tests/roots/test-image-in-section/index.rst @@ -16,3 +16,7 @@ another blah Other [blah] |picture| section ------------------------------ other blah + +|picture| +--------- +blah blah blah