mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #11079 (LaTeX: figure with align disappears if not followed by text)
This commit is contained in:
parent
670bcb743b
commit
19b0710944
3
CHANGES
3
CHANGES
@ -26,6 +26,9 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #11079: LaTeX: figures with align attribute may disappear and strangely impact
|
||||||
|
following lists
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -1366,7 +1366,10 @@ class LaTeXTranslator(SphinxTranslator):
|
|||||||
self.body.append(r'\begin{wrapfigure}{%s}{%s}' %
|
self.body.append(r'\begin{wrapfigure}{%s}{%s}' %
|
||||||
('r' if node['align'] == 'right' else 'l', length or '0pt') + CR)
|
('r' if node['align'] == 'right' else 'l', length or '0pt') + CR)
|
||||||
self.body.append(r'\centering')
|
self.body.append(r'\centering')
|
||||||
self.context.append(r'\end{wrapfigure}' + CR)
|
self.context.append(r'\end{wrapfigure}' +
|
||||||
|
BLANKLINE +
|
||||||
|
r'\mbox{}\par\vskip-\dimexpr\baselineskip+\parskip\relax' +
|
||||||
|
CR) # avoid disappearance if no text next issues/11079
|
||||||
elif self.in_minipage:
|
elif self.in_minipage:
|
||||||
self.body.append(CR + r'\begin{center}')
|
self.body.append(CR + r'\begin{center}')
|
||||||
self.context.append(r'\end{center}' + CR)
|
self.context.append(r'\end{center}' + CR)
|
||||||
|
@ -120,19 +120,22 @@ def test_writer(app, status, warning):
|
|||||||
assert ('\\begin{wrapfigure}{r}{0pt}\n\\centering\n'
|
assert ('\\begin{wrapfigure}{r}{0pt}\n\\centering\n'
|
||||||
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
|
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
|
||||||
'\\caption{figure with align option}\\label{\\detokenize{markup:id9}}'
|
'\\caption{figure with align option}\\label{\\detokenize{markup:id9}}'
|
||||||
'\\end{wrapfigure}' in result)
|
'\\end{wrapfigure}\n\n'
|
||||||
|
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
|
||||||
|
|
||||||
assert ('\\begin{wrapfigure}{r}{0.500\\linewidth}\n\\centering\n'
|
assert ('\\begin{wrapfigure}{r}{0.500\\linewidth}\n\\centering\n'
|
||||||
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
|
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
|
||||||
'\\caption{figure with align \\& figwidth option}'
|
'\\caption{figure with align \\& figwidth option}'
|
||||||
'\\label{\\detokenize{markup:id10}}'
|
'\\label{\\detokenize{markup:id10}}'
|
||||||
'\\end{wrapfigure}' in result)
|
'\\end{wrapfigure}\n\n'
|
||||||
|
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
|
||||||
|
|
||||||
assert ('\\begin{wrapfigure}{r}{3cm}\n\\centering\n'
|
assert ('\\begin{wrapfigure}{r}{3cm}\n\\centering\n'
|
||||||
'\\noindent\\sphinxincludegraphics[width=3cm]{{rimg}.png}\n'
|
'\\noindent\\sphinxincludegraphics[width=3cm]{{rimg}.png}\n'
|
||||||
'\\caption{figure with align \\& width option}'
|
'\\caption{figure with align \\& width option}'
|
||||||
'\\label{\\detokenize{markup:id11}}'
|
'\\label{\\detokenize{markup:id11}}'
|
||||||
'\\end{wrapfigure}' in result)
|
'\\end{wrapfigure}\n\n'
|
||||||
|
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
|
||||||
|
|
||||||
assert 'Footnotes' not in result
|
assert 'Footnotes' not in result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user