git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: support figures with captions.
da117c9fiddlosopher
src/Text/Pandoc/Writers/LaTeX.hs+5
@@ -130,6 +130,11 @@ blockToLaTeX (Plain lst) = do
130 st <- get
130 st <- get
131 let opts = stOptions st
131 let opts = stOptions st
132 wrapTeXIfNeeded opts True inlineListToLaTeX lst
132 wrapTeXIfNeeded opts True inlineListToLaTeX lst
133+blockToLaTeX (Para [Image txt (src,tit)]) = do
134+ capt <- inlineListToLaTeX txt
135+ img <- inlineToLaTeX (Image txt (src,tit))
136+ return $ text "\\begin{figure}[htb]" $$ text "\\centering" $$ img $$
137+ (text "\\caption{" <> capt <> char '}') $$ text "\\end{figure}\n"
133blockToLaTeX (Para lst) = do
138blockToLaTeX (Para lst) = do
134 st <- get
139 st <- get
135 let opts = stOptions st
140 let opts = stOptions st
tests/writer.latex+4
@@ -809,7 +809,11 @@ or here: <http://example.com/>
809
809
810From ``Voyage dans la Lune'' by Georges Melies (1902):
810From ``Voyage dans la Lune'' by Georges Melies (1902):
811
811
812+\begin{figure}[htb]
813+\centering
812\includegraphics{lalune.jpg}
814\includegraphics{lalune.jpg}
815+\caption{lalune}
816+\end{figure}
813
817
814Here is a movie \includegraphics{movie.jpg} icon.
818Here is a movie \includegraphics{movie.jpg} icon.
815
819