From bb6897a13ed8ec9fd2d15930bd013bc7b315120e Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 24 Mar 2016 09:41:45 -0700
Subject: LaTeX writer: Fixed position of label in figures.

Partially addresses #2813.

This isn't perfect, because now the hypertarget is in the
wrong place -- when you link to the figure, the screen
is positioned with the caption at the top, and most of
the figure off screen.

So this needs a bit more tweaking.
---
 src/Text/Pandoc/Writers/LaTeX.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 0f47132b3..a63aca1c5 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -415,10 +415,10 @@ blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = d
                    else brackets <$> inlineListToLaTeX (walk deNote txt)
   img <- inlineToLaTeX (Image attr txt (src,tit))
   let footnotes = notesToLaTeX notes
-  figure <- refLabel ident $ cr <>
+  caption <- refLabel ident ("\\caption" <> captForLof <> braces capt)
+  let figure = cr <>
             "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
-            ("\\caption" <> captForLof <> braces capt) $$
-            "\\end{figure}" <> cr
+            caption $$ "\\end{figure}" <> cr
   return $ if inNote
               -- can't have figures in notes
               then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
-- 
cgit v1.2.3