Skip to content

Commit

Permalink
LaTeX writer: fix math inside strikeout (closes #9597).
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Mar 22, 2024
1 parent a70399d commit b28dc15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Text/Pandoc/Writers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
6 changes: 6 additions & 0 deletions test/command/9597.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```
% pandoc -t latex
~~$T$~~
^D
\st{$T$}
```

0 comments on commit b28dc15

Please sign in to comment.