LaTeX writer: use \(..\) instead of $..$ for inline math.

Closes #1464.
This commit is contained in:
John MacFarlane 2014-07-29 20:45:49 -07:00
parent 8d4eebaff4
commit 8c2ed54e2e
3 changed files with 8 additions and 8 deletions

View file

@ -742,7 +742,7 @@ inlineToLaTeX (Quoted qt lst) = do
else char '\x2018' <> inner <> char '\x2019'
inlineToLaTeX (Str str) = liftM text $ stringToLaTeX TextString str
inlineToLaTeX (Math InlineMath str) =
return $ char '$' <> text str <> char '$'
return $ "\\(" <> text str <> "\\)"
inlineToLaTeX (Math DisplayMath str) =
return $ "\\[" <> text str <> "\\]"
inlineToLaTeX (RawInline f str)

View file

@ -46,7 +46,7 @@ tests = [ testGroup "code blocks"
]
, testGroup "math"
[ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
"$\\sigma|_{\\{x\\}}$"
"\\(\\sigma|_{\\{x\\}}\\)"
]
, testGroup "headers"
[ "unnumbered header" =:

View file

@ -709,20 +709,20 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\item
\cite[22-23]{smith.1899}
\item
$2+2=4$
\(2+2=4\)
\item
$x \in y$
\(x \in y\)
\item
$\alpha \wedge \omega$
\(\alpha \wedge \omega\)
\item
$223$
\(223\)
\item
$p$-Tree
\(p\)-Tree
\item
Here's some display math:
\[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]
\item
Here's one that has a line break in it: $\alpha + \omega \times x^2$.
Here's one that has a line break in it: \(\alpha + \omega \times x^2\).
\end{itemize}
These shouldn't be math: