From b28dc15817e6e4b56cd1f12c6883bbb5b964afad Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 22 Mar 2024 08:50:20 -0700 Subject: LaTeX writer: fix math inside strikeout (closes #9597). --- src/Text/Pandoc/Writers/LaTeX.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 2c3404310..33fa15f1b 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -868,7 +868,10 @@ inlineToLaTeX (Strikeout lst) = do -- incorrect results if there is a space, see #5529 contents <- inlineListToLaTeX $ walk (concatMap protectCode) lst modify $ \s -> s{ stStrikeout = True } - return $ inCmd "st" contents + -- soul doesn't like \(..\) delimiters, so we change these to $ (#9597): + let fixMath = T.replace "\\(" "$" . T.replace "\\)" "$" . + T.replace "\\[" "$$" . T.replace "\\]" "$$" + return $ inCmd "st" $ fixMath <$> contents inlineToLaTeX (Superscript lst) = inCmd "textsuperscript" <$> inlineListToLaTeX lst inlineToLaTeX (Subscript lst) = -- cgit v1.2.3