git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: adjust hypertargets to beginnings of paragraphs.

Use `\vadjust pre` so that the hypertarget takes you to the beginning of the paragraph rather than one line down. Closes #7078. This makes a particular difference for links to citations using `--citeproc` and `link-citations: true`.

commit53cf8295a4825297f78e20b6ce73d2da8fd7ef84 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 18 Feb 2021, 14:33 (6 years ago) parent9e728b4
1 file changed+3−2
src/Text/Pandoc/Writers/LaTeX.hs+3−2
src/Text/Pandoc/Writers/LaTeX.hs+3−2
@@ -500,12 +500,13 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
500500 else blockListToLaTeX bs
501501 modify $ \st -> st{ stIncremental = oldIncremental }
502502 linkAnchor' <- hypertarget True identifier empty
503− -- see #2704 for the motivation for adding \leavevmode:
503+ -- see #2704 for the motivation for adding \leavevmode
504+ -- and #7078 for \vadjust pre
504505 let linkAnchor =
505506 case bs of
506507 Para _ : _
507508 | not (isEmpty linkAnchor')
508− -> "\\leavevmode" <> linkAnchor' <> "%"
509+ -> "\\leavevmode\\vadjust pre{" <> linkAnchor' <> "}%"
509510 _ -> linkAnchor'
510511 wrapNotes txt = if beamer && "notes" `elem` classes
511512 then "\\note" <> braces txt -- speaker notes