@@ -54,6 +54,7 @@ data WriterState =
54 , stInQuote :: Bool -- true if in a blockquote
54 , stInQuote :: Bool -- true if in a blockquote
55 , stExternalNotes :: Bool -- true if in context where
55 , stExternalNotes :: Bool -- true if in context where
56 -- we need to store footnotes
56 -- we need to store footnotes
57+ , stInMinipage :: Bool -- true if in minipage
57 , stInHeading :: Bool -- true if in a section heading
58 , stInHeading :: Bool -- true if in a section heading
58 , stInItem :: Bool -- true if in \item[..]
59 , stInItem :: Bool -- true if in \item[..]
59 , stNotes :: [Doc] -- notes in a minipage
60 , stNotes :: [Doc] -- notes in a minipage
@@ -80,6 +81,7 @@ startingState options = WriterState {
80 , stInQuote = False
81 , stInQuote = False
81 , stExternalNotes = False
82 , stExternalNotes = False
82 , stInHeading = False
83 , stInHeading = False
84+ , stInMinipage = False
83 , stInItem = False
85 , stInItem = False
84 , stNotes = []
86 , stNotes = []
85 , stOLLevel = 1
87 , stOLLevel = 1
@@ -608,11 +610,12 @@ blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = d
608 "\\centering" $$ img $$ caption <> cr
610 "\\centering" $$ img $$ caption <> cr
609 let figure = cr <> "\\begin{figure}" $$ innards $$ "\\end{figure}"
611 let figure = cr <> "\\begin{figure}" $$ innards $$ "\\end{figure}"
610 st <- get
612 st <- get
611− return $ if stExternalNotes st
613+ return $ (if stInMinipage st
612− -- can't have figures in notes or minipage (here, table cell)
614+ -- can't have figures in notes or minipage (here, table cell)
613− -- http://www.tex.ac.uk/FAQ-ouparmd.html
615+ -- http://www.tex.ac.uk/FAQ-ouparmd.html
614− then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
616+ then cr <> "\\begin{center}" $$ img $+$ capt $$
615− else figure $$ footnotes
618+ else figure) $$ footnotes
616-- . . . indicates pause in beamer slides
619-- . . . indicates pause in beamer slides
617blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
620blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
618 beamer <- gets stBeamer
621 beamer <- gets stBeamer
@@ -833,6 +836,9 @@ getCaption externalNotes txt = do
833 oldExternalNotes <- gets stExternalNotes
836 oldExternalNotes <- gets stExternalNotes
834 modify $ \st -> st{ stExternalNotes = externalNotes, stNotes = [] }
837 modify $ \st -> st{ stExternalNotes = externalNotes, stNotes = [] }
835 capt <- inlineListToLaTeX txt
838 capt <- inlineListToLaTeX txt
839+ footnotes <- if externalNotes
840+ then notesToLaTeX <$> gets stNotes
836 modify $ \st -> st{ stExternalNotes = oldExternalNotes, stNotes = [] }
842 modify $ \st -> st{ stExternalNotes = oldExternalNotes, stNotes = [] }
837 -- We can't have footnotes in the list of figures/tables, so remove them:
843 -- We can't have footnotes in the list of figures/tables, so remove them:
838 let getNote (Note _) = Any True
844 let getNote (Note _) = Any True
@@ -841,9 +847,6 @@ getCaption externalNotes txt = do
841 captForLof <- if hasNotes txt
847 captForLof <- if hasNotes txt
842 then brackets <$> inlineListToLaTeX (walk deNote txt)
848 then brackets <$> inlineListToLaTeX (walk deNote txt)
843 else return empty
849 else return empty
844− footnotes <- if externalNotes
845− then notesToLaTeX <$> gets stNotes
847 return (capt, captForLof, footnotes)
850 return (capt, captForLof, footnotes)
849toColDescriptor :: Alignment -> String
852toColDescriptor :: Alignment -> String
@@ -911,11 +914,14 @@ tableCellToLaTeX _ (0, _, blocks) =
911tableCellToLaTeX header (width, align, blocks) = do
914tableCellToLaTeX header (width, align, blocks) = do
912 beamer <- gets stBeamer
915 beamer <- gets stBeamer
913 externalNotes <- gets stExternalNotes
916 externalNotes <- gets stExternalNotes
917+ inMinipage <- gets stInMinipage
914 -- See #5367 -- footnotehyper/footnote don't work in beamer,
918 -- See #5367 -- footnotehyper/footnote don't work in beamer,
915 -- so we need to produce the notes outside the table...
919 -- so we need to produce the notes outside the table...
916− modify $ \st -> st{ stExternalNotes = beamer }
920+ modify $ \st -> st{ stExternalNotes = beamer,
921+ stInMinipage = True }
917 cellContents <- blockListToLaTeX blocks
922 cellContents <- blockListToLaTeX blocks
918− modify $ \st -> st{ stExternalNotes = externalNotes }
923+ modify $ \st -> st{ stExternalNotes = externalNotes,
924+ stInMinipage = inMinipage }
919 let valign = text $ if header then "[b]" else "[t]"
925 let valign = text $ if header then "[b]" else "[t]"
920 let halign = case align of
926 let halign = case align of
921 AlignLeft -> "\\raggedright"
927 AlignLeft -> "\\raggedright"