aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/LaTeX.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-06-10 15:02:48 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-06-10 15:02:48 -0700
commit3febd81cbcadf7d36fd4686a5d323b31c44adf3a (patch)
tree21c5f5dc94417fafefbcbb31e633f4d29037f800 /src/Text/Pandoc/Writers/LaTeX.hs
parent59529e408b87274fb8e0375fa198a6636cb67a11 (diff)
downloadpandoc-3febd81cbcadf7d36fd4686a5d323b31c44adf3a.tar.gz
LaTeX writer: Use mbox to get proper behavior inside `\sout`.
Closes #5529.
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX.hs')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 467ef304a..9933c6d36 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -1131,7 +1131,9 @@ inlineToLaTeX (Strong lst) =
inlineToLaTeX (Strikeout lst) = do
-- we need to protect VERB in an mbox or we get an error
-- see #1294
- contents <- inlineListToLaTeX $ protectCode lst
+ -- with regular texttt we don't get an error, but we get
+ -- incorrect results if there is a space, see #5529
+ contents <- inlineListToLaTeX $ walk (concatMap protectCode) lst
modify $ \s -> s{ stStrikeout = True }
return $ inCmd "sout" contents
inlineToLaTeX (Superscript lst) =
@@ -1336,12 +1338,10 @@ handleMathComment s =
'%':_ -> s ++ "\n"
_ -> s
-protectCode :: [Inline] -> [Inline]
-protectCode [] = []
-protectCode (x@(Code ("",[],[]) _) : xs) = x : protectCode xs
-protectCode (x@(Code _ _) : xs) = ltx "\\mbox{" : x : ltx "}" : xs
+protectCode :: Inline -> [Inline]
+protectCode x@(Code _ _) = [ltx "\\mbox{" , x , ltx "}"]
where ltx = RawInline (Format "latex")
-protectCode (x : xs) = x : protectCode xs
+protectCode x = [x]
setEmptyLine :: PandocMonad m => Bool -> LW m ()
setEmptyLine b = modify $ \st -> st{ stEmptyLine = b }