git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: use \(..\) instead of $..$ for inline math.
8c2ed54John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -742,7 +742,7 @@ inlineToLaTeX (Quoted qt lst) = do
742 else char '\x2018' <> inner <> char '\x2019'
742 else char '\x2018' <> inner <> char '\x2019'
743inlineToLaTeX (Str str) = liftM text $ stringToLaTeX TextString str
743inlineToLaTeX (Str str) = liftM text $ stringToLaTeX TextString str
744inlineToLaTeX (Math InlineMath str) =
744inlineToLaTeX (Math InlineMath str) =
745− return $ char '$' <> text str <> char '$'
745+ return $ "\\(" <> text str <> "\\)"
746inlineToLaTeX (Math DisplayMath str) =
746inlineToLaTeX (Math DisplayMath str) =
747 return $ "\\[" <> text str <> "\\]"
747 return $ "\\[" <> text str <> "\\]"
748inlineToLaTeX (RawInline f str)
748inlineToLaTeX (RawInline f str)
tests/Tests/Writers/LaTeX.hs+1−1
@@ -46,7 +46,7 @@ tests = [ testGroup "code blocks"
46 ]
46 ]
47 , testGroup "math"
47 , testGroup "math"
48 [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
48 [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
49− "$\\sigma|_{\\{x\\}}$"
49+ "\\(\\sigma|_{\\{x\\}}\\)"
50 ]
50 ]
51 , testGroup "headers"
51 , testGroup "headers"
52 [ "unnumbered header" =:
52 [ "unnumbered header" =:
tests/writer.latex+6−6
@@ -709,20 +709,20 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
709\item
709\item
710 \cite[22-23]{smith.1899}
710 \cite[22-23]{smith.1899}
711\item
711\item
712− $2+2=4$
712+ \(2+2=4\)
713\item
713\item
714− $x \in y$
714+ \(x \in y\)
715\item
715\item
716− $\alpha \wedge \omega$
716+ \(\alpha \wedge \omega\)
717\item
717\item
718− $223$
718+ \(223\)
719\item
719\item
720− $p$-Tree
720+ \(p\)-Tree
721\item
721\item
722 Here's some display math:
722 Here's some display math:
723 \[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]
723 \[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]
724\item
724\item
725− Here's one that has a line break in it: $\alpha + \omega \times x^2$.
725+ Here's one that has a line break in it: \(\alpha + \omega \times x^2\).
726\end{itemize}
726\end{itemize}
727
727
728These shouldn't be math:
728These shouldn't be math: