aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-18 14:33:56 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-18 14:34:38 -0800
commit53cf8295a4825297f78e20b6ce73d2da8fd7ef84 (patch)
treed08c8e64a67289de96bd5e92c999f32c335d8287 /src/Text/Pandoc
parent9e728b40f36d48c687372ad447670186ed415337 (diff)
downloadpandoc-53cf8295a4825297f78e20b6ce73d2da8fd7ef84.tar.gz
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`.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 93603a26e..e8a187599 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -500,12 +500,13 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
else blockListToLaTeX bs
modify $ \st -> st{ stIncremental = oldIncremental }
linkAnchor' <- hypertarget True identifier empty
- -- see #2704 for the motivation for adding \leavevmode:
+ -- see #2704 for the motivation for adding \leavevmode
+ -- and #7078 for \vadjust pre
let linkAnchor =
case bs of
Para _ : _
| not (isEmpty linkAnchor')
- -> "\\leavevmode" <> linkAnchor' <> "%"
+ -> "\\leavevmode\\vadjust pre{" <> linkAnchor' <> "}%"
_ -> linkAnchor'
wrapNotes txt = if beamer && "notes" `elem` classes
then "\\note" <> braces txt -- speaker notes