git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Don't use figure inside table cell.

Closes #3836.

commit3504915e63c68c3a4e91b8dcccb90c93435cf212 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 6 Aug 2017, 22:31 (9 years ago) parent1b5bfce
1 file changed+4−2
src/Text/Pandoc/Writers/LaTeX.hs+4−2
src/Text/Pandoc/Writers/LaTeX.hs+4−2
@@ -474,6 +474,7 @@ blockToLaTeX (Plain lst) =
474474-- title beginning with fig: indicates that the image is a figure
475475blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = do
476476 inNote <- gets stInNote
477+ inMinipage <- gets stInMinipage
477478 modify $ \st -> st{ stInMinipage = True, stNotes = [] }
478479 capt <- inlineListToLaTeX txt
479480 notes <- gets stNotes
@@ -490,8 +491,9 @@ blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = d
490491 let figure = cr <> "\\begin{figure}" $$ "\\centering" $$ img $$
491492 caption $$ "\\end{figure}" <> cr
492493 figure' <- hypertarget True ident figure
493− return $ if inNote
494− -- can't have figures in notes
494+ return $ if inNote || inMinipage
495+ -- can't have figures in notes or minipage (here, table cell)
496+ -- http://www.tex.ac.uk/FAQ-ouparmd.html
495497 then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
496498 else figure' $$ footnotes
497499-- . . . indicates pause in beamer slides