aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-16 04:06:33 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-16 04:06:33 +0000
commitda117c9d68fb2169b43dda6131bfa35856113347 (patch)
treeca89ba7a2803aa3d3c00a1d5cf605b3f4ac5ef56
parentcb31c89eab45319348b5d8d79dbec5acef8a945b (diff)
downloadpandoc-da117c9d68fb2169b43dda6131bfa35856113347.tar.gz
LaTeX writer: support figures with captions.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1892 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs5
-rw-r--r--tests/writer.latex4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 3362c1d25..02fbf4add 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -130,6 +130,11 @@ blockToLaTeX (Plain lst) = do
st <- get
let opts = stOptions st
wrapTeXIfNeeded opts True inlineListToLaTeX lst
+blockToLaTeX (Para [Image txt (src,tit)]) = do
+ capt <- inlineListToLaTeX txt
+ img <- inlineToLaTeX (Image txt (src,tit))
+ return $ text "\\begin{figure}[htb]" $$ text "\\centering" $$ img $$
+ (text "\\caption{" <> capt <> char '}') $$ text "\\end{figure}\n"
blockToLaTeX (Para lst) = do
st <- get
let opts = stOptions st
diff --git a/tests/writer.latex b/tests/writer.latex
index a23625252..dbefdb8fd 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -809,7 +809,11 @@ or here: <http://example.com/>
From ``Voyage dans la Lune'' by Georges Melies (1902):
+\begin{figure}[htb]
+\centering
\includegraphics{lalune.jpg}
+\caption{lalune}
+\end{figure}
Here is a movie \includegraphics{movie.jpg} icon.