git.iko.soy/typeable/pandoc
on master help sign in
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.

commitbb6897a13ed8ec9fd2d15930bd013bc7b315120e authorJohn MacFarlane <jgm@berkeley.edu> dateThu 24 Mar 2016, 09:41 (11 years ago) parentbe2693b
1 file changed+3−3
src/Text/Pandoc/Writers/LaTeX.hs+3−3
src/Text/Pandoc/Writers/LaTeX.hs+3−3
@@ -415,10 +415,10 @@ blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = d
415415 else brackets <$> inlineListToLaTeX (walk deNote txt)
416416 img <- inlineToLaTeX (Image attr txt (src,tit))
417417 let footnotes = notesToLaTeX notes
418− figure <- refLabel ident $ cr <>
418+ caption <- refLabel ident ("\\caption" <> captForLof <> braces capt)
419+ let figure = cr <>
419420 "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
420− ("\\caption" <> captForLof <> braces capt) $$
421− "\\end{figure}" <> cr
421+ caption $$ "\\end{figure}" <> cr
422422 return $ if inNote
423423 -- can't have figures in notes
424424 then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"