From ab75e1d3bdf830875b02602055cbff29ba63e1fb Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 12 Aug 2014 10:56:57 -0700
Subject: [PATCH] Beamer:  Use \footnote<.->{..} for notes.

This ensures that the footnotes will not appear before the
overlays in which their corresponding note markers appear.

Closes #1525.
---
 src/Text/Pandoc/Writers/LaTeX.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 3ed20ae87..5e4966abb 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -793,12 +793,17 @@ inlineToLaTeX (Note contents) = do
                    (CodeBlock _ _ : _) -> cr
                    _                   -> empty
   let noteContents = nest 2 contents' <> optnl
+  opts <- gets stOptions
+  -- in beamer slides, display footnote from current overlay forward
+  let beamerMark = if writerBeamer opts
+                      then text "<.->"
+                      else empty
   modify $ \st -> st{ stNotes = noteContents : stNotes st }
   return $
     if inMinipage
        then "\\footnotemark{}"
        -- note: a \n before } needed when note ends with a Verbatim environment
-       else "\\footnote" <> braces noteContents
+       else "\\footnote" <> beamerMark <> braces noteContents
 
 protectCode :: [Inline] -> [Inline]
 protectCode [] = []