aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-20 10:24:30 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-20 10:24:30 -0700
commit12efffa85a257dbe81137f97334b2c6a7e072777 (patch)
tree5171724689341d504622ccfbc8cff2ea417111a6 /src
parent1a2a0a3a856cc8cba9be2b565787ea08585da7f1 (diff)
downloadpandoc-12efffa85a257dbe81137f97334b2c6a7e072777.tar.gz
LaTeX writer: Fixed strikeout + highlighted code. Closes #1294.
Previously strikeout highlighted code caused an error.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index c221b318e..ed735242f 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -678,7 +678,9 @@ inlineToLaTeX (Emph lst) =
inlineToLaTeX (Strong lst) =
inlineListToLaTeX lst >>= return . inCmd "textbf"
inlineToLaTeX (Strikeout lst) = do
- contents <- inlineListToLaTeX lst
+ -- we need to protect VERB in an mbox or we get an error
+ -- see #1294
+ contents <- inlineListToLaTeX $ protectCode lst
modify $ \s -> s{ stStrikeout = True }
return $ inCmd "sout" contents
inlineToLaTeX (Superscript lst) =
@@ -784,6 +786,13 @@ inlineToLaTeX (Note contents) = do
-- note: a \n before } needed when note ends with a Verbatim environment
else "\\footnote" <> braces noteContents
+protectCode :: [Inline] -> [Inline]
+protectCode [] = []
+protectCode (x@(Code ("",[],[]) _) : xs) = x : protectCode xs
+protectCode (x@(Code _ _) : xs) = ltx "\\mbox{" : x : ltx "}" : xs
+ where ltx = RawInline (Format "latex")
+protectCode (x : xs) = x : protectCode xs
+
citationsToNatbib :: [Citation] -> State WriterState Doc
citationsToNatbib (one:[])
= citeCommand c p s k