diff --git a/CHANGES b/CHANGES index bff398d76..8e77f1099 100644 --- a/CHANGES +++ b/CHANGES @@ -37,6 +37,7 @@ Bugs fixed Now sphinx use colorama>=0.3.5 to avoid this problem. * #2072: Fix footnotes in chapter-titles do not appear in PDF output * #1580: Fix paragraphs in longtable don't work in Latex output +* #1366: Fix centered image not centered in latex Release 1.3.3 (released Dec 2, 2015) ==================================== diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 38a2a8459..ce27dd07b 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1285,12 +1285,12 @@ class LaTeXTranslator(nodes.NodeVisitor): (1, 'top'): ('', ''), (1, 'middle'): ('\\raisebox{-0.5\\height}{', '}'), (1, 'bottom'): ('\\raisebox{-\\height}{', '}'), - (0, 'center'): ('{\\hfill', '\\hfill}'), + (0, 'center'): ('{\\hspace*{\\fill}', '\\hspace*{\\fill}}'), # These 2 don't exactly do the right thing. The image should # be floated alongside the paragraph. See # http://www.w3.org/TR/html4/struct/objects.html#adef-align-IMG - (0, 'left'): ('{', '\\hfill}'), - (0, 'right'): ('{\\hfill', '}'), + (0, 'left'): ('{', '\\hspace*{\\fill}}'), + (0, 'right'): ('{\\hspace*{\\fill}', '}'), } try: pre.append(align_prepost[is_inline, attrs['align']][0])