git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: use \(..\) instead of $..$ for inline math.

Closes #1464.

commit8c2ed54e2e6819aee2bb4b948102fbab8f920d86 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 29 Jul 2014, 20:45 (12 years ago) parent8d4eeba
3 files changed+8−8
src/Text/Pandoc/Writers/LaTeX.hs+1−1 tests/Tests/Writers/LaTeX.hs+1−1 tests/writer.latex+6−6
src/Text/Pandoc/Writers/LaTeX.hs+1−1
@@ -742,7 +742,7 @@ inlineToLaTeX (Quoted qt lst) = do
742742 else char '\x2018' <> inner <> char '\x2019'
743743inlineToLaTeX (Str str) = liftM text $ stringToLaTeX TextString str
744744inlineToLaTeX (Math InlineMath str) =
745− return $ char '$' <> text str <> char '$'
745+ return $ "\\(" <> text str <> "\\)"
746746inlineToLaTeX (Math DisplayMath str) =
747747 return $ "\\[" <> text str <> "\\]"
748748inlineToLaTeX (RawInline f str)
tests/Tests/Writers/LaTeX.hs+1−1
@@ -46,7 +46,7 @@ tests = [ testGroup "code blocks"
4646 ]
4747 , testGroup "math"
4848 [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
49− "$\\sigma|_{\\{x\\}}$"
49+ "\\(\\sigma|_{\\{x\\}}\\)"
5050 ]
5151 , testGroup "headers"
5252 [ "unnumbered header" =:
tests/writer.latex+6−6
@@ -709,20 +709,20 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
709709\item
710710 \cite[22-23]{smith.1899}
711711\item
712− $2+2=4$
712+ \(2+2=4\)
713713\item
714− $x \in y$
714+ \(x \in y\)
715715\item
716− $\alpha \wedge \omega$
716+ \(\alpha \wedge \omega\)
717717\item
718− $223$
718+ \(223\)
719719\item
720− $p$-Tree
720+ \(p\)-Tree
721721\item
722722 Here's some display math:
723723 \[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]
724724\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\).
726726\end{itemize}
727727
728728These shouldn't be math: