Fix `width option of figure directive does not work if align` option also specified (ref: #2595)

This commit is contained in:
Takeshi KOMIYA 2016-05-30 10:46:17 +09:00
parent 58b4f046ab
commit da3d368961
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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' %