From cb1a8da01c5ff98d8e2bc64efb1c401c1cf0dc82 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 1 Sep 2014 10:11:09 -0700 Subject: LaTeX writer: Avoid using reserved characters as \lstinline delimiters. Closes #1595. --- src/Text/Pandoc/Writers/LaTeX.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 8e3befe19..3596b75e9 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -731,7 +731,9 @@ inlineToLaTeX (Code (_,classes,_) str) = do where listingsCode = do inNote <- gets stInNote when inNote $ modify $ \s -> s{ stVerbInNote = True } - let chr = ((enumFromTo '!' '~') \\ str) !! 0 + let chr = case "!\"&'()*,-./:;?@_" \\ str of + (c:_) -> c + [] -> '!' return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr] highlightCode = do case highlight formatLaTeXInline ("",classes,[]) str of -- cgit v1.2.3