aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-22 18:24:34 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-22 18:24:34 +0000
commitb8e1e53053b440695c078c4c49428985b5f9ee65 (patch)
treed1e78f8873ab0a65023ee53c213a487730562bbc /src
parentb19c36970e70cc6c5bd2f571b35d0a3474543037 (diff)
downloadpandoc-b8e1e53053b440695c078c4c49428985b5f9ee65.tar.gz
Cleaned up character escaping in LaTeX writer.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@763 788f1e2b-df1e-0410-8736-df70ead52e1b
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)