diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 11:26:38 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 11:26:38 -0700 |
commit | d81b4358ea8d0da615c01a468196fd0592934af6 (patch) | |
tree | b0a06ba94a55f4d3b5ece52a0bca0c44d679dbfd | |
parent | 56c410ef6a3b7c3dd4054b18ea667cb4ab5a5ee0 (diff) | |
download | pandoc-d81b4358ea8d0da615c01a468196fd0592934af6.tar.gz |
LaTeX writer: Correctly handle figures in notes.
Notes can't contain figures in LaTeX, so we fake it to avoid
an error. Closes #1053.
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index ed735242f..f2f7438c4 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -311,12 +311,14 @@ blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst -- title beginning with fig: indicates that the image is a figure blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do - capt <- if null txt - then return empty - else (\c -> "\\caption" <> braces c) `fmap` inlineListToLaTeX txt + inNote <- gets stInNote + capt <- inlineListToLaTeX txt img <- inlineToLaTeX (Image txt (src,tit)) - return $ "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$ - capt $$ "\\end{figure}" + return $ if inNote + -- can't have figures in notes + then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}" + else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$ + ("\\caption" <> braces capt) $$ "\\end{figure}" -- . . . indicates pause in beamer slides blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do beamer <- writerBeamer `fmap` gets stOptions |