diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-02 12:13:20 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-02 12:13:20 +0100 |
commit | 46135ac8758c4fbb9dfe676b1462463f5476bbff (patch) | |
tree | 3d45f5fe166882fad665b3d988e67ab8997e81dc /src/Text/Pandoc | |
parent | 8709b7cf80498d06863ac987a6b3968b84a7fc85 (diff) | |
download | pandoc-46135ac8758c4fbb9dfe676b1462463f5476bbff.tar.gz |
LaTeX writer: add `\leavevmode` before hypertarget at start of paragraph.
Closes #2704 (formatting problems in beamer citations).
See
http://tex.stackexchange.com/questions/22852/function-and-usage-of-leavevmode
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index e54829f94..11cd0479d 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -418,7 +418,14 @@ blockToLaTeX :: PandocMonad m blockToLaTeX Null = return empty blockToLaTeX (Div (identifier,classes,kvs) bs) = do beamer <- gets stBeamer - linkAnchor <- hypertarget True identifier empty + linkAnchor' <- hypertarget True identifier empty + -- see #2704 for the motivation for adding \leavevmode: + let linkAnchor = + case bs of + Para _ : _ + | not (isEmpty linkAnchor') + -> "\\leavevmode" <> linkAnchor' <> "%" + _ -> linkAnchor' let align dir txt = inCmd "begin" dir $$ txt $$ inCmd "end" dir let wrapDir = case lookup "dir" kvs of Just "rtl" -> align "RTL" |