summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-02-22 13:15:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2022-02-22 13:19:16 -0800
commitaa903022842457fcbec7bc20dedf6297e5ccb86b (patch)
tree747a3ff0465582e8f1020b6c0ac6b1be53fb325b
parent1abf2bcd5fd2662dc51f88a777c66ef5388dc3be (diff)
LaTeX writer: avoid extra space before `\CSLRightInline`.
Closes #7932.
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 88718c422..b3d407d0a 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -741,12 +741,13 @@ inlineToLaTeX (Span (id',classes,kvs) ils) = do
let cmds = mapMaybe classToCmd classes ++ mapMaybe kvToCmd kvs ++ langCmds
contents <- inlineListToLaTeX ils
return $
- (case classes of
- ["csl-block"] -> (cr <>)
- ["csl-left-margin"] -> (cr <>)
- ["csl-right-inline"] -> (cr <>)
- ["csl-indent"] -> (cr <>)
- _ -> id) $
+ (if "csl-right-inline" `elem` classes
+ then ("%" <>) -- see #7932
+ else id) $
+ (if any (`elem` classes)
+ ["csl-block","csl-left-margin","csl-right-inline","csl-indent"]
+ then (cr <>)
+ else id) $
(if T.null id'
then empty
else "\\protect" <> linkAnchor) <>