git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Correctly handle figures in notes.
d81b435John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+7−5
@@ -311,12 +311,14 @@ blockToLaTeX (Plain lst) =
311 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
311 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
312-- title beginning with fig: indicates that the image is a figure
312-- title beginning with fig: indicates that the image is a figure
313blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
313blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
314− capt <- if null txt
314+ inNote <- gets stInNote
315− then return empty
316− else (\c -> "\\caption" <> braces c) `fmap` inlineListToLaTeX txt
315+ capt <- inlineListToLaTeX txt
317 img <- inlineToLaTeX (Image txt (src,tit))
316 img <- inlineToLaTeX (Image txt (src,tit))
317+ return $ if inNote
318+ -- can't have figures in notes
319+ then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
318− return $ "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
320+ else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
319− capt $$ "\\end{figure}"
321+ ("\\caption" <> braces capt) $$ "\\end{figure}"
320-- . . . indicates pause in beamer slides
322-- . . . indicates pause in beamer slides
321blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
323blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
322 beamer <- writerBeamer `fmap` gets stOptions
324 beamer <- writerBeamer `fmap` gets stOptions