summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2013-09-02 15:44:15 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2013-09-02 15:44:15 +0000
commitbd30bcb0bcb75089739017730f4c48cbb528a84d (patch)
tree0af4678a2b8491c67a19a6bf3f3feff278787485
parentea7bd5e1c5e6f115f1a3aad94117c4b17ccf0547 (diff)
downloaddocutils-bd30bcb0bcb75089739017730f4c48cbb528a84d.tar.gz
Fix [ 239 ] Latex writer glues paragraphs with figure floats.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7718 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--HISTORY.txt4
-rw-r--r--docutils/writers/latex2e/__init__.py4
-rw-r--r--test/functional/expected/standalone_rst_latex.tex5
-rw-r--r--test/functional/expected/standalone_rst_xetex.tex5
4 files changed, 16 insertions, 2 deletions
diff --git a/HISTORY.txt b/HISTORY.txt
index c1b3ec8aa..e835d7074 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -16,6 +16,10 @@
Changes Since 0.11
==================
+* docutils/writers/latex2e/__init__.py
+
+ - Fix [ 239 ] Latex writer glues paragraphs with figure floats.
+
* docutils/writers/odf_odt/__init__.py
- Apply patch by Jakub Wilk to fix bug [ 100 ].
diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py
index 9be0e651b..b45325255 100644
--- a/docutils/writers/latex2e/__init__.py
+++ b/docutils/writers/latex2e/__init__.py
@@ -2138,9 +2138,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
# The LaTeX "figure" environment always uses the full textwidth,
# so "outer alignment" is ignored. Just write a comment.
# TODO: use the wrapfigure environment?
- self.out.append('\\begin{figure} %% align = "%s"\n' % alignment)
+ self.out.append('\n\\begin{figure} %% align = "%s"\n' % alignment)
else:
- self.out.append('\\begin{figure}\n')
+ self.out.append('\n\\begin{figure}\n')
if node.get('ids'):
self.out += self.ids_to_labels(node) + ['\n']
diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex
index f3876a7f1..54308b6c0 100644
--- a/test/functional/expected/standalone_rst_latex.tex
+++ b/test/functional/expected/standalone_rst_latex.tex
@@ -938,6 +938,7 @@ An image 2 cm high:
A \emph{figure} is an image with a caption and/or a legend. With page-based output
media, figures might float to a different position if this helps the page
layout.
+
\begin{figure}
\noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
\caption{Plaintext markup syntax and parser system.}
@@ -970,6 +971,7 @@ This paragraph is also part of the legend.
\end{figure}
A left-aligned figure:
+
\begin{figure} % align = "left"
\noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -986,6 +988,7 @@ The specific behavior depends upon the style sheet and the browser or
rendering software used.
A centered figure:
+
\begin{figure}
\noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -1002,6 +1005,7 @@ The specific behavior depends upon the style sheet and the browser or
rendering software used.
A right-aligned figure:
+
\begin{figure} % align = "right"
\noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -2381,6 +2385,7 @@ None
\hline
\end{longtable}
\label{table-label}
+
\begin{figure}
\phantomsection\label{figure-label}
\noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
diff --git a/test/functional/expected/standalone_rst_xetex.tex b/test/functional/expected/standalone_rst_xetex.tex
index 5a971b445..a5abbb198 100644
--- a/test/functional/expected/standalone_rst_xetex.tex
+++ b/test/functional/expected/standalone_rst_xetex.tex
@@ -937,6 +937,7 @@ An image 2 cm high:
A \emph{figure} is an image with a caption and/or a legend. With page-based output
media, figures might float to a different position if this helps the page
layout.
+
\begin{figure}
\noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
\caption{Plaintext markup syntax and parser system.}
@@ -969,6 +970,7 @@ This paragraph is also part of the legend.
\end{figure}
A left-aligned figure:
+
\begin{figure} % align = "left"
\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -985,6 +987,7 @@ The specific behavior depends upon the style sheet and the browser or
rendering software used.
A centered figure:
+
\begin{figure}
\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -1001,6 +1004,7 @@ The specific behavior depends upon the style sheet and the browser or
rendering software used.
A right-aligned figure:
+
\begin{figure} % align = "right"
\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
\caption{This is the caption.}
@@ -2149,6 +2153,7 @@ None
\hline
\end{longtable}
\label{table-label}
+
\begin{figure}
\phantomsection\label{figure-label}
\noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}