Man writer: convert math to unicode when possible.

(As in other writers.)
This commit is contained in:
John MacFarlane 2010-04-26 23:04:29 -07:00
parent c243e5b67b
commit 4aaa1991fd
2 changed files with 10 additions and 10 deletions

View file

@ -32,6 +32,7 @@ module Text.Pandoc.Writers.Man ( writeMan) where
import Text.Pandoc.Definition
import Text.Pandoc.Templates
import Text.Pandoc.Shared
import Text.Pandoc.Readers.TeXMath
import Text.Printf ( printf )
import Data.List ( isPrefixOf, intersperse, intercalate )
import Text.PrettyPrint.HughesPJ hiding ( Str )
@ -301,9 +302,9 @@ inlineToMan _ Ellipses = return $ text "\\&..."
inlineToMan _ (Code str) =
return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"
inlineToMan _ (Str str) = return $ text $ escapeString str
inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str)
inlineToMan opts (Math InlineMath str) = inlineListToMan opts $ readTeXMath str
inlineToMan opts (Math DisplayMath str) = do
contents <- inlineToMan opts (Code str)
contents <- inlineListToMan opts $ readTeXMath str
return $ text ".RS" $$ contents $$ text ".RE"
inlineToMan _ (TeX _) = return empty
inlineToMan _ (HtmlInline _) = return empty

View file

@ -544,23 +544,22 @@ Ellipses\&...and\&...and\&....
.SH LaTeX
.IP \[bu] 2
.IP \[bu] 2
\f[B]2+2=4\f[]
2+2=4
.IP \[bu] 2
\f[B]x\ \\in\ y\f[]
\f[I]x\f[] ∈ \f[I]y\f[]
.IP \[bu] 2
\f[B]\\alpha\ \\wedge\ \\omega\f[]
α ∧ ω
.IP \[bu] 2
\f[B]223\f[]
223
.IP \[bu] 2
\f[B]p\f[]-Tree
\f[I]p\f[]-Tree
.IP \[bu] 2
Here's some display math:
.RS
\f[B]\\frac{d}{dx}f(x)=\\lim_{h\\to\ 0}\\frac{f(x+h)-f(x)}{h}\f[]
$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$
.RE
.IP \[bu] 2
Here's one that has a line break in it:
\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[].
Here's one that has a line break in it: α+ ω × \f[I]x\f[]^2^.
.PP
These shouldn't be math:
.IP \[bu] 2