diff options
| author | Stefan Wallentowitz <stefan@wallentowitz.de> | 2019-05-14 12:40:37 +0200 |
|---|---|---|
| committer | Stefan Wallentowitz <stefan@wallentowitz.de> | 2019-05-24 16:07:13 +0200 |
| commit | ac0bb5132b4c7ea19f518687e02243dc56dd1870 (patch) | |
| tree | 286afc842c422dfb50c9be46ad227e33243f61f9 /tests | |
| parent | 1c45b0a1860bb0223984fac9499bb77e65c64c85 (diff) | |
| download | sphinx-git-ac0bb5132b4c7ea19f518687e02243dc56dd1870.tar.gz | |
Fix latex figure in admonition
Using figures in an admonition produces a LaTeX error ("Not in outer
par mode."). This is because it generates a float in a float. This can
be trivially fixed by overwriting the alignment to H, which is also
what is most probably intended.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/roots/test-latex-figure-in-admonition/conf.py | 1 | ||||
| -rw-r--r-- | tests/roots/test-latex-figure-in-admonition/img.png | bin | 0 -> 66247 bytes | |||
| -rw-r--r-- | tests/roots/test-latex-figure-in-admonition/index.rst | 9 | ||||
| -rw-r--r-- | tests/test_build_latex.py | 6 |
4 files changed, 16 insertions, 0 deletions
diff --git a/tests/roots/test-latex-figure-in-admonition/conf.py b/tests/roots/test-latex-figure-in-admonition/conf.py new file mode 100644 index 000000000..a45d22e28 --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-latex-figure-in-admonition/img.png b/tests/roots/test-latex-figure-in-admonition/img.png Binary files differnew file mode 100644 index 000000000..a97e86d66 --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/img.png diff --git a/tests/roots/test-latex-figure-in-admonition/index.rst b/tests/roots/test-latex-figure-in-admonition/index.rst new file mode 100644 index 000000000..e3d39d3ee --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/index.rst @@ -0,0 +1,9 @@ +Test Figure in Admonition +========================= + +.. caution:: + + This uses a figure in an admonition. + + .. figure:: img.png + diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index f02394cf1..fbc033b76 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -1389,6 +1389,12 @@ def test_latex_labels(app, status, warning): assert result.count(r'\label{\detokenize{index:section1}}') == 1 +@pytest.mark.sphinx('latex', testroot='latex-figure-in-admonition') +def test_latex_figure_in_admonition(app, status, warning): + app.builder.build_all() + result = (app.outdir / 'python.tex').text(encoding='utf8') + assert(r'\begin{figure}[H]' in result) + def test_default_latex_documents(): from sphinx.util import texescape texescape.init() |
