aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index f0bb92002..fed021323 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -95,21 +95,14 @@ latexHeader options (Meta title authors date) = do
stringToLaTeX :: String -> String
stringToLaTeX = escapeStringUsing latexEscapes
- where latexEscapes = [
- ('\\', "\\textbackslash{}"),
- ('{', "\\{"),
- ('}', "\\}"),
- ('$', "\\$"),
- ('%', "\\%"),
- ('&', "\\&"),
- ('~', "\\~"),
- ('_', "\\_"),
- ('#', "\\#"),
- ('^', "\\^{}"),
- ('|', "\\textbar{}"),
- ('<', "\\textless{}"),
- ('>', "\\textgreater{}")
- ]
+ where latexEscapes = backslashEscapes "{}$%&_#" ++
+ [ ('^', "\\^{}")
+ , ('\\', "\\textbackslash{}")
+ , ('~', "\\ensuremath{\\sim}")
+ , ('|', "\\textbar{}")
+ , ('<', "\\textless{}")
+ , ('>', "\\textgreater{}")
+ ]
-- | Remove all code elements from list of inline elements
-- (because it's illegal to have a \\verb inside a command argument)