Support for display math; changed ASCIIMathML -> LaTeXMathML:

Resolves Issue #47.

+ Added a DisplayMath/InlineMath selector to Math inlines.
+ Markdown parser yields DisplayMath for $$...$$.
+ LaTeX parser yields DisplayMath when appropriate.  Removed
  mathBlock parsers, since the same effect is achieved by the math
  inline parsers, now that they handle display math.
+ Writers handle DisplayMath as appropriate for the format.
+ Changed -m option to use LaTeXMathML rather than ASCIIMathML.
  LaTeXMathML is closer to LaTeX in its display of math, and
  supports many non-math LaTeX environments.
+ Modified HTML writer to print raw TeX when LaTeXMathML is
  being used instead of suppressing it.
+ Removed ASCIIMathML files from data/ and added LaTeXMathML.
+ Replaced ASCIIMathML with LaTeXMathML in source files.
+ Modified README and pandoc man page source.
+ Modified web page.
+ Added --latexmathml option (kept --asciimathml as a synonym
  for backwards compatibility)
+ Modified tests accordingly; added new tests for display math.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1409 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2008-08-13 03:02:42 +00:00
parent aeaf5e5108
commit f53fb554fe
44 changed files with 512 additions and 4217 deletions

View file

@ -249,12 +249,12 @@ options =
(\opt -> return opt { optSmart = True }))
"" -- "Use smart quotes, dashes, and ellipses"
, Option "m" ["asciimathml"]
, Option "m" ["latexmathml", "asciimathml"]
(OptArg
(\arg opt -> return opt { optHTMLMathMethod =
ASCIIMathML arg })
LaTeXMathML arg })
"URL")
"" -- "Use ASCIIMathML script in html output"
"" -- "Use LaTeXMathML script in html output"
, Option "" ["mimetex"]
(OptArg

20
README
View file

@ -310,27 +310,27 @@ For further documentation, see the `pandoc(1)` man page.
`markdown`. It is selected automatically when the output format is
`latex` or `context`.)
`-m`*[url]* or `--asciimathml`*[=url]*
: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display
TeX math in HTML or S5. If a local copy of `ASCIIMathML.js` is
`-m`*[url]* or `--latexmathml`*[=url]*
: causes `pandoc` to use the [LaTeXMathML] script to display
TeX math in HTML or S5. If a local copy of `LaTeXMathML.js` is
available on the webserver where the page will be viewed, provide a
*url* and a link will be inserted in the generated HTML or S5. If
no *url* is provided, the contents of the script will be inserted
directly; this provides portability at the price of efficiency. If
you plan to use math on several pages, it is much better to link to
a copy of `ASCIIMathML.js`, which can be cached. (See `--gladtex`
a copy of `LaTeXMathML.js`, which can be cached. (See `--gladtex`
and `--mimetex` for alternative ways of dealing with math in HTML.)
`--gladtex`*[=url]*
: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
This output can then be processed by [gladTeX] to produce links to
images with the typeset formulas. (See `--asciimathml` and
images with the typeset formulas. (See `--latexmathml` and
`--mimetex` for alternative ways of dealing with math in HTML.)
`--mimetex`*[=url]*
: causes TeX formulas to be replaced by `<img>` tags linking to the
[mimeTeX] CGI script, which will produce images with the typeset
formulas. (See `--asciimathml` and `--mimetex` for alternative
formulas. (See `--latexmathml` and `--mimetex` for alternative
ways of dealing with math in HTML.)
`-i` or `--incremental`
@ -386,7 +386,7 @@ For further documentation, see the `pandoc(1)` man page.
: prints a usage message to STDERR.
[Smartypants]: http://daringfireball.net/projects/smartypants/
[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
[mimeTeX]: http://www.forkosh.com/mimetex.html
@ -930,11 +930,11 @@ command-line options selected:
are put inside a `span` with `class="math"`, so that they may be
styled differently from the surrounding text if needed.
2. If the `--asciimathml` option is used, TeX math will be displayed
between $ characters, as in LaTeX, and the [ASCIIMathML] script will
2. If the `--latexmathml` option is used, TeX math will be displayed
between $ characters, as in LaTeX, and the [LaTeXMathML] script will
be used to render it as formulas. (This trick does not work in all
browsers, but it works in Firefox. In browsers that do not support
ASCIIMathML, TeX math will appear verbatim between $ characters.)
LaTeXMathML, TeX math will appear verbatim between $ characters.)
3. If the `--mimetex` option is used, the [mimeTeX] CGI script will
be called to generate images for each TeX formula. This should

View file

@ -1,14 +0,0 @@
{-# LANGUAGE CPP, TemplateHaskell #-}
-- | Definitions for use of ASCIIMathML in HTML.
-- (See <http://www1.chapman.edu/~jipsen/mathml/asciimath.html>.)
module Text.Pandoc.ASCIIMathML ( asciiMathMLScript ) where
import Text.Pandoc.TH ( contentsOf )
import System.FilePath ( (</>) )
-- | String containing ASCIIMathML javascript.
asciiMathMLScript :: String
#ifndef __HADDOCK__
asciiMathMLScript = "<script type=\"text/javascript\">\n" ++
$(contentsOf $ "data" </> "ASCIIMathML.js.comment") ++
$(contentsOf $ "data" </> "ASCIIMathML.js.packed") ++ "</script>\n"
#endif

View file

@ -98,6 +98,9 @@ data QuoteType = SingleQuote | DoubleQuote deriving (Show, Eq, Read, Typeable, D
-- | Link target (URL, title).
type Target = (String, String)
-- | Type of math element (display or inline).
data MathType = DisplayMath | InlineMath deriving (Show, Eq, Read, Typeable, Data)
-- | Inline elements.
data Inline
= Str String -- ^ Text (string)
@ -116,7 +119,7 @@ data Inline
| Apostrophe -- ^ Apostrophe
| Ellipses -- ^ Ellipses
| LineBreak -- ^ Hard line break
| Math String -- ^ TeX math (literal)
| Math MathType String -- ^ TeX math (literal)
| TeX String -- ^ LaTeX code (literal)
| HtmlInline String -- ^ HTML code (literal)
| Link [Inline] Target -- ^ Hyperlink: text (list of inlines), target

View file

@ -0,0 +1,14 @@
{-# LANGUAGE CPP, TemplateHaskell #-}
-- | Definitions for use of LaTeXMathML in HTML.
-- (See http://math.etsu.edu/LaTeXMathML/)
module Text.Pandoc.LaTeXMathML ( latexMathMLScript ) where
import Text.Pandoc.TH ( contentsOf )
import System.FilePath ( (</>) )
-- | String containing LaTeXMathML javascript.
latexMathMLScript :: String
#ifndef __HADDOCK__
latexMathMLScript = "<script type=\"text/javascript\">\n" ++
$(contentsOf $ "data" </> "LaTeXMathML.js.comment") ++
$(contentsOf $ "data" </> "LaTeXMathML.js.packed") ++ "</script>\n"
#endif

View file

@ -153,7 +153,6 @@ block = choice [ hrule
, header
, list
, blockQuote
, mathBlock
, comment
, bibliographic
, para
@ -218,26 +217,6 @@ blockQuote :: GenParser Char ParserState Block
blockQuote = (environment "quote" <|> environment "quotation") >>~ spaces >>=
return . BlockQuote
--
-- math block
--
mathBlock :: GenParser Char st Block
mathBlock = mathBlockWith (begin "equation") (end "equation") <|>
mathBlockWith (begin "displaymath") (end "displaymath") <|>
mathBlockWith (try $ string "\\[") (try $ string "\\]") <?>
"math block"
mathBlockWith :: GenParser Char st t
-> GenParser Char st end
-> GenParser Char st Block
mathBlockWith start end' = try $ do
start
spaces
result <- manyTill anyChar end'
spaces
return $ BlockQuote [Para [Math result]]
--
-- list blocks
--
@ -683,21 +662,31 @@ endline = try $ newline >> notFollowedBy blankline >> return Space
-- math
math :: GenParser Char st Inline
math = math1 <|> math2 <?> "math"
math = (math3 >>= return . Math DisplayMath)
<|> (math1 >>= return . Math InlineMath)
<|> (math2 >>= return . Math InlineMath)
<|> (math4 >>= return . Math DisplayMath)
<|> (math5 >>= return . Math DisplayMath)
<|> (math6 >>= return . Math DisplayMath)
<?> "math"
math1 :: GenParser Char st Inline
math1 = try $ do
char '$'
result <- many (noneOf "$")
char '$'
return $ Math result
math1 :: GenParser Char st String
math1 = try $ char '$' >> manyTill anyChar (char '$')
math2 :: GenParser Char st Inline
math2 = try $ do
string "\\("
result <- many (noneOf "$")
string "\\)"
return $ Math result
math2 :: GenParser Char st String
math2 = try $ string "\\(" >> manyTill anyChar (try $ string "\\)")
math3 :: GenParser Char st String
math3 = try $ char '$' >> math1 >>~ char '$'
math4 :: GenParser Char st String
math4 = try $ (begin "equation") >> spaces >> manyTill anyChar (end "equation")
math5 :: GenParser Char st String
math5 = try $ (begin "displaymath") >> spaces >> manyTill anyChar (end "displaymath")
math6 :: GenParser Char st String
math6 = try $ (string "\\[") >> spaces >> manyTill anyChar (try $ string "\\]")
--
-- links and images

View file

@ -870,14 +870,21 @@ mathWord = many1 ((noneOf " \t\n\\$") <|>
(try (char '\\') >>~ notFollowedBy (char '$')))
math :: GenParser Char ParserState Inline
math = try $ do
math = (mathDisplay >>= return . Math DisplayMath)
<|> (mathInline >>= return . Math InlineMath)
mathDisplay :: GenParser Char ParserState String
mathDisplay = try $ char '$' >> mathInline >>~ char '$' >>~ notFollowedBy digit
mathInline :: GenParser Char ParserState String
mathInline = try $ do
failIfStrict
char '$'
notFollowedBy space
words' <- sepBy1 mathWord (many1 (spaceChar <|> (newline >>~ notFollowedBy' blankline)))
char '$'
notFollowedBy digit
return $ Math $ joinWithSep " " words'
return $ joinWithSep " " words'
emph :: GenParser Char ParserState Inline
emph = ((enclosed (char '*') (notFollowedBy' strong >> char '*') inline) <|>

View file

@ -715,8 +715,8 @@ refsMatch ((Quoted t x):restx) ((Quoted u y):resty) =
t == u && refsMatch x y && refsMatch restx resty
refsMatch ((Code x):restx) ((Code y):resty) =
((map toLower x) == (map toLower y)) && refsMatch restx resty
refsMatch ((Math x):restx) ((Math y):resty) =
((map toLower x) == (map toLower y)) && refsMatch restx resty
refsMatch ((Math t x):restx) ((Math u y):resty) =
((map toLower x) == (map toLower y)) && t == u && refsMatch restx resty
refsMatch ((TeX x):restx) ((TeX y):resty) =
((map toLower x) == (map toLower y)) && refsMatch restx resty
refsMatch ((HtmlInline x):restx) ((HtmlInline y):resty) =
@ -876,7 +876,7 @@ isHeaderBlock _ = False
--
data HTMLMathMethod = PlainMath
| ASCIIMathML (Maybe String) -- url of ASCIIMathML.js
| LaTeXMathML (Maybe String) -- url of LaTeXMathML.js
| GladTeX
| MimeTeX String -- url of mimetex.cgi
deriving (Show, Read, Eq)

View file

@ -272,7 +272,8 @@ inlineToConTeXt EmDash = return $ text "---"
inlineToConTeXt EnDash = return $ text "--"
inlineToConTeXt Ellipses = return $ text "\\ldots{}"
inlineToConTeXt (Str str) = return $ text $ stringToConTeXt str
inlineToConTeXt (Math str) = return $ char '$' <> text str <> char '$'
inlineToConTeXt (Math InlineMath str) = return $ char '$' <> text str <> char '$'
inlineToConTeXt (Math DisplayMath str) = return $ text "\\startformula " <> text str <> text " \\stopformula"
inlineToConTeXt (TeX str) = return $ text str
inlineToConTeXt (HtmlInline _) = return empty
inlineToConTeXt (LineBreak) = return $ text "\\crlf\n"

View file

@ -236,7 +236,7 @@ inlineToDocbook _ EmDash = text "&#8212;"
inlineToDocbook _ EnDash = text "&#8211;"
inlineToDocbook _ (Code str) =
inTagsSimple "literal" $ text (escapeStringForXML str)
inlineToDocbook opts (Math str) = inlinesToDocbook opts $ readTeXMath str
inlineToDocbook opts (Math _ str) = inlinesToDocbook opts $ readTeXMath str
inlineToDocbook _ (TeX _) = empty
inlineToDocbook _ (HtmlInline _) = empty
inlineToDocbook _ LineBreak = text $ "<literallayout></literallayout>"

View file

@ -30,7 +30,7 @@ Conversion of 'Pandoc' documents to HTML.
-}
module Text.Pandoc.Writers.HTML ( writeHtml , writeHtmlString ) where
import Text.Pandoc.Definition
import Text.Pandoc.ASCIIMathML
import Text.Pandoc.LaTeXMathML
import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
import Text.Pandoc.Shared
import Text.Pandoc.Readers.TeXMath
@ -123,9 +123,9 @@ writeHtml opts (Pandoc (Meta tit authors date) blocks) =
'\n':(unlines $ S.toList cssLines)
math = if stMath newstate
then case writerHTMLMathMethod opts of
ASCIIMathML Nothing ->
primHtml asciiMathMLScript
ASCIIMathML (Just url) ->
LaTeXMathML Nothing ->
primHtml latexMathMLScript
LaTeXMathML (Just url) ->
script !
[src url, thetype "text/javascript"] $
noHtml
@ -268,7 +268,7 @@ inlineListToIdentifier' (x:xs) =
Apostrophe -> ""
Ellipses -> ""
LineBreak -> "-"
Math _ -> ""
Math _ _ -> ""
TeX _ -> ""
HtmlInline _ -> ""
Link lst _ -> inlineListToIdentifier' lst
@ -455,10 +455,13 @@ inlineToHtml opts inline =
primHtmlChar "rdquo")
in do contents <- inlineListToHtml opts lst
return $ leftQuote +++ contents +++ rightQuote
(Math str) -> modify (\st -> st {stMath = True}) >>
(Math t str) ->
modify (\st -> st {stMath = True}) >>
(case writerHTMLMathMethod opts of
ASCIIMathML _ ->
return $ stringToHtml ("$" ++ str ++ "$")
LaTeXMathML _ ->
return $ if t == InlineMath
then primHtml ("$" ++ str ++ "$")
else primHtml ("$$" ++ str ++ "$$")
MimeTeX url ->
return $ image ! [src (url ++ "?" ++ str),
alt str, title str]
@ -467,7 +470,10 @@ inlineToHtml opts inline =
PlainMath ->
inlineListToHtml opts (readTeXMath str) >>=
return . (thespan ! [theclass "math"]))
(TeX _) -> return noHtml
(TeX str) -> case writerHTMLMathMethod opts of
LaTeXMathML _ -> do modify (\st -> st {stMath = True})
return $ primHtml str
_ -> return noHtml
(HtmlInline str) -> return $ primHtml str
(Link [Code str] (s,_)) | "mailto:" `isPrefixOf` s ->
return $ obfuscateLink opts str s

View file

@ -299,7 +299,8 @@ inlineToLaTeX EmDash = return $ text "---"
inlineToLaTeX EnDash = return $ text "--"
inlineToLaTeX Ellipses = return $ text "\\ldots{}"
inlineToLaTeX (Str str) = return $ text $ stringToLaTeX str
inlineToLaTeX (Math str) = return $ char '$' <> text str <> char '$'
inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$'
inlineToLaTeX (Math DisplayMath str) = return $ text "\\[" <> text str <> text "\\]"
inlineToLaTeX (TeX str) = return $ text str
inlineToLaTeX (HtmlInline _) = return empty
inlineToLaTeX (LineBreak) = return $ text "\\\\"

View file

@ -272,7 +272,10 @@ inlineToMan _ Ellipses = return $ text "\\&..."
inlineToMan _ (Code str) =
return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"
inlineToMan _ (Str str) = return $ text $ escapeString str
inlineToMan opts (Math str) = inlineToMan opts (Code str)
inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str)
inlineToMan opts (Math DisplayMath str) = do
contents <- inlineToMan opts (Code str)
return $ text ".RS" $$ contents $$ text ".RE"
inlineToMan _ (TeX _) = return empty
inlineToMan _ (HtmlInline str) = return $ text $ escapeCode str
inlineToMan _ (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"

View file

@ -337,7 +337,8 @@ inlineToMarkdown _ (Code str) =
spacer = if (longest == 0) then "" else " " in
return $ text (marker ++ spacer ++ str ++ spacer ++ marker)
inlineToMarkdown _ (Str str) = return $ text $ escapeString str
inlineToMarkdown _ (Math str) = return $ char '$' <> text str <> char '$'
inlineToMarkdown _ (Math InlineMath str) = return $ char '$' <> text str <> char '$'
inlineToMarkdown _ (Math DisplayMath str) = return $ text "$$" <> text str <> text "$$"
inlineToMarkdown _ (TeX str) = return $ text str
inlineToMarkdown _ (HtmlInline str) = return $ text str
inlineToMarkdown _ (LineBreak) = return $ text " \n"

View file

@ -357,7 +357,7 @@ inlineToMediaWiki _ (Code str) =
inlineToMediaWiki _ (Str str) = return $ escapeString str
inlineToMediaWiki _ (Math str) = return $ "<math>" ++ str ++ "</math>"
inlineToMediaWiki _ (Math _ str) = return $ "<math>" ++ str ++ "</math>"
-- note: str should NOT be escaped
inlineToMediaWiki _ (TeX _) = return ""

View file

@ -379,7 +379,7 @@ inlineToOpenDocument o ils
| SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
| Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
| Code s <- ils = preformatted s
| Math s <- ils = inlinesToOpenDocument o (readTeXMath s)
| Math _ s <- ils = inlinesToOpenDocument o (readTeXMath s)
| Cite _ l <- ils = inlinesToOpenDocument o l
| TeX s <- ils = preformatted s
| HtmlInline s <- ils = preformatted s

View file

@ -291,14 +291,16 @@ inlineToRST Apostrophe = return $ char '\''
inlineToRST Ellipses = return $ text "..."
inlineToRST (Code str) = return $ text $ "``" ++ str ++ "``"
inlineToRST (Str str) = return $ text $ escapeString str
inlineToRST (Math str) = do
inlineToRST (Math t str) = do
includes <- get >>= (return . stIncludes)
let rawMathRole = ".. role:: math(raw)\n" ++
" :format: html latex\n"
if not (rawMathRole `elem` includes)
then modify $ \st -> st { stIncludes = rawMathRole : includes }
else return ()
return $ text $ ":math:`$" ++ str ++ "$`"
return $ if t == InlineMath
then text $ ":math:`$" ++ str ++ "$`"
else text $ ":math:`$$" ++ str ++ "$$`"
inlineToRST (TeX _) = return empty
inlineToRST (HtmlInline _) = return empty
inlineToRST (LineBreak) = do

View file

@ -275,7 +275,7 @@ inlineToRTF EmDash = "\\u8212-"
inlineToRTF EnDash = "\\u8211-"
inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}"
inlineToRTF (Str str) = stringToRTF str
inlineToRTF (Math str) = inlineListToRTF $ readTeXMath str
inlineToRTF (Math _ str) = inlineListToRTF $ readTeXMath str
inlineToRTF (Cite _ lst) = inlineListToRTF lst
inlineToRTF (TeX _) = ""
inlineToRTF (HtmlInline _) = ""

View file

@ -30,6 +30,7 @@ Conversion of 'Pandoc' format into Texinfo.
module Text.Pandoc.Writers.Texinfo ( writeTexinfo ) where
import Text.Pandoc.Definition
import Text.Pandoc.Shared
import Text.Pandoc.Readers.TeXMath
import Text.Printf ( printf )
import Data.List ( isSuffixOf )
import Data.Char ( chr, ord )
@ -364,7 +365,7 @@ inlineForNode EnDash = return $ text "--"
inlineForNode Apostrophe = return $ char '\''
inlineForNode Ellipses = return $ text "..."
inlineForNode LineBreak = return empty
inlineForNode (Math _) = return empty
inlineForNode (Math _ str) = inlineListForNode $ readTeXMath str
inlineForNode (TeX _) = return empty
inlineForNode (HtmlInline _) = return empty
inlineForNode (Link lst _) = inlineListForNode lst
@ -437,7 +438,7 @@ inlineToTexinfo EmDash = return $ text "---"
inlineToTexinfo EnDash = return $ text "--"
inlineToTexinfo Ellipses = return $ text "@dots{}"
inlineToTexinfo (Str str) = return $ text (stringToTexinfo str)
inlineToTexinfo (Math str) = return $ inCmd "math" $ text str
inlineToTexinfo (Math _ str) = return $ inCmd "math" $ text str
inlineToTexinfo (TeX str) = return $ text "@tex" $$ text str $$ text "@end tex"
inlineToTexinfo (HtmlInline _) = return empty
inlineToTexinfo (LineBreak) = return $ text "@*"

File diff suppressed because it is too large Load diff

View file

@ -1,2 +0,0 @@
/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
/*
LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/
Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,
(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License (at http://www.gnu.org/copyleft/gpl.html)
for more details.
*/

191
data/LaTeXMathML.js.packed Normal file

File diff suppressed because one or more lines are too long

View file

@ -107,9 +107,9 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
only when the input format is `markdown`. It is selected automatically
when the output format is `latex` or `context`.)
-m*URL*, \--asciimathml=*URL*
: Use ASCIIMathML to display embedded TeX math in HTML output.
To insert a link to a local copy of the `ASCIIMathML.js` script,
-m*URL*, \--latexmathml=*URL*
: Use LaTeXMathML to display embedded TeX math in HTML output.
To insert a link to a local copy of the `LaTeXMathML.js` script,
provide a *URL*. If no *URL* is provided, the contents of the
script will be inserted directly into the HTML header.

View file

@ -51,9 +51,9 @@ Extra-Source-Files:
data/headers/OpenDocument.header,
data/headers/RTF.header,
data/headers/S5.header,
-- data for ASCIIMathML writer
data/ASCIIMathML.js.comment,
data/ASCIIMathML.js.packed,
-- data for LaTeXMathML writer
data/LaTeXMathML.js.comment,
data/LaTeXMathML.js.packed,
-- data for S5 writer
data/ui/default/slides.js.comment,
data/ui/default/slides.js.packed,
@ -168,7 +168,7 @@ Library
Text.Pandoc.Shared,
Text.Pandoc.ODT,
Text.Pandoc.PDF,
Text.Pandoc.ASCIIMathML,
Text.Pandoc.LaTeXMathML,
Text.Pandoc.DefaultHeaders,
Text.Pandoc.Highlighting,
Text.Pandoc.Readers.HTML,

View file

@ -274,13 +274,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, BulletList
[ [ Para [TeX "\\cite[22-23]{smith.1899}"] ]
, [ Para [TeX "\\doublespacing"] ]
, [ Para [Math "2+2=4"] ]
, [ Para [Math "x \\in y"] ]
, [ Para [Math "\\alpha \\wedge \\omega"] ]
, [ Para [Math "223"] ]
, [ Para [Math "p",Str "-",Str "Tree"] ]
, [ Para [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]
, [ Para [Math InlineMath "2+2=4"] ]
, [ Para [Math InlineMath "x \\in y"] ]
, [ Para [Math InlineMath "\\alpha \\wedge \\omega"] ]
, [ Para [Math InlineMath "223"] ]
, [ Para [Math InlineMath "p",Str "-",Str "Tree"] ]
, [ Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ]
, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
, BulletList
[ [ Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]

File diff suppressed because one or more lines are too long

View file

@ -5,5 +5,5 @@ Pandoc (Meta [Str "My",Space,Str "S5",Space,Str "Document"] ["Sam Smith","Jen Jo
, [ Plain [Str "second",Space,Str "bullet"] ] ]
, Header 1 [Str "Math"]
, BulletList
[ [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
[ [ Plain [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
] ]

View file

@ -282,14 +282,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Header 1 [Str "LaTeX"]
, BulletList
[ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
, [ Plain [TeX "\\doublespacing"] ]
, [ Plain [Math "2+2=4"] ]
, [ Plain [Math "x \\in y"] ]
, [ Plain [Math "\\alpha \\wedge \\omega"] ]
, [ Plain [Math "223"] ]
, [ Plain [Math "p",Str "-",Str "Tree"] ]
, [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]
, [ Plain [Math InlineMath "2+2=4"] ]
, [ Plain [Math InlineMath "x \\in y"] ]
, [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]
, [ Plain [Math InlineMath "223"] ]
, [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ]
, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
, BulletList
[ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]

View file

@ -467,13 +467,13 @@ Ellipses...and. . .and . . . .
# LaTeX
- \cite[22-23]{smith.1899}
- \doublespacing
- $2+2=4$
- $x \in y$
- $\alpha \wedge \omega$
- $223$
- $p$-Tree
- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
- Here's some display math:
$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
- Here's one that has a line break in it: $\alpha + \omega \times
x^2$.

View file

@ -629,8 +629,6 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\startitemize
\item
\cite[22-23]{smith.1899}
\item
\doublespacing
\item
$2+2=4$
\item
@ -642,7 +640,8 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\item
$p$-Tree
\item
$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
Here's some display math:
\startformula \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h} \stopformula
\item
Here's one that has a line break in it:
$\alpha + \omega \times x^2$.

View file

@ -975,10 +975,6 @@ Blah
<para>
</para>
</listitem>
<listitem>
<para>
</para>
</listitem>
<listitem>
<para>
2+2=4
@ -1006,6 +1002,7 @@ Blah
</listitem>
<listitem>
<para>
Here's some display math:
\frac{<emphasis>d</emphasis>}{<emphasis>dx</emphasis>}<emphasis>f</emphasis>(<emphasis>x</emphasis>)=\lim<subscript><emphasis>h</emphasis>0</subscript>\frac{<emphasis>f</emphasis>(<emphasis>x</emphasis>+<emphasis>h</emphasis>)-<emphasis>f</emphasis>(<emphasis>x</emphasis>)}{<emphasis>h</emphasis>}
</para>
</listitem>

View file

@ -718,8 +718,6 @@ Blah
>LaTeX</h1
><ul
><li
></li
><li
></li
><li
><span class="math"
@ -748,7 +746,7 @@ Blah
></span
>-Tree</li
><li
><span class="math"
>Here&rsquo;s some display math: <span class="math"
>\frac{<em
>d</em
>}{<em

View file

@ -564,8 +564,6 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\begin{itemize}
\item
\cite[22-23]{smith.1899}
\item
\doublespacing
\item
$2+2=4$
\item
@ -577,7 +575,8 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\item
$p$-Tree
\item
$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
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$.

View file

@ -547,7 +547,6 @@ Ellipses\&...and\&...and\&...\.
.SH LaTeX
.IP \[bu] 2
.IP \[bu] 2
.IP \[bu] 2
\f[B]2+2=4\f[]
.IP \[bu] 2
\f[B]x\ \\in\ y\f[]
@ -558,7 +557,10 @@ Ellipses\&...and\&...and\&...\.
.IP \[bu] 2
\f[B]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[]
.RE
.IP \[bu] 2
Here's one that has a line break in it:
\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]\.

View file

@ -492,13 +492,13 @@ Ellipses...and...and....
# LaTeX
- \cite[22-23]{smith.1899}
- \doublespacing
- $2+2=4$
- $x \in y$
- $\alpha \wedge \omega$
- $223$
- $p$-Tree
- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
- Here's some display math:
$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
- Here's one that has a line break in it:
$\alpha + \omega \times x^2$.

View file

@ -422,14 +422,13 @@ Ellipses&hellip;and&hellip;and&hellip;.
== LaTeX ==
*
*
* <math>2+2=4</math>
* <math>x \in y</math>
* <math>\alpha \wedge \omega</math>
* <math>223</math>
* <math>p</math>-Tree
* <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
* Here&rsquo;s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
* Here&rsquo;s one that has a line break in it: <math>\alpha + \omega \times x^2</math>.
These shouldn&rsquo;t be math:

View file

@ -282,14 +282,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
, Header 1 [Str "LaTeX"]
, BulletList
[ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
, [ Plain [TeX "\\doublespacing"] ]
, [ Plain [Math "2+2=4"] ]
, [ Plain [Math "x \\in y"] ]
, [ Plain [Math "\\alpha \\wedge \\omega"] ]
, [ Plain [Math "223"] ]
, [ Plain [Math "p",Str "-",Str "Tree"] ]
, [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]
, [ Plain [Math InlineMath "2+2=4"] ]
, [ Plain [Math InlineMath "x \\in y"] ]
, [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]
, [ Plain [Math InlineMath "223"] ]
, [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
, [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ]
, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
, BulletList
[ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]

View file

@ -1366,9 +1366,6 @@
<text:list-item>
<text:p text:style-name="P50"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
</text:list-item>
<text:list-item>
<text:p text:style-name="P50"><text:span text:style-name="Teletype">\doublespacing</text:span></text:p>
</text:list-item>
<text:list-item>
<text:p text:style-name="P50">2+2=4</text:p>
</text:list-item>
@ -1385,7 +1382,7 @@
<text:p text:style-name="P50"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
</text:list-item>
<text:list-item>
<text:p text:style-name="P50">\frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>
<text:p text:style-name="P50">Here&#8217;s some display math: \frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>
</text:list-item>
<text:list-item>
<text:p text:style-name="P50">Here&#8217;s one that has a line break in it: α+ω × <text:span text:style-name="T74">x</text:span><text:span text:style-name="T75">2</text:span>.</text:p>

View file

@ -621,14 +621,14 @@ LaTeX
=====
-
-
- :math:`$2+2=4$`
- :math:`$x \in y$`
- :math:`$\alpha \wedge \omega$`
- :math:`$223$`
- :math:`$p$`-Tree
- :math:`$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$`
- Here's some display math:
:math:`$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$`
- Here's one that has a line break in it:
:math:`$\alpha + \omega \times x^2$`.

View file

@ -241,13 +241,12 @@ quoted link
{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x}{\super 2}.\sa180\par}
{\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}
{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}

View file

@ -709,10 +709,6 @@ Ellipses@dots{}and@dots{}and@dots{}.
\cite[22-23]{smith.1899}
@end tex
@item
@tex
\doublespacing
@end tex
@item
@math{2+2=4}
@item
@math{x \in y}
@ -723,7 +719,7 @@ Ellipses@dots{}and@dots{}and@dots{}.
@item
@math{p}-Tree
@item
@math{\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}}
Here's some display math: @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: @math{\alpha + \omega \times x^2}.
@end itemize

View file

@ -155,7 +155,6 @@ kind.
[More accurate]: http://code.google.com/p/pandoc/wiki/PandocVsMarkdownPl
[much faster]: http://code.google.com/p/pandoc/wiki/Benchmarks
[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
[John MacFarlane]: http://johnmacfarlane.net/
[markdown]: http://daringfireball.net/projects/markdown/