diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-06-26 20:54:31 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-06-26 20:54:31 -0700 |
commit | 79a4ea03e2d0a252fd24af3444cf5b64ee724100 (patch) | |
tree | 411653ba962b8fb20aafda2d34791692d286436b | |
parent | f939dbdcc5648e9beb24fa1ebf55fcefb6bfc272 (diff) | |
download | pandoc-79a4ea03e2d0a252fd24af3444cf5b64ee724100.tar.gz |
Stop escaping `|` in LaTeX math.
This caused problems with array environments. Closes #891.
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 11 | ||||
-rw-r--r-- | tests/Tests/Writers/LaTeX.hs | 2 | ||||
-rw-r--r-- | tests/lhs-test.latex | 2 |
3 files changed, 4 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 89cf9812a..a99c8968c 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -212,13 +212,6 @@ stringToLaTeX isUrl (x:xs) = do '\x2013' | ligatures -> "--" ++ rest _ -> x : rest --- This is needed because | in math mode interacts badly with --- highlighting-kate, which redefines | as a short verb command. -escapeMath :: String -> String -escapeMath ('|':xs) = "\\vert " ++ escapeMath xs -escapeMath (x:xs) = x : escapeMath xs -escapeMath [] = "" - -- | Puts contents into LaTeX command. inCmd :: String -> Doc -> Doc inCmd cmd contents = char '\\' <> text cmd <> braces contents @@ -622,9 +615,9 @@ inlineToLaTeX (Quoted qt lst) = do else char '\x2018' <> inner <> char '\x2019' inlineToLaTeX (Str str) = liftM text $ stringToLaTeX False str inlineToLaTeX (Math InlineMath str) = - return $ char '$' <> text (escapeMath str) <> char '$' + return $ char '$' <> text str <> char '$' inlineToLaTeX (Math DisplayMath str) = - return $ "\\[" <> text (escapeMath str) <> "\\]" + return $ "\\[" <> text str <> "\\]" inlineToLaTeX (RawInline "latex" str) = return $ text str inlineToLaTeX (RawInline "tex" str) = return $ text str inlineToLaTeX (RawInline _ _) = return empty diff --git a/tests/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs index 944d6c138..b1427d91f 100644 --- a/tests/Tests/Writers/LaTeX.hs +++ b/tests/Tests/Writers/LaTeX.hs @@ -34,6 +34,6 @@ tests = [ testGroup "code blocks" ] , testGroup "math" [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?> - "$\\sigma\\vert _{\\{x\\}}$" + "$\\sigma|_{\\{x\\}}$" ] ] diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex index 038e0b29b..3028063fe 100644 --- a/tests/lhs-test.latex +++ b/tests/lhs-test.latex @@ -23,7 +23,7 @@ \usepackage{color} \usepackage{fancyvrb} \newcommand{\VerbBar}{|} -\DefineShortVerb[commandchars=\\\{\}]{\|} +\newcommand{\VERB}{\Verb[commandchars=\\\{\}]} \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} % Add ',fontsize=\small' for more characters per line \newenvironment{Shaded}{}{} |