From b8e1e53053b440695c078c4c49428985b5f9ee65 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 22 Jul 2007 18:24:34 +0000 Subject: Cleaned up character escaping in LaTeX writer. git-svn-id: https://pandoc.googlecode.com/svn/trunk@763 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/LaTeX.hs | 23 ++++++++--------------- 1 file 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) -- cgit v1.2.3