@@ -394,18 +394,23 @@ blockToLaTeX (Plain lst) =
394394-- title beginning with fig: indicates that the image is a figure
395395blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
396396 inNote <- gets stInNote
397+ modify $ \st -> st{ stInMinipage = True, stNotes = [] }
397398 capt <- inlineListToLaTeX txt
399+ notes <- gets stNotes
400+ modify $ \st -> st{ stInMinipage = False, stNotes = [] }
398401 -- We can't have footnotes in the list of figures, so remove them:
399− captForLof <- if null (query queryNote txt)
402+ captForLof <- if null notes
400403 then return empty
401404 else brackets <$> inlineListToLaTeX (walk deNote txt)
402405 img <- inlineToLaTeX (Image txt (src,tit))
406+ let footnotes = notesToLaTeX notes
403407 return $ if inNote
404408 -- can't have figures in notes
405409 then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
406410 else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
407411 ("\\caption" <> captForLof <> braces capt) $$
408− "\\end{figure}"
412+ "\\end{figure}" $$
413+ footnotes
409414-- . . . indicates pause in beamer slides
410415blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
411416 beamer <- writerBeamer `fmap` gets stOptions
@@ -647,19 +652,21 @@ tableCellToLaTeX header (width, align, blocks) = do
647652 return $ ("\\begin{minipage}" <> valign <>
648653 braces (text (printf "%.2f\\columnwidth" width)) <>
649654 (halign <> "\\strut" <> cr <> cellContents <> cr) <>
650− "\\strut\\end{minipage}")
651− $$ case notes of
652− [] -> empty
653− ns -> (case length ns of
655+ "\\strut\\end{minipage}") $$
656+ notesToLaTeX notes
657+
658+notesToLaTeX :: [Doc] -> Doc
659+notesToLaTeX [] = empty
660+notesToLaTeX ns = (case length ns of
654661 n | n > 1 -> "\\addtocounter" <>
655662 braces "footnote" <>
656663 braces (text $ show $ 1 - n)
657664 | otherwise -> empty)
658− $$
659− vcat (intersperse
660− ("\\addtocounter" <> braces "footnote" <> braces "1")
661− $ map (\x -> "\\footnotetext" <> braces x)
662− $ reverse ns)
665+ $$
666+ vcat (intersperse
667+ ("\\addtocounter" <> braces "footnote" <> braces "1")
668+ $ map (\x -> "\\footnotetext" <> braces x)
669+ $ reverse ns)
663670
664671listItemToLaTeX :: [Block] -> State WriterState Doc
665672listItemToLaTeX lst
@@ -1208,10 +1215,6 @@ commonFromBcp47 x = fromIso $ head x
12081215 fromIso "vi" = "vietnamese"
12091216 fromIso _ = ""
12101217
1211−queryNote :: Inline -> [Inline]
1212−queryNote (Note xs) = [Note xs]
1213−queryNote _ = []
1214−
12151218deNote :: Inline -> Inline
12161219deNote (Note _) = RawInline (Format "latex") ""
12171220deNote x = x