From da3d368961f8eb75b28d231718bf4e53194d9c16 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 30 May 2016 10:46:17 +0900 Subject: [PATCH] Fix ``width`` option of figure directive does not work if ``align`` option also specified (ref: #2595) --- CHANGES | 1 + sphinx/writers/latex.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4341d19fb..d1cf8b450 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Bugs fixed ---------- * #2530: got "Counter too large" error on building PDF if large numbered footnotes existed in admonitions +* ``width`` option of figure directive does not work if ``align`` option specified at same time (ref: #2595) Release 1.4.2 (released May 29, 2016) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 20ee0c26e..889e86e75 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1431,8 +1431,8 @@ class LaTeXTranslator(nodes.NodeVisitor): node.children[0]['ids']): ids += self.hypertarget(node.children[0]['ids'][0], anchor=False) if node.get('align', '') in ('left', 'right'): - if 'width' in node: - length = width_to_latex_length(node['width']) + if 'width' in node[0]: + length = width_to_latex_length(node[0]['width']) else: length = '0pt' self.body.append('\\begin{wrapfigure}{%s}{%s}\n\\centering' %