git.iko.soy/typeable/pandoc
on master help sign in
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

commitf53fb554fe0acf88d7c697236bbd1373e78f3d83 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 13 Aug 2008, 03:02 (18 years ago) parentaeaf5e5
44 files changed+514−4219
Main.hs+3−3 README+10−10 Text/Pandoc/ASCIIMathML.hs−14 Text/Pandoc/Definition.hs+4−1 Text/Pandoc/LaTeXMathML.hs+14 Text/Pandoc/Readers/LaTeX.hs+25−36 Text/Pandoc/Readers/Markdown.hs+9−2 Text/Pandoc/Shared.hs+3−3 Text/Pandoc/Writers/ConTeXt.hs+2−1 Text/Pandoc/Writers/Docbook.hs+1−1 Text/Pandoc/Writers/HTML.hs+15−9 Text/Pandoc/Writers/LaTeX.hs+2−1 Text/Pandoc/Writers/Man.hs+4−1 Text/Pandoc/Writers/Markdown.hs+2−1 Text/Pandoc/Writers/MediaWiki.hs+1−1 Text/Pandoc/Writers/OpenDocument.hs+1−1 Text/Pandoc/Writers/RST.hs+4−2 Text/Pandoc/Writers/RTF.hs+1−1 Text/Pandoc/Writers/Texinfo.hs+3−2 data/ASCIIMathML.js−3363 data/ASCIIMathML.js.comment−2 data/ASCIIMathML.js.packed−374 data/LaTeXMathML.js.comment+16 data/LaTeXMathML.js.packed+191 man/man1/pandoc.1.md+3−3 pandoc.cabal+4−4 tests/latex-reader.native+7−7 tests/s5.fancy.html+155−325 tests/s5.native+1−1 tests/testsuite.native+7−8 tests/testsuite.txt+2−2 tests/writer.context+2−3 tests/writer.docbook+1−4 tests/writer.html+1−3 tests/writer.latex+2−3 tests/writer.man+3−1 tests/writer.markdown+2−2 tests/writer.mediawiki+1−2 tests/writer.native+7−8 tests/writer.opendocument+1−4 tests/writer.rst+2−2 tests/writer.rtf+1−2 tests/writer.texinfo+1−5 web/index.txt.in−1
Main.hs+3−3
@@ -249,12 +249,12 @@ options =
249249 (\opt -> return opt { optSmart = True }))
250250 "" -- "Use smart quotes, dashes, and ellipses"
251251
252− , Option "m" ["asciimathml"]
252+ , Option "m" ["latexmathml", "asciimathml"]
253253 (OptArg
254254 (\arg opt -> return opt { optHTMLMathMethod =
255− ASCIIMathML arg })
255+ LaTeXMathML arg })
256256 "URL")
257− "" -- "Use ASCIIMathML script in html output"
257+ "" -- "Use LaTeXMathML script in html output"
258258
259259 , Option "" ["mimetex"]
260260 (OptArg
README+10−10
@@ -310,27 +310,27 @@ For further documentation, see the `pandoc(1)` man page.
310310 `markdown`. It is selected automatically when the output format is
311311 `latex` or `context`.)
312312
313−`-m`*[url]* or `--asciimathml`*[=url]*
314−: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display
315− TeX math in HTML or S5. If a local copy of `ASCIIMathML.js` is
313+`-m`*[url]* or `--latexmathml`*[=url]*
314+: causes `pandoc` to use the [LaTeXMathML] script to display
315+ TeX math in HTML or S5. If a local copy of `LaTeXMathML.js` is
316316 available on the webserver where the page will be viewed, provide a
317317 *url* and a link will be inserted in the generated HTML or S5. If
318318 no *url* is provided, the contents of the script will be inserted
319319 directly; this provides portability at the price of efficiency. If
320320 you plan to use math on several pages, it is much better to link to
321− a copy of `ASCIIMathML.js`, which can be cached. (See `--gladtex`
321+ a copy of `LaTeXMathML.js`, which can be cached. (See `--gladtex`
322322 and `--mimetex` for alternative ways of dealing with math in HTML.)
323323
324324`--gladtex`*[=url]*
325325: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
326326 This output can then be processed by [gladTeX] to produce links to
327− images with the typeset formulas. (See `--asciimathml` and
327+ images with the typeset formulas. (See `--latexmathml` and
328328 `--mimetex` for alternative ways of dealing with math in HTML.)
329329
330330`--mimetex`*[=url]*
331331: causes TeX formulas to be replaced by `<img>` tags linking to the
332332 [mimeTeX] CGI script, which will produce images with the typeset
333− formulas. (See `--asciimathml` and `--mimetex` for alternative
333+ formulas. (See `--latexmathml` and `--mimetex` for alternative
334334 ways of dealing with math in HTML.)
335335
336336`-i` or `--incremental`
@@ -386,7 +386,7 @@ For further documentation, see the `pandoc(1)` man page.
386386: prints a usage message to STDERR.
387387
388388[Smartypants]: http://daringfireball.net/projects/smartypants/
389−[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
389+[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
390390[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
391391[mimeTeX]: http://www.forkosh.com/mimetex.html
392392
@@ -930,11 +930,11 @@ command-line options selected:
930930 are put inside a `span` with `class="math"`, so that they may be
931931 styled differently from the surrounding text if needed.
932932
933−2. If the `--asciimathml` option is used, TeX math will be displayed
934− between $ characters, as in LaTeX, and the [ASCIIMathML] script will
933+2. If the `--latexmathml` option is used, TeX math will be displayed
934+ between $ characters, as in LaTeX, and the [LaTeXMathML] script will
935935 be used to render it as formulas. (This trick does not work in all
936936 browsers, but it works in Firefox. In browsers that do not support
937− ASCIIMathML, TeX math will appear verbatim between $ characters.)
937+ LaTeXMathML, TeX math will appear verbatim between $ characters.)
938938
9399393. If the `--mimetex` option is used, the [mimeTeX] CGI script will
940940 be called to generate images for each TeX formula. This should
Text/Pandoc/ASCIIMathML.hsdeleted−14
@@ -1,14 +0,0 @@
1−{-# LANGUAGE CPP, TemplateHaskell #-}
2−-- | Definitions for use of ASCIIMathML in HTML.
3−-- (See <http://www1.chapman.edu/~jipsen/mathml/asciimath.html>.)
4−module Text.Pandoc.ASCIIMathML ( asciiMathMLScript ) where
5−import Text.Pandoc.TH ( contentsOf )
6−import System.FilePath ( (</>) )
7−
8−-- | String containing ASCIIMathML javascript.
9−asciiMathMLScript :: String
10−#ifndef __HADDOCK__
11−asciiMathMLScript = "<script type=\"text/javascript\">\n" ++
12− $(contentsOf $ "data" </> "ASCIIMathML.js.comment") ++
13− $(contentsOf $ "data" </> "ASCIIMathML.js.packed") ++ "</script>\n"
14−#endif
Text/Pandoc/Definition.hs+4−1
@@ -98,6 +98,9 @@ data QuoteType = SingleQuote | DoubleQuote deriving (Show, Eq, Read, Typeable, D
9898-- | Link target (URL, title).
9999type Target = (String, String)
100100
101+-- | Type of math element (display or inline).
102+data MathType = DisplayMath | InlineMath deriving (Show, Eq, Read, Typeable, Data)
103+
101104-- | Inline elements.
102105data Inline
103106 = Str String -- ^ Text (string)
@@ -116,7 +119,7 @@ data Inline
116119 | Apostrophe -- ^ Apostrophe
117120 | Ellipses -- ^ Ellipses
118121 | LineBreak -- ^ Hard line break
119− | Math String -- ^ TeX math (literal)
122+ | Math MathType String -- ^ TeX math (literal)
120123 | TeX String -- ^ LaTeX code (literal)
121124 | HtmlInline String -- ^ HTML code (literal)
122125 | Link [Inline] Target -- ^ Hyperlink: text (list of inlines), target
Text/Pandoc/LaTeXMathML.hsnew file+14
@@ -0,0 +1,14 @@
1+{-# LANGUAGE CPP, TemplateHaskell #-}
2+-- | Definitions for use of LaTeXMathML in HTML.
3+-- (See http://math.etsu.edu/LaTeXMathML/)
4+module Text.Pandoc.LaTeXMathML ( latexMathMLScript ) where
5+import Text.Pandoc.TH ( contentsOf )
6+import System.FilePath ( (</>) )
7+
8+-- | String containing LaTeXMathML javascript.
9+latexMathMLScript :: String
10+#ifndef __HADDOCK__
11+latexMathMLScript = "<script type=\"text/javascript\">\n" ++
12+ $(contentsOf $ "data" </> "LaTeXMathML.js.comment") ++
13+ $(contentsOf $ "data" </> "LaTeXMathML.js.packed") ++ "</script>\n"
14+#endif
Text/Pandoc/Readers/LaTeX.hs+25−36
@@ -153,7 +153,6 @@ block = choice [ hrule
153153 , header
154154 , list
155155 , blockQuote
156− , mathBlock
157156 , comment
158157 , bibliographic
159158 , para
@@ -218,26 +217,6 @@ blockQuote :: GenParser Char ParserState Block
218217blockQuote = (environment "quote" <|> environment "quotation") >>~ spaces >>=
219218 return . BlockQuote
220219
221−--
222−-- math block
223−--
224−
225−mathBlock :: GenParser Char st Block
226−mathBlock = mathBlockWith (begin "equation") (end "equation") <|>
227− mathBlockWith (begin "displaymath") (end "displaymath") <|>
228− mathBlockWith (try $ string "\\[") (try $ string "\\]") <?>
229− "math block"
230−
231−mathBlockWith :: GenParser Char st t
232− -> GenParser Char st end
233− -> GenParser Char st Block
234−mathBlockWith start end' = try $ do
235− start
236− spaces
237− result <- manyTill anyChar end'
238− spaces
239− return $ BlockQuote [Para [Math result]]
240−
241220--
242221-- list blocks
243222--
@@ -683,21 +662,31 @@ endline = try $ newline >> notFollowedBy blankline >> return Space
683662
684663-- math
685664math :: GenParser Char st Inline
686−math = math1 <|> math2 <?> "math"
687−
688−math1 :: GenParser Char st Inline
689−math1 = try $ do
690− char '$'
691− result <- many (noneOf "$")
692− char '$'
693− return $ Math result
694−
695−math2 :: GenParser Char st Inline
696−math2 = try $ do
697− string "\\("
698− result <- many (noneOf "$")
699− string "\\)"
700− return $ Math result
665+math = (math3 >>= return . Math DisplayMath)
666+ <|> (math1 >>= return . Math InlineMath)
667+ <|> (math2 >>= return . Math InlineMath)
668+ <|> (math4 >>= return . Math DisplayMath)
669+ <|> (math5 >>= return . Math DisplayMath)
670+ <|> (math6 >>= return . Math DisplayMath)
671+ <?> "math"
672+
673+math1 :: GenParser Char st String
674+math1 = try $ char '$' >> manyTill anyChar (char '$')
675+
676+math2 :: GenParser Char st String
677+math2 = try $ string "\\(" >> manyTill anyChar (try $ string "\\)")
678+
679+math3 :: GenParser Char st String
680+math3 = try $ char '$' >> math1 >>~ char '$'
681+
682+math4 :: GenParser Char st String
683+math4 = try $ (begin "equation") >> spaces >> manyTill anyChar (end "equation")
684+
685+math5 :: GenParser Char st String
686+math5 = try $ (begin "displaymath") >> spaces >> manyTill anyChar (end "displaymath")
687+
688+math6 :: GenParser Char st String
689+math6 = try $ (string "\\[") >> spaces >> manyTill anyChar (try $ string "\\]")
701690
702691--
703692-- links and images
Text/Pandoc/Readers/Markdown.hs+9−2
@@ -870,14 +870,21 @@ mathWord = many1 ((noneOf " \t\n\\$") <|>
870870 (try (char '\\') >>~ notFollowedBy (char '$')))
871871
872872math :: GenParser Char ParserState Inline
873−math = try $ do
873+math = (mathDisplay >>= return . Math DisplayMath)
874+ <|> (mathInline >>= return . Math InlineMath)
875+
876+mathDisplay :: GenParser Char ParserState String
877+mathDisplay = try $ char '$' >> mathInline >>~ char '$' >>~ notFollowedBy digit
878+
879+mathInline :: GenParser Char ParserState String
880+mathInline = try $ do
874881 failIfStrict
875882 char '$'
876883 notFollowedBy space
877884 words' <- sepBy1 mathWord (many1 (spaceChar <|> (newline >>~ notFollowedBy' blankline)))
878885 char '$'
879886 notFollowedBy digit
880− return $ Math $ joinWithSep " " words'
887+ return $ joinWithSep " " words'
881888
882889emph :: GenParser Char ParserState Inline
883890emph = ((enclosed (char '*') (notFollowedBy' strong >> char '*') inline) <|>
Text/Pandoc/Shared.hs+3−3
@@ -715,8 +715,8 @@ refsMatch ((Quoted t x):restx) ((Quoted u y):resty) =
715715 t == u && refsMatch x y && refsMatch restx resty
716716refsMatch ((Code x):restx) ((Code y):resty) =
717717 ((map toLower x) == (map toLower y)) && refsMatch restx resty
718−refsMatch ((Math x):restx) ((Math y):resty) =
719− ((map toLower x) == (map toLower y)) && refsMatch restx resty
718+refsMatch ((Math t x):restx) ((Math u y):resty) =
719+ ((map toLower x) == (map toLower y)) && t == u && refsMatch restx resty
720720refsMatch ((TeX x):restx) ((TeX y):resty) =
721721 ((map toLower x) == (map toLower y)) && refsMatch restx resty
722722refsMatch ((HtmlInline x):restx) ((HtmlInline y):resty) =
@@ -876,7 +876,7 @@ isHeaderBlock _ = False
876876--
877877
878878data HTMLMathMethod = PlainMath
879− | ASCIIMathML (Maybe String) -- url of ASCIIMathML.js
879+ | LaTeXMathML (Maybe String) -- url of LaTeXMathML.js
880880 | GladTeX
881881 | MimeTeX String -- url of mimetex.cgi
882882 deriving (Show, Read, Eq)
Text/Pandoc/Writers/ConTeXt.hs+2−1
@@ -272,7 +272,8 @@ inlineToConTeXt EmDash = return $ text "---"
272272inlineToConTeXt EnDash = return $ text "--"
273273inlineToConTeXt Ellipses = return $ text "\\ldots{}"
274274inlineToConTeXt (Str str) = return $ text $ stringToConTeXt str
275−inlineToConTeXt (Math str) = return $ char '$' <> text str <> char '$'
275+inlineToConTeXt (Math InlineMath str) = return $ char '$' <> text str <> char '$'
276+inlineToConTeXt (Math DisplayMath str) = return $ text "\\startformula " <> text str <> text " \\stopformula"
276277inlineToConTeXt (TeX str) = return $ text str
277278inlineToConTeXt (HtmlInline _) = return empty
278279inlineToConTeXt (LineBreak) = return $ text "\\crlf\n"
Text/Pandoc/Writers/Docbook.hs+1−1
@@ -236,7 +236,7 @@ inlineToDocbook _ EmDash = text "&#8212;"
236236inlineToDocbook _ EnDash = text "&#8211;"
237237inlineToDocbook _ (Code str) =
238238 inTagsSimple "literal" $ text (escapeStringForXML str)
239−inlineToDocbook opts (Math str) = inlinesToDocbook opts $ readTeXMath str
239+inlineToDocbook opts (Math _ str) = inlinesToDocbook opts $ readTeXMath str
240240inlineToDocbook _ (TeX _) = empty
241241inlineToDocbook _ (HtmlInline _) = empty
242242inlineToDocbook _ LineBreak = text $ "<literallayout></literallayout>"
Text/Pandoc/Writers/HTML.hs+15−9
@@ -30,7 +30,7 @@ Conversion of 'Pandoc' documents to HTML.
3030-}
3131module Text.Pandoc.Writers.HTML ( writeHtml , writeHtmlString ) where
3232import Text.Pandoc.Definition
33−import Text.Pandoc.ASCIIMathML
33+import Text.Pandoc.LaTeXMathML
3434import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
3535import Text.Pandoc.Shared
3636import Text.Pandoc.Readers.TeXMath
@@ -123,9 +123,9 @@ writeHtml opts (Pandoc (Meta tit authors date) blocks) =
123123 '\n':(unlines $ S.toList cssLines)
124124 math = if stMath newstate
125125 then case writerHTMLMathMethod opts of
126− ASCIIMathML Nothing ->
127− primHtml asciiMathMLScript
128− ASCIIMathML (Just url) ->
126+ LaTeXMathML Nothing ->
127+ primHtml latexMathMLScript
128+ LaTeXMathML (Just url) ->
129129 script !
130130 [src url, thetype "text/javascript"] $
131131 noHtml
@@ -268,7 +268,7 @@ inlineListToIdentifier' (x:xs) =
268268 Apostrophe -> ""
269269 Ellipses -> ""
270270 LineBreak -> "-"
271− Math _ -> ""
271+ Math _ _ -> ""
272272 TeX _ -> ""
273273 HtmlInline _ -> ""
274274 Link lst _ -> inlineListToIdentifier' lst
@@ -455,10 +455,13 @@ inlineToHtml opts inline =
455455 primHtmlChar "rdquo")
456456 in do contents <- inlineListToHtml opts lst
457457 return $ leftQuote +++ contents +++ rightQuote
458− (Math str) -> modify (\st -> st {stMath = True}) >>
458+ (Math t str) ->
459+ modify (\st -> st {stMath = True}) >>
459460 (case writerHTMLMathMethod opts of
460− ASCIIMathML _ ->
461− return $ stringToHtml ("$" ++ str ++ "$")
461+ LaTeXMathML _ ->
462+ return $ if t == InlineMath
463+ then primHtml ("$" ++ str ++ "$")
464+ else primHtml ("$$" ++ str ++ "$$")
462465 MimeTeX url ->
463466 return $ image ! [src (url ++ "?" ++ str),
464467 alt str, title str]
@@ -467,7 +470,10 @@ inlineToHtml opts inline =
467470 PlainMath ->
468471 inlineListToHtml opts (readTeXMath str) >>=
469472 return . (thespan ! [theclass "math"]))
470− (TeX _) -> return noHtml
473+ (TeX str) -> case writerHTMLMathMethod opts of
474+ LaTeXMathML _ -> do modify (\st -> st {stMath = True})
475+ return $ primHtml str
476+ _ -> return noHtml
471477 (HtmlInline str) -> return $ primHtml str
472478 (Link [Code str] (s,_)) | "mailto:" `isPrefixOf` s ->
473479 return $ obfuscateLink opts str s
Text/Pandoc/Writers/LaTeX.hs+2−1
@@ -299,7 +299,8 @@ inlineToLaTeX EmDash = return $ text "---"
299299inlineToLaTeX EnDash = return $ text "--"
300300inlineToLaTeX Ellipses = return $ text "\\ldots{}"
301301inlineToLaTeX (Str str) = return $ text $ stringToLaTeX str
302−inlineToLaTeX (Math str) = return $ char '$' <> text str <> char '$'
302+inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$'
303+inlineToLaTeX (Math DisplayMath str) = return $ text "\\[" <> text str <> text "\\]"
303304inlineToLaTeX (TeX str) = return $ text str
304305inlineToLaTeX (HtmlInline _) = return empty
305306inlineToLaTeX (LineBreak) = return $ text "\\\\"
Text/Pandoc/Writers/Man.hs+4−1
@@ -272,7 +272,10 @@ inlineToMan _ Ellipses = return $ text "\\&..."
272272inlineToMan _ (Code str) =
273273 return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"
274274inlineToMan _ (Str str) = return $ text $ escapeString str
275−inlineToMan opts (Math str) = inlineToMan opts (Code str)
275+inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str)
276+inlineToMan opts (Math DisplayMath str) = do
277+ contents <- inlineToMan opts (Code str)
278+ return $ text ".RS" $$ contents $$ text ".RE"
276279inlineToMan _ (TeX _) = return empty
277280inlineToMan _ (HtmlInline str) = return $ text $ escapeCode str
278281inlineToMan _ (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"
Text/Pandoc/Writers/Markdown.hs+2−1
@@ -337,7 +337,8 @@ inlineToMarkdown _ (Code str) =
337337 spacer = if (longest == 0) then "" else " " in
338338 return $ text (marker ++ spacer ++ str ++ spacer ++ marker)
339339inlineToMarkdown _ (Str str) = return $ text $ escapeString str
340−inlineToMarkdown _ (Math str) = return $ char '$' <> text str <> char '$'
340+inlineToMarkdown _ (Math InlineMath str) = return $ char '$' <> text str <> char '$'
341+inlineToMarkdown _ (Math DisplayMath str) = return $ text "$$" <> text str <> text "$$"
341342inlineToMarkdown _ (TeX str) = return $ text str
342343inlineToMarkdown _ (HtmlInline str) = return $ text str
343344inlineToMarkdown _ (LineBreak) = return $ text " \n"
Text/Pandoc/Writers/MediaWiki.hs+1−1
@@ -357,7 +357,7 @@ inlineToMediaWiki _ (Code str) =
357357
358358inlineToMediaWiki _ (Str str) = return $ escapeString str
359359
360−inlineToMediaWiki _ (Math str) = return $ "<math>" ++ str ++ "</math>"
360+inlineToMediaWiki _ (Math _ str) = return $ "<math>" ++ str ++ "</math>"
361361 -- note: str should NOT be escaped
362362
363363inlineToMediaWiki _ (TeX _) = return ""
Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -379,7 +379,7 @@ inlineToOpenDocument o ils
379379 | SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l
380380 | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l
381381 | Code s <- ils = preformatted s
382− | Math s <- ils = inlinesToOpenDocument o (readTeXMath s)
382+ | Math _ s <- ils = inlinesToOpenDocument o (readTeXMath s)
383383 | Cite _ l <- ils = inlinesToOpenDocument o l
384384 | TeX s <- ils = preformatted s
385385 | HtmlInline s <- ils = preformatted s
Text/Pandoc/Writers/RST.hs+4−2
@@ -291,14 +291,16 @@ inlineToRST Apostrophe = return $ char '\''
291291inlineToRST Ellipses = return $ text "..."
292292inlineToRST (Code str) = return $ text $ "``" ++ str ++ "``"
293293inlineToRST (Str str) = return $ text $ escapeString str
294−inlineToRST (Math str) = do
294+inlineToRST (Math t str) = do
295295 includes <- get >>= (return . stIncludes)
296296 let rawMathRole = ".. role:: math(raw)\n" ++
297297 " :format: html latex\n"
298298 if not (rawMathRole `elem` includes)
299299 then modify $ \st -> st { stIncludes = rawMathRole : includes }
300300 else return ()
301− return $ text $ ":math:`$" ++ str ++ "$`"
301+ return $ if t == InlineMath
302+ then text $ ":math:`$" ++ str ++ "$`"
303+ else text $ ":math:`$$" ++ str ++ "$$`"
302304inlineToRST (TeX _) = return empty
303305inlineToRST (HtmlInline _) = return empty
304306inlineToRST (LineBreak) = do
Text/Pandoc/Writers/RTF.hs+1−1
@@ -275,7 +275,7 @@ inlineToRTF EmDash = "\\u8212-"
275275inlineToRTF EnDash = "\\u8211-"
276276inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}"
277277inlineToRTF (Str str) = stringToRTF str
278−inlineToRTF (Math str) = inlineListToRTF $ readTeXMath str
278+inlineToRTF (Math _ str) = inlineListToRTF $ readTeXMath str
279279inlineToRTF (Cite _ lst) = inlineListToRTF lst
280280inlineToRTF (TeX _) = ""
281281inlineToRTF (HtmlInline _) = ""
Text/Pandoc/Writers/Texinfo.hs+3−2
@@ -30,6 +30,7 @@ Conversion of 'Pandoc' format into Texinfo.
3030module Text.Pandoc.Writers.Texinfo ( writeTexinfo ) where
3131import Text.Pandoc.Definition
3232import Text.Pandoc.Shared
33+import Text.Pandoc.Readers.TeXMath
3334import Text.Printf ( printf )
3435import Data.List ( isSuffixOf )
3536import Data.Char ( chr, ord )
@@ -364,7 +365,7 @@ inlineForNode EnDash = return $ text "--"
364365inlineForNode Apostrophe = return $ char '\''
365366inlineForNode Ellipses = return $ text "..."
366367inlineForNode LineBreak = return empty
367−inlineForNode (Math _) = return empty
368+inlineForNode (Math _ str) = inlineListForNode $ readTeXMath str
368369inlineForNode (TeX _) = return empty
369370inlineForNode (HtmlInline _) = return empty
370371inlineForNode (Link lst _) = inlineListForNode lst
@@ -437,7 +438,7 @@ inlineToTexinfo EmDash = return $ text "---"
437438inlineToTexinfo EnDash = return $ text "--"
438439inlineToTexinfo Ellipses = return $ text "@dots{}"
439440inlineToTexinfo (Str str) = return $ text (stringToTexinfo str)
440−inlineToTexinfo (Math str) = return $ inCmd "math" $ text str
441+inlineToTexinfo (Math _ str) = return $ inCmd "math" $ text str
441442inlineToTexinfo (TeX str) = return $ text "@tex" $$ text str $$ text "@end tex"
442443inlineToTexinfo (HtmlInline _) = return empty
443444inlineToTexinfo (LineBreak) = return $ text "@*"
data/ASCIIMathML.jsdeleted−3363
@@ -1,3363 +0,0 @@
1−/*
2−ASCIIMathML.js
3−==============
4−This file contains JavaScript functions to convert ASCII math notation
5−and LaTeX to Presentation MathML. Simple graphics commands are also
6−translated to SVG images. The conversion is done while the (X)HTML
7−page loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
8−Explorer 6/7 + MathPlayer (http://www.dessci.com/en/products/mathplayer/) +
9−Adobe SVGview 3.03 (http://www.adobe.com/svg/viewer/install/).
10−
11−Just add the next line to your (X)HTML page with this file in the same folder:
12−
13−<script type="text/javascript" src="ASCIIMathML.js"></script>
14−
15−(using the graphics in IE also requires the file "d.svg" in the same folder).
16−This is a convenient and inexpensive solution for authoring MathML and SVG.
17−
18−Version 2.0.9 Nov 3, 2007, (c) Peter Jipsen http://www.chapman.edu/~jipsen
19−This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.
20−Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
21−If you use it on a webpage, please send the URL to jipsen@chapman.edu
22−
23−The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
24−(for details see header on the LaTeXMathML part in middle of file)
25−Extensive clean-up and improvements by Paulo Soares, Oct 2007.
26−
27−This program is free software; you can redistribute it and/or modify
28−it under the terms of the GNU Lesser General Public License as published by
29−the Free Software Foundation; either version 2.1 of the License, or (at
30−your option) any later version.
31−
32−This program is distributed in the hope that it will be useful, but WITHOUT
33−ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34−FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
35−(at http://www.gnu.org/licences/lgpl.html) for more details.
36−*/
37−
38−var mathcolor = ""; // change it to "" (to inherit) or another color
39−var mathfontsize = "1em"; // change to e.g. 1.2em for larger math
40−var mathfontfamily = "serif"; // change to "" to inherit (works in IE)
41− // or another family (e.g. "arial")
42−var automathrecognize = false; // writing "amath" on page makes this true
43−var checkForMathML = true; // check if browser can display MathML
44−var notifyIfNoMathML = true; // display note at top if no MathML capability
45−var alertIfNoMathML = false; // show alert box if no MathML capability
46−var translateOnLoad = true; // set to false to do call translators from js
47−var translateLaTeX = true; // false to preserve $..$, $$..$$
48−var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{}
49−var translateASCIIMath = true; // false to preserve `..`
50−var translateASCIIsvg = true; // false to preserve agraph.., \begin{graph}..
51−var avoidinnerHTML = false; // set true if assigning to innerHTML gives error
52−var displaystyle = true; // puts limits above and below large operators
53−var showasciiformulaonhover = true; // helps students learn ASCIIMath
54−var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
55−var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
56−var AMdocumentId = "wikitext" // PmWiki element containing math (default=body)
57−var checkforprocessasciimathinmoodle = false; // true for systems like Moodle
58−var dsvglocation = ""; // path to d.svg (blank if same as ASCIIMathML.js loc)
59−
60−/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
61−
62−var isIE = document.createElementNS==null;
63−var noMathML = false, translated = false;
64−
65−if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
66− document.write("<object id=\"mathplayer\"\
67− classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
68− document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
69−}
70−
71−// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW)
72−function setStylesheet(s) {
73− var id = "AMMLcustomStyleSheet";
74− var n = document.getElementById(id);
75− if(document.createStyleSheet) {
76− // Test for IE's non-standard createStyleSheet method
77− if(n)
78− n.parentNode.removeChild(n);
79− // This failed without the &nbsp;
80− document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd","&nbsp;<style id='" + id + "'>" + s + "</style>");
81− } else {
82− if(n) {
83− n.replaceChild(document.createTextNode(s),n.firstChild);
84− } else {
85− n = document.createElement("style");
86− n.type = "text/css";
87− n.id = id;
88− n.appendChild(document.createTextNode(s));
89− document.getElementsByTagName("head")[0].appendChild(n);
90− }
91− }
92−}
93−
94−setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}");
95−
96−function init(){
97− var msg, warnings = new Array();
98− if (document.getElementById==null){
99− alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer");
100− return null;
101− }
102− if (checkForMathML && (msg = checkMathML())) warnings.push(msg);
103− if (checkIfSVGavailable && (msg = checkSVG())) warnings.push(msg);
104− if (warnings.length>0) displayWarnings(warnings);
105− if (!noMathML) initSymbols();
106− return true;
107−}
108−
109−function checkMathML(){
110− if (navigator.appName.slice(0,8)=="Netscape")
111− if (navigator.appVersion.slice(0,1)>="5") noMathML = null;
112− else noMathML = true;
113− else if (navigator.appName.slice(0,9)=="Microsoft")
114− try {
115− var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
116− noMathML = null;
117− } catch (e) {
118− noMathML = true;
119− }
120− else noMathML = true;
121−//noMathML = true; //uncomment to check
122− if (noMathML && notifyIfNoMathML) {
123− var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.";
124− if (alertIfNoMathML)
125− alert(msg);
126− else return msg;
127− }
128−}
129−
130−function hideWarning(){
131− var body = document.getElementsByTagName("body")[0];
132− body.removeChild(document.getElementById('AMMLwarningBox'));
133− body.onclick = null;
134−}
135−
136−function displayWarnings(warnings) {
137− var i, frag, nd = createElementXHTML("div");
138− var body = document.getElementsByTagName("body")[0];
139− body.onclick=hideWarning;
140− nd.id = 'AMMLwarningBox';
141− for (i=0; i<warnings.length; i++) {
142− frag = createElementXHTML("div");
143− frag.appendChild(document.createTextNode(warnings[i]));
144− frag.style.paddingBottom = "1.0em";
145− nd.appendChild(frag);
146− }
147− nd.appendChild(createElementXHTML("p"));
148− nd.appendChild(document.createTextNode("For instructions see the "));
149− var an = createElementXHTML("a");
150− an.appendChild(document.createTextNode("ASCIIMathML"));
151− an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");
152− nd.appendChild(an);
153− nd.appendChild(document.createTextNode(" homepage"));
154− an = createElementXHTML("div");
155− an.id = 'AMMLcloseDiv';
156− an.appendChild(document.createTextNode('(click anywhere to close this warning)'));
157− nd.appendChild(an);
158− var body = document.getElementsByTagName("body")[0];
159− body.insertBefore(nd,body.childNodes[0]);
160−}
161−
162−function translate(spanclassAM) {
163− if (!translated) { // run this only once
164− translated = true;
165− var body = document.getElementsByTagName("body")[0];
166− var processN = document.getElementById(AMdocumentId);
167− if (translateLaTeX) LMprocessNode((processN!=null?processN:body));
168− if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM);
169− }
170−}
171−
172−function createElementXHTML(t) {
173− if (isIE) return document.createElement(t);
174− else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
175−}
176−
177−function createMmlNode(t,frag) {
178− if (isIE) var node = document.createElement("m:"+t);
179− else var node = document.createElementNS("http://www.w3.org/1998/Math/MathML",t);
180− if (frag) node.appendChild(frag);
181− return node;
182−}
183−
184−// character lists for Mozilla/Netscape fonts
185−var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
186−var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
187−var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
188−
189−var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
190− RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
191− LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13,
192− MATRIX = 14;; // token types
193−
194−var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};
195−
196−var AMsymbols = [
197−//some greek symbols
198−{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},
199−{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
200−{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
201−{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
202−{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
203−{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},
204−{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
205−{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},
206−{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},
207−{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},
208−{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},
209−{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},
210−{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},
211−{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},
212−{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},
213−{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},
214−{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},
215−{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},
216−{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},
217−{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},
218−{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},
219−{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},
220−{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},
221−{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},
222−{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},
223−{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},
224−{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},
225−{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},
226−{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},
227−{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},
228−{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},
229−{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},
230−{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},
231−{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},
232−{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},
233−{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},
234−
235−//binary operation symbols
236−//{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST},
237−{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},
238−{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},
239−{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},
240−{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},
241−{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
242−{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},
243−{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},
244−{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},
245−{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},
246−{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},
247−{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},
248−{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},
249−{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},
250−{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},
251−{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},
252−{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},
253−{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},
254−{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},
255−{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},
256−{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},
257−{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},
258−
259−//binary relation symbols
260−{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},
261−{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},
262−{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},
263−{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},
264−{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},
265−{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},
266−{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
267−{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},
268−{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
269−{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},
270−{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},
271−{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},
272−{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},
273−{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},
274−{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},
275−{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},
276−{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},
277−{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},
278−{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},
279−{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},
280−{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},
281−{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},
282−
283−//logical symbols
284−{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
285−{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},
286−{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},
287−{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},
288−{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},
289−{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},
290−{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},
291−{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},
292−{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},
293−{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},
294−{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},
295−{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},
296−
297−//grouping brackets
298−{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},
299−{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},
300−{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},
301−{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},
302−{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},
303−{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},
304−{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},
305−//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},
306−{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
307−{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
308−{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},
309−{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},
310−{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},
311−{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},
312−
313−//miscellaneous symbols
314−{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
315−{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},
316−{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},
317−{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},
318−{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},
319−{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},
320−{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},
321−{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},
322−{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},
323−{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},
324−{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},
325−{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},
326−{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},
327−{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},
328−{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},
329−{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},
330−{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},
331−{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},
332−{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},
333−{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},
334−{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},
335−{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},
336−{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
337−{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},
338−{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},
339−{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},
340−{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},
341−{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},
342−{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},
343−{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},
344−{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},
345−{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},
346−{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},
347−{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},
348−
349−//standard functions
350−{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
351−{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},
352−{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
353−{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},
354−{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},
355−{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},
356−{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},
357−{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},
358−{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},
359−{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},
360−{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},
361−{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},
362−{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},
363−{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},
364−{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},
365−{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},
366−{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},
367−{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},
368−{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},
369−{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},
370−{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},
371−{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},
372−
373−//arrows
374−{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},
375−{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},
376−{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},
377−{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},
378−{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST},
379−{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST},
380−{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST},
381−{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},
382−{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},
383−{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},
384−{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
385−{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},
386−{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
387−//commands with argument
388−{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},
389−{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},
390−{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
391−{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},
392−{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
393−{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
394−{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
395−{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},
396−{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},
397−{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},
398−{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},
399−{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},
400−{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},
401−{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},
402−{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},
403−AMquote,
404−{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},
405−{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},
406−{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},
407−{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},
408−{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},
409−{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},
410−{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},
411−{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},
412−{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},
413−{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},
414−{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},
415−{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}
416−];
417−
418−function compareNames(s1,s2) {
419− if (s1.input > s2.input) return 1
420− else return -1;
421−}
422−
423−var AMnames = []; //list of input symbols
424−
425−function initSymbols() {
426− var texsymbols = [], i;
427− for (i=0; i<AMsymbols.length; i++)
428− if (AMsymbols[i].tex)
429− texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
430− tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};
431− AMsymbols = AMsymbols.concat(texsymbols);
432− refreshSymbols();
433−}
434−
435−function refreshSymbols(){
436− var i;
437− AMsymbols.sort(compareNames);
438− for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
439− LMsymbols.sort(compareNames);
440− for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input;
441−}
442−
443−function define(oldstr,newstr) {
444− if(oldstr.substr(0,1)=="\\")
445− LMsymbols = LMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
446− ttype:DEFINITION}]);
447− else
448− AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
449− tex:null, ttype:DEFINITION}]);
450− refreshSymbols(); // this may be a problem if many symbols are defined!
451−}
452−
453−function AMremoveCharsAndBlanks(str,n) {
454−//remove n characters and any following blanks
455− var st;
456− if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ")
457− st = str.slice(n+1);
458− else st = str.slice(n);
459− for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
460− return st.slice(i);
461−}
462−
463−function position(arr, str, n) {
464−// return position >=n where str appears or would be inserted
465−// assumes arr is sorted
466− if (n==0) {
467− var h,m;
468− n = -1;
469− h = arr.length;
470− while (n+1<h) {
471− m = (n+h) >> 1;
472− if (arr[m]<str) n = m; else h = m;
473− }
474− return h;
475− } else
476− for (var i=n; i<arr.length && arr[i]<str; i++);
477− return i; // i=arr.length || arr[i]>=str
478−}
479−
480−function AMgetSymbol(str) {
481−//return maximal initial substring of str that appears in names
482−//return null if there is none
483− var k = 0; //new pos
484− var j = 0; //old pos
485− var mk; //match pos
486− var st;
487− var tagst;
488− var match = "";
489− var more = true;
490− for (var i=1; i<=str.length && more; i++) {
491− st = str.slice(0,i); //initial substring of length i
492− j = k;
493− k = position(AMnames, st, j);
494− if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
495− match = AMnames[k];
496− mk = k;
497− i = match.length;
498− }
499− more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
500− }
501− AMpreviousSymbol=AMcurrentSymbol;
502− if (match!=""){
503− AMcurrentSymbol=AMsymbols[mk].ttype;
504− return AMsymbols[mk];
505− }
506−// if str[0] is a digit or - return maxsubstring of digits.digits
507− AMcurrentSymbol=CONST;
508− k = 1;
509− st = str.slice(0,1);
510− var integ = true;
511− while ("0"<=st && st<="9" && k<=str.length) {
512− st = str.slice(k,k+1);
513− k++;
514− }
515− if (st == decimalsign) {
516− st = str.slice(k,k+1);
517− if ("0"<=st && st<="9") {
518− integ = false;
519− k++;
520− while ("0"<=st && st<="9" && k<=str.length) {
521− st = str.slice(k,k+1);
522− k++;
523− }
524− }
525− }
526− if ((integ && k>1) || k>2) {
527− st = str.slice(0,k-1);
528− tagst = "mn";
529− } else {
530− k = 2;
531− st = str.slice(0,1); //take 1 character
532− tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
533− }
534− if (st=="-" && AMpreviousSymbol==INFIX) {
535− AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
536− return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
537− }
538− return {input:st, tag:tagst, output:st, ttype:CONST};
539−}
540−
541−function AMremoveBrackets(node) {
542− var st;
543− if (node.nodeName=="mrow") {
544− st = node.firstChild.firstChild.nodeValue;
545− if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
546− }
547− if (node.nodeName=="mrow") {
548− st = node.lastChild.firstChild.nodeValue;
549− if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
550− }
551−}
552−
553−/*Parsing ASCII math expressions with the following grammar
554−v ::= [A-Za-z] | greek letters | numbers | other constant symbols
555−u ::= sqrt | text | bb | other unary symbols for font commands
556−b ::= frac | root | stackrel binary symbols
557−l ::= ( | [ | { | (: | {: left brackets
558−r ::= ) | ] | } | :) | :} right brackets
559−S ::= v | lEr | uS | bSS Simple expression
560−I ::= S_S | S^S | S_S^S | S Intermediate expression
561−E ::= IE | I/I Expression
562−Each terminal symbol is translated into a corresponding mathml node.*/
563−
564−var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
565−
566−function AMparseSexpr(str) { //parses str and returns [node,tailstr]
567− var symbol, node, result, i, st,// rightvert = false,
568− newFrag = document.createDocumentFragment();
569− str = AMremoveCharsAndBlanks(str,0);
570− symbol = AMgetSymbol(str); //either a token or a bracket or empty
571− if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
572− return [null,str];
573− }
574− if (symbol.ttype == DEFINITION) {
575− str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
576− symbol = AMgetSymbol(str);
577− }
578− switch (symbol.ttype) { case UNDEROVER:
579− case CONST:
580− str = AMremoveCharsAndBlanks(str,symbol.input.length);
581− return [createMmlNode(symbol.tag, //its a constant
582− document.createTextNode(symbol.output)),str];
583− case LEFTBRACKET: //read (expr+)
584− AMnestingDepth++;
585− str = AMremoveCharsAndBlanks(str,symbol.input.length);
586− result = AMparseExpr(str,true);
587− AMnestingDepth--;
588− if (typeof symbol.invisible == "boolean" && symbol.invisible)
589− node = createMmlNode("mrow",result[0]);
590− else {
591− node = createMmlNode("mo",document.createTextNode(symbol.output));
592− node = createMmlNode("mrow",node);
593− node.appendChild(result[0]);
594− }
595− return [node,result[1]];
596− case TEXT:
597− if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
598− if (str.charAt(0)=="{") i=str.indexOf("}");
599− else if (str.charAt(0)=="(") i=str.indexOf(")");
600− else if (str.charAt(0)=="[") i=str.indexOf("]");
601− else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
602− else i = 0;
603− if (i==-1) i = str.length;
604− st = str.slice(1,i);
605− if (st.charAt(0) == " ") {
606− node = createMmlNode("mspace");
607− node.setAttribute("width","1ex");
608− newFrag.appendChild(node);
609− }
610− newFrag.appendChild(
611− createMmlNode(symbol.tag,document.createTextNode(st)));
612− if (st.charAt(st.length-1) == " ") {
613− node = createMmlNode("mspace");
614− node.setAttribute("width","1ex");
615− newFrag.appendChild(node);
616− }
617− str = AMremoveCharsAndBlanks(str,i+1);
618− return [createMmlNode("mrow",newFrag),str];
619− case UNARY:
620− str = AMremoveCharsAndBlanks(str,symbol.input.length);
621− result = AMparseSexpr(str);
622− if (result[0]==null) return [createMmlNode(symbol.tag,
623− document.createTextNode(symbol.output)),str];
624− if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
625− st = str.charAt(0);
626− if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
627− return [createMmlNode(symbol.tag,
628− document.createTextNode(symbol.output)),str];
629− } else {
630− node = createMmlNode("mrow",
631− createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
632− node.appendChild(result[0]);
633− return [node,result[1]];
634− }
635− }
636− AMremoveBrackets(result[0]);
637− if (symbol.input == "sqrt") { // sqrt
638− return [createMmlNode(symbol.tag,result[0]),result[1]];
639− } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
640− node = createMmlNode(symbol.tag,result[0]);
641− node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));
642− return [node,result[1]];
643− } else { // font change command
644− if (!isIE && typeof symbol.codes != "undefined") {
645− for (i=0; i<result[0].childNodes.length; i++)
646− if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
647− st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
648− result[0].childNodes[i].firstChild.nodeValue);
649− var newst = [];
650− for (var j=0; j<st.length; j++)
651− if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
652− String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
653− else newst = newst + st.charAt(j);
654− if (result[0].nodeName=="mi")
655− result[0]=createMmlNode("mo").
656− appendChild(document.createTextNode(newst));
657− else result[0].replaceChild(createMmlNode("mo").
658− appendChild(document.createTextNode(newst)),
659− result[0].childNodes[i]);
660− }
661− }
662− node = createMmlNode(symbol.tag,result[0]);
663− node.setAttribute(symbol.atname,symbol.atval);
664− return [node,result[1]];
665− }
666− case BINARY:
667− str = AMremoveCharsAndBlanks(str,symbol.input.length);
668− result = AMparseSexpr(str);
669− if (result[0]==null) return [createMmlNode("mo",
670− document.createTextNode(symbol.input)),str];
671− AMremoveBrackets(result[0]);
672− var result2 = AMparseSexpr(result[1]);
673− if (result2[0]==null) return [createMmlNode("mo",
674− document.createTextNode(symbol.input)),str];
675− AMremoveBrackets(result2[0]);
676− if (symbol.input=="root" || symbol.input=="stackrel")
677− newFrag.appendChild(result2[0]);
678− newFrag.appendChild(result[0]);
679− if (symbol.input=="frac") newFrag.appendChild(result2[0]);
680− return [createMmlNode(symbol.tag,newFrag),result2[1]];
681− case INFIX:
682− str = AMremoveCharsAndBlanks(str,symbol.input.length);
683− return [createMmlNode("mo",document.createTextNode(symbol.output)),str];
684− case SPACE:
685− str = AMremoveCharsAndBlanks(str,symbol.input.length);
686− node = createMmlNode("mspace");
687− node.setAttribute("width","1ex");
688− newFrag.appendChild(node);
689− newFrag.appendChild(
690− createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
691− node = createMmlNode("mspace");
692− node.setAttribute("width","1ex");
693− newFrag.appendChild(node);
694− return [createMmlNode("mrow",newFrag),str];
695− case LEFTRIGHT:
696−// if (rightvert) return [null,str]; else rightvert = true;
697− AMnestingDepth++;
698− str = AMremoveCharsAndBlanks(str,symbol.input.length);
699− result = AMparseExpr(str,false);
700− AMnestingDepth--;
701− var st = "";
702− if (result[0].lastChild!=null)
703− st = result[0].lastChild.firstChild.nodeValue;
704− if (st == "|") { // its an absolute value subterm
705− node = createMmlNode("mo",document.createTextNode(symbol.output));
706− node = createMmlNode("mrow",node);
707− node.appendChild(result[0]);
708− return [node,result[1]];
709− } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing
710− node = createMmlNode("mo",document.createTextNode("\u2223"));
711− node = createMmlNode("mrow",node);
712− return [node,str];
713− }
714− default:
715−//alert("default");
716− str = AMremoveCharsAndBlanks(str,symbol.input.length);
717− return [createMmlNode(symbol.tag, //its a constant
718− document.createTextNode(symbol.output)),str];
719− }
720−}
721−
722−function AMparseIexpr(str) {
723− var symbol, sym1, sym2, node, result, underover;
724− str = AMremoveCharsAndBlanks(str,0);
725− sym1 = AMgetSymbol(str);
726− result = AMparseSexpr(str);
727− node = result[0];
728− str = result[1];
729− symbol = AMgetSymbol(str);
730− if (symbol.ttype == INFIX && symbol.input != "/") {
731− str = AMremoveCharsAndBlanks(str,symbol.input.length);
732−// if (symbol.input == "/") result = AMparseIexpr(str); else ...
733− result = AMparseSexpr(str);
734− if (result[0] == null) // show box in place of missing argument
735− result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
736− else AMremoveBrackets(result[0]);
737− str = result[1];
738−// if (symbol.input == "/") AMremoveBrackets(node);
739− if (symbol.input == "_") {
740− sym2 = AMgetSymbol(str);
741− underover = (sym1.ttype == UNDEROVER);
742− if (sym2.input == "^") {
743− str = AMremoveCharsAndBlanks(str,sym2.input.length);
744− var res2 = AMparseSexpr(str);
745− AMremoveBrackets(res2[0]);
746− str = res2[1];
747− node = createMmlNode((underover?"munderover":"msubsup"),node);
748− node.appendChild(result[0]);
749− node.appendChild(res2[0]);
750− node = createMmlNode("mrow",node); // so sum does not stretch
751− } else {
752− node = createMmlNode((underover?"munder":"msub"),node);
753− node.appendChild(result[0]);
754− }
755− } else {
756− node = createMmlNode(symbol.tag,node);
757− node.appendChild(result[0]);
758− }
759− }
760− return [node,str];
761−}
762−
763−function AMparseExpr(str,rightbracket) {
764− var symbol, node, result, i, nodeList = [],
765− newFrag = document.createDocumentFragment();
766− do {
767− str = AMremoveCharsAndBlanks(str,0);
768− result = AMparseIexpr(str);
769− node = result[0];
770− str = result[1];
771− symbol = AMgetSymbol(str);
772− if (symbol.ttype == INFIX && symbol.input == "/") {
773− str = AMremoveCharsAndBlanks(str,symbol.input.length);
774− result = AMparseIexpr(str);
775− if (result[0] == null) // show box in place of missing argument
776− result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
777− else AMremoveBrackets(result[0]);
778− str = result[1];
779− AMremoveBrackets(node);
780− node = createMmlNode(symbol.tag,node);
781− node.appendChild(result[0]);
782− newFrag.appendChild(node);
783− symbol = AMgetSymbol(str);
784− }
785− else if (node!=undefined) newFrag.appendChild(node);
786− } while ((symbol.ttype != RIGHTBRACKET &&
787− (symbol.ttype != LEFTRIGHT || rightbracket)
788− || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
789− if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
790−// if (AMnestingDepth > 0) AMnestingDepth--;
791− var len = newFrag.childNodes.length;
792− if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
793− newFrag.childNodes[len-2].nodeName == "mo" &&
794− newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
795− var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
796− if (right==")" || right=="]") {
797− var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
798− if (left=="(" && right==")" && symbol.output != "}" ||
799− left=="[" && right=="]") {
800− var pos = []; // positions of commas
801− var matrix = true;
802− var m = newFrag.childNodes.length;
803− for (i=0; matrix && i<m; i=i+2) {
804− pos[i] = [];
805− node = newFrag.childNodes[i];
806− if (matrix) matrix = node.nodeName=="mrow" &&
807− (i==m-1 || node.nextSibling.nodeName=="mo" &&
808− node.nextSibling.firstChild.nodeValue==",")&&
809− node.firstChild.firstChild.nodeValue==left &&
810− node.lastChild.firstChild.nodeValue==right;
811− if (matrix)
812− for (var j=0; j<node.childNodes.length; j++)
813− if (node.childNodes[j].firstChild.nodeValue==",")
814− pos[i][pos[i].length]=j;
815− if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
816− }
817− if (matrix) {
818− var row, frag, n, k, table = document.createDocumentFragment();
819− for (i=0; i<m; i=i+2) {
820− row = document.createDocumentFragment();
821− frag = document.createDocumentFragment();
822− node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
823− n = node.childNodes.length;
824− k = 0;
825− node.removeChild(node.firstChild); //remove (
826− for (j=1; j<n-1; j++) {
827− if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
828− node.removeChild(node.firstChild); //remove ,
829− row.appendChild(createMmlNode("mtd",frag));
830− k++;
831− } else frag.appendChild(node.firstChild);
832− }
833− row.appendChild(createMmlNode("mtd",frag));
834− if (newFrag.childNodes.length>2) {
835− newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
836− newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
837− }
838− table.appendChild(createMmlNode("mtr",row));
839− }
840− node = createMmlNode("mtable",table);
841− if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
842− newFrag.replaceChild(node,newFrag.firstChild);
843− }
844− }
845− }
846− }
847− str = AMremoveCharsAndBlanks(str,symbol.input.length);
848− if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
849− node = createMmlNode("mo",document.createTextNode(symbol.output));
850− newFrag.appendChild(node);
851− }
852− }
853− return [newFrag,str];
854−}
855−
856−function parseMath(str,latex) {
857− var frag, node;
858− AMnestingDepth = 0;
859− frag = latex ? LMparseExpr(str.replace(/^\s+/g,""),false,false)[0] : AMparseExpr(str.replace(/^\s+/g,""),false)[0];
860− node = createMmlNode("mstyle",frag);
861− node.setAttribute("mathcolor",mathcolor);
862− node.setAttribute("fontfamily",mathfontfamily);
863− node.setAttribute("mathsize",mathfontsize);
864− if (displaystyle) node.setAttribute("displaystyle","true");
865− node = createMmlNode("math",node);
866− if (showasciiformulaonhover) //fixed by djhsu so newline
867− node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
868− return node;
869−}
870−
871−function strarr2docFrag(arr, linebreaks, latex) {
872− var newFrag=document.createDocumentFragment();
873− var expr = false;
874− for (var i=0; i<arr.length; i++) {
875− if (expr) newFrag.appendChild(parseMath(arr[i],latex));
876− else {
877− var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
878− newFrag.appendChild(createElementXHTML("span").
879− appendChild(document.createTextNode(arri[0])));
880− for (var j=1; j<arri.length; j++) {
881− newFrag.appendChild(createElementXHTML("p"));
882− newFrag.appendChild(createElementXHTML("span").
883− appendChild(document.createTextNode(arri[j])));
884− }
885− }
886− expr = !expr;
887− }
888− return newFrag;
889−}
890−
891−function AMautomathrec(str) {
892−//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space.
893−//tokens are single letters (except a, A, I) and ASCIIMathML tokens
894− var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|";
895− var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";
896− var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";
897− var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out
898− var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn?
899− var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";
900− var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;
901− var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");
902− str = str.replace(re," `$2`$7");
903− var arr = str.split(AMdelimiter1);
904− var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");
905− var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now
906− for (i=0; i<arr.length; i++) //single nonenglish tokens
907− if (i%2==0) {
908− arr[i] = arr[i].replace(re1," `$2`$3");
909− arr[i] = arr[i].replace(re2," `$2`$3");
910− arr[i] = arr[i].replace(/([{}[\]])/,"`$1`");
911− }
912− str = arr.join(AMdelimiter1);
913− str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses
914− str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses
915− str = str.replace(/\sin`/g,"` in");
916− str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");
917− str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");
918− str = str.replace(/`([0-9.]+:)`/g,"$1");
919− return str;
920−}
921−
922−function processNodeR(n, linebreaks,latex) {
923− var mtch, str, arr, frg, i;
924− if (n.childNodes.length == 0) {
925− if ((n.nodeType!=8 || linebreaks) &&
926− n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
927− n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /*&&
928− n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE"*/) {
929− str = n.nodeValue;
930− if (!(str == null)) {
931− str = str.replace(/\r\n\r\n/g,"\n\n");
932− str = str.replace(/\x20+/g," ");
933− str = str.replace(/\s*\r\n/g," ");
934− if(latex) {
935−// DELIMITERS:
936− mtch = (str.indexOf("\$")==-1 ? false : true);
937− str = str.replace(/([^\\])\$/g,"$1 \$");
938− str = str.replace(/^\$/," \$"); // in case \$ at start of string
939− arr = str.split(" \$");
940− for (i=0; i<arr.length; i++)
941− arr[i]=arr[i].replace(/\\\$/g,"\$");
942− } else {
943− mtch = false;
944− str = str.replace(new RegExp(AMescape1, "g"),
945− function(){mtch = true; return "AMescape1"});
946− str = str.replace(/\\?end{?a?math}?/i,
947− function(){automathrecognize = false; mtch = true; return ""});
948− str = str.replace(/amath\b|\\begin{a?math}/i,
949− function(){automathrecognize = true; mtch = true; return ""});
950− arr = str.split(AMdelimiter1);
951− if (automathrecognize)
952− for (i=0; i<arr.length; i++)
953− if (i%2==0) arr[i] = AMautomathrec(arr[i]);
954− str = arr.join(AMdelimiter1);
955− arr = str.split(AMdelimiter1);
956− for (i=0; i<arr.length; i++) // this is a problem ************
957− arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);
958− }
959− if (arr.length>1 || mtch) {
960− if (!noMathML) {
961− frg = strarr2docFrag(arr,n.nodeType==8,latex);
962− var len = frg.childNodes.length;
963− n.parentNode.replaceChild(frg,n);
964− return len-1;
965− } else return 0;
966− }
967− }
968− } else return 0;
969− } else if (n.nodeName!="math") {
970− for (i=0; i<n.childNodes.length; i++)
971− i += processNodeR(n.childNodes[i], linebreaks,latex);
972− }
973− return 0;
974−}
975−
976−function AMprocessNode(n, linebreaks, spanclassAM) {
977− var frag,st;
978− if (spanclassAM!=null) {
979− frag = document.getElementsByTagName("span")
980− for (var i=0;i<frag.length;i++)
981− if (frag[i].className == "AM")
982− processNodeR(frag[i],linebreaks,false);
983− } else {
984− try {
985− st = n.innerHTML; // look for AMdelimiter on page
986− } catch(err) {}
987−//alert(st)
988− if (st==null || /amath\b|\\begin{a?math}/i.test(st) ||
989− st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 ||
990− st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) {
991− processNodeR(n,linebreaks,false);
992− }
993− }
994−/* if (isIE) { //needed to match size and font of formula to surrounding text
995− frag = document.getElementsByTagName('math');
996− for (var i=0;i<frag.length;i++) frag[i].update() //What is this?
997− }*/
998−}
999−
1000−/*
1001−LaTeXMathML.js
1002−==============
1003−
1004−Version 1.1, July 20, 2007 (c) modifications by Peter Jipsen
1005−
1006−(changes: renamed global variables from AM... to LM... so that
1007−LaTeXMathML and ASCIIMathML can be used simultaneously)
1008−
1009−Previous header notice:
1010−This file (Version 1.0), is due to Douglas Woodall, June 2006.
1011−It contains JavaScript functions to convert (most simple) LaTeX
1012−math notation to Presentation MathML. It was obtained by
1013−downloading the file ASCIIMathML.js from
1014− http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/
1015−and modifying it so that it carries out ONLY those conversions
1016−that would be carried out in LaTeX. A description of the original
1017−file, with examples, can be found at
1018− www1.chapman.edu/~jipsen/mathml/asciimath.html
1019− ASCIIMathML: Math on the web for everyone
1020−
1021−Here is the header notice from the original file:
1022−
1023−ASCIIMathML.js
1024−==============
1025−This file contains JavaScript functions to convert ASCII math notation
1026−to Presentation MathML. The conversion is done while the (X)HTML page
1027−loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
1028−Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
1029−Just add the next line to your (X)HTML page with this file in the same folder:
1030−<script type="text/javascript" src="ASCIIMathML.js"></script>
1031−This is a convenient and inexpensive solution for authoring MathML.
1032−
1033−Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
1034−Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
1035−For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
1036−If you use it on a webpage, please send the URL to jipsen@chapman.edu
1037−
1038−This program is free software; you can redistribute it and/or modify
1039−it under the terms of the GNU Lesser General Public License as published by
1040−the Free Software Foundation; either version 2.1 of the License, or (at
1041−your option) any later version.
1042−
1043−This program is distributed in the hope that it will be useful,
1044−but WITHOUT ANY WARRANTY; without even the implied warranty of
1045−MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
1046−General Public License (at http://www.gnu.org/license/lgpl.html)
1047−for more details.
1048−
1049−LaTeXMathML.js (ctd)
1050−==============
1051−
1052−Content between $...$ and $$...$$ is converted by this part of the file
1053−*/
1054−
1055−// all further global variables start with "LM"
1056−
1057−// Commented out by DRW to prevent 1/2 turning into a 2-line fraction
1058−// LMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX},
1059−// Commented out by DRW so that " prints literally in equations
1060−// LMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT};
1061−
1062−var LMsymbols = [
1063−//Greek letters
1064−{input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},
1065−{input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},
1066−{input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},
1067−{input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},
1068−{input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},
1069−{input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},
1070−{input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},
1071−{input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},
1072−{input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},
1073−{input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},
1074−{input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},
1075−{input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},
1076−{input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},
1077−{input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},
1078−{input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},
1079−{input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},
1080−{input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},
1081−{input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},
1082−{input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},
1083−{input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},
1084−{input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},
1085−{input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},
1086−{input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},
1087−{input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},
1088−{input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},
1089−{input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},
1090−{input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},
1091−{input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},
1092−{input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},
1093−{input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},
1094−{input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},
1095−{input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},
1096−{input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},
1097−{input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},
1098−{input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},
1099−{input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},
1100−{input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},
1101−{input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},
1102−{input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},
1103−{input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},
1104−
1105−//fractions
1106−{input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},
1107−{input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},
1108−{input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},
1109−{input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},
1110−{input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},
1111−{input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},
1112−{input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},
1113−{input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},
1114−{input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},
1115−{input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},
1116−{input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},
1117−{input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},
1118−{input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},
1119−{input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},
1120−{input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},
1121−
1122−//binary operation symbols
1123−{input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},
1124−{input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},
1125−{input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},
1126−{input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},
1127−{input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},
1128−{input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},
1129−{input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},
1130−{input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},
1131−{input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},
1132−{input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},
1133−//{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST},
1134−{input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},
1135−{input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},
1136−{input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},
1137−{input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},
1138−{input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},
1139−{input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},
1140−{input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},
1141−{input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},
1142−{input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},
1143−{input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},
1144−{input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},
1145−{input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},
1146−{input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},
1147−{input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},
1148−{input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},
1149−{input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},
1150−{input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST},
1151−{input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},
1152−{input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},
1153−{input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},
1154−{input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},
1155−{input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},
1156−{input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},
1157−{input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},
1158−{input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},
1159−{input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},
1160−{input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},
1161−
1162−
1163−//BIG Operators
1164−{input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},
1165−{input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},
1166−{input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},
1167−{input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},
1168−{input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},
1169−{input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},
1170−{input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},
1171−{input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},
1172−{input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},
1173−{input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},
1174−{input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},
1175−{input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},
1176−{input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},
1177−{input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},
1178−{input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},
1179−
1180−//binary relation symbols
1181−{input:":=", tag:"mo", output:":=", ttype:CONST},
1182−{input:"\\lt", tag:"mo", output:"<", ttype:CONST},
1183−{input:"\\gt", tag:"mo", output:">", ttype:CONST},
1184−{input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},
1185−{input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},
1186−{input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},
1187−{input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},
1188−{input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},
1189−{input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},
1190−{input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},
1191−{input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},
1192−{input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},
1193−{input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},
1194−{input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},
1195−{input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},
1196−{input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},
1197−{input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},
1198−{input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},
1199−{input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},
1200−{input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},
1201−{input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},
1202−{input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},
1203−{input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},
1204−{input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},
1205−{input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},
1206−{input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},
1207−{input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},
1208−{input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},
1209−{input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},
1210−{input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},
1211−{input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},
1212−{input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},
1213−{input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},
1214−{input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},
1215−{input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},
1216−{input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},
1217−{input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},
1218−{input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},
1219−{input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},
1220−{input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},
1221−{input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},
1222−{input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},
1223−{input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},
1224−{input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},
1225−{input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},
1226−
1227−//matrices
1228−{input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},
1229−{input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},
1230−{input:"\\\\", output:"}&{", ttype:DEFINITION},
1231−{input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},
1232−{input:"\\end{array}", output:"}}", ttype:DEFINITION},
1233−
1234−//grouping and literal brackets -- ieval is for IE
1235−{input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},
1236−{input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},
1237−{input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},
1238−{input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},
1239−{input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},
1240−{input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},
1241−{input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},
1242−{input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},
1243−
1244−{input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},
1245−{input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
1246−{input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
1247−{input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
1248−{input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
1249−{input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},
1250−{input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},
1251−{input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},
1252−
1253−// rtag:"mi" causes space to be inserted before a following sin, cos, etc.
1254−// (see function LMparseExpr() )
1255−{input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},
1256−{input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
1257−{input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
1258−{input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
1259−{input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
1260−{input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},
1261−{input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},
1262−{input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},
1263−
1264−// "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em
1265−{input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
1266−{input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
1267−{input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
1268−{input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
1269−{input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
1270−{input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
1271−{input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},
1272−{input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},
1273−{input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},
1274−
1275−//miscellaneous symbols
1276−{input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},
1277−{input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},
1278−{input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
1279−{input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
1280−{input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},
1281−{input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},
1282−{input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},
1283−{input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},
1284−//{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width
1285−{input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},
1286−{input:"'", tag:"mo", output:"\u02B9", ttype:CONST},
1287−{input:"''", tag:"mo", output:"\u02BA", ttype:CONST},
1288−{input:"'''", tag:"mo", output:"\u2034", ttype:CONST},
1289−{input:"''''", tag:"mo", output:"\u2057", ttype:CONST},
1290−{input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},
1291−{input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},
1292−{input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},
1293−{input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},
1294−{input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},
1295−{input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},
1296−{input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},
1297−{input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},
1298−{input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},
1299−{input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},
1300−{input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},
1301−{input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},
1302−{input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},
1303−{input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},
1304−{input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},
1305−{input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},
1306−{input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},
1307−{input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},
1308−{input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},
1309−{input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},
1310−//{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST},
1311−{input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},
1312−//{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST},
1313−{input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},
1314−{input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},
1315−{input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},
1316−{input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},
1317−{input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},
1318−{input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},
1319−{input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},
1320−{input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},
1321−
1322−//standard functions
1323−//Note UNDEROVER *must* have tag:"mo" to work properly
1324−{input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},
1325−{input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},
1326−{input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},
1327−{input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},
1328−{input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},
1329−{input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},
1330−{input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},
1331−{input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},
1332−{input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},
1333−{input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},
1334−{input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},
1335−{input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?
1336−{input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},
1337−{input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?
1338−{input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},
1339−{input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},
1340−{input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},
1341−{input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},
1342−{input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},
1343−{input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},
1344−{input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},
1345−{input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},
1346−{input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},
1347−{input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},
1348−{input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},
1349−{input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},
1350−{input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},
1351−{input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},
1352−{input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},
1353−{input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},
1354−{input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},
1355−{input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},
1356−
1357−//arrows
1358−{input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},
1359−{input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},
1360−{input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},
1361−{input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},
1362−{input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},
1363−{input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},
1364−{input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},
1365−{input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},
1366−{input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},
1367−{input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},
1368−{input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},
1369−{input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},
1370−{input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},
1371−{input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},
1372−{input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},
1373−{input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},
1374−{input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},
1375−{input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},
1376−{input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},
1377−{input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},
1378−{input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},
1379−{input:"\\implies", tag:"mo", output:"\u21D2", ttype:LONG},
1380−{input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},
1381−{input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},
1382− // disaster if LONG
1383−
1384−//commands with argument
1385−
1386−{input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},
1387−{input:"\\root", tag:"mroot", output:"root", ttype:BINARY},
1388−{input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},
1389−{input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},
1390−{input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},
1391−{input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},
1392−{input:"_", tag:"msub", output:"_", ttype:INFIX},
1393−{input:"^", tag:"msup", output:"^", ttype:INFIX},
1394−{input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},
1395−{input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT},
1396−
1397−//diacritical marks
1398−{input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},
1399−//{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true},
1400−//{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true},
1401−//{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true},
1402−//{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true},
1403−{input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},
1404−{input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},
1405−{input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},
1406−{input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},
1407−{input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},
1408−//{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true},
1409−{input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},
1410−{input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},
1411−{input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},
1412−{input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},
1413−{input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},
1414−{input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},
1415−{input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},
1416−//{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true},
1417−{input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},
1418−{input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},
1419−{input:"\\overbrace", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true},
1420−{input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},
1421−{input:"\\underbrace", tag:"munder", output:"\u23B5", ttype:UNARY, acc:true},
1422−{input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},
1423−//{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true},
1424−
1425−//typestyles and fonts
1426−{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},
1427−{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},
1428−{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},
1429−{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},
1430−{input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},
1431−{input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
1432−{input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
1433−{input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
1434−{input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
1435−{input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
1436−{input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
1437−{input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},
1438−{input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb},
1439−{input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal},
1440−{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk}
1441−];
1442−
1443−var LMnames = []; //list of input symbols
1444−
1445−function LMremoveCharsAndBlanks(str,n) {
1446−//remove n characters and any following blanks
1447− var st;
1448− st = str.slice(n);
1449− for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
1450− return st.slice(i);
1451−}
1452−
1453−function LMgetSymbol(str) {
1454−//return maximal initial substring of str that appears in names
1455−//return null if there is none
1456− var k = 0; //new pos
1457− var j = 0; //old pos
1458− var mk; //match pos
1459− var st;
1460− var tagst;
1461− var match = "";
1462− var more = true;
1463− for (var i=1; i<=str.length && more; i++) {
1464− st = str.slice(0,i); //initial substring of length i
1465− j = k;
1466− k = position(LMnames, st, j);
1467− if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){
1468− match = LMnames[k];
1469− mk = k;
1470− i = match.length;
1471− }
1472− more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k];
1473− }
1474− LMpreviousSymbol=LMcurrentSymbol;
1475− if (match!=""){
1476− LMcurrentSymbol=LMsymbols[mk].ttype;
1477− return LMsymbols[mk];
1478− }
1479− LMcurrentSymbol=CONST;
1480− k = 1;
1481− st = str.slice(0,1); //take 1 character
1482− if ("0"<=st && st<="9") tagst = "mn";
1483− else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
1484−/*
1485−// Commented out by DRW (not fully understood, but probably to do with
1486−// use of "/" as an INFIX version of "\\frac", which we don't want):
1487−//}
1488−//if (st=="-" && LMpreviousSymbol==INFIX) {
1489−// LMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
1490−// return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
1491−//}
1492−*/
1493− return {input:st, tag:tagst, output:st, ttype:CONST};
1494−}
1495−
1496−
1497−/*Parsing ASCII math expressions with the following grammar
1498−v ::= [A-Za-z] | greek letters | numbers | other constant symbols
1499−u ::= sqrt | text | bb | other unary symbols for font commands
1500−b ::= frac | root | stackrel binary symbols
1501−l ::= { | \left left brackets
1502−r ::= } | \right right brackets
1503−S ::= v | lEr | uS | bSS Simple expression
1504−I ::= S_S | S^S | S_S^S | S Intermediate expression
1505−E ::= IE | I/I Expression
1506−Each terminal symbol is translated into a corresponding mathml node.*/
1507−
1508−var LMpreviousSymbol,LMcurrentSymbol;
1509−
1510−function LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]
1511− var symbol, node, result, result2, i, st,// rightvert = false,
1512− newFrag = document.createDocumentFragment();
1513− str = LMremoveCharsAndBlanks(str,0);
1514− symbol = LMgetSymbol(str); //either a token or a bracket or empty
1515− if (symbol == null || symbol.ttype == RIGHTBRACKET)
1516− return [null,str,null];
1517− if (symbol.ttype == DEFINITION) {
1518− str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);
1519− symbol = LMgetSymbol(str);
1520− if (symbol == null || symbol.ttype == RIGHTBRACKET)
1521− return [null,str,null];
1522− }
1523− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1524− switch (symbol.ttype) {
1525− case SPACE:
1526− node = createMmlNode(symbol.tag);
1527− node.setAttribute(symbol.atname,symbol.atval);
1528− return [node,str,symbol.tag];
1529− case UNDEROVER:
1530− if (isIE) {
1531− if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols
1532− str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.
1533− symbol = LMgetSymbol(str);
1534− symbol.ttype = UNDEROVER;
1535− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1536− }
1537− }
1538− return [createMmlNode(symbol.tag,
1539− document.createTextNode(symbol.output)),str,symbol.tag];
1540− case CONST:
1541− var output = symbol.output;
1542− if (isIE) {
1543− if (symbol.input == "'")
1544− output = "\u2032";
1545− else if (symbol.input == "''")
1546− output = "\u2033";
1547− else if (symbol.input == "'''")
1548− output = "\u2033\u2032";
1549− else if (symbol.input == "''''")
1550− output = "\u2033\u2033";
1551− else if (symbol.input == "\\square")
1552− output = "\u25A1"; // same as \Box
1553− else if (symbol.input.substr(0,5) == "\\frac") {
1554− // botch for missing fractions
1555− var denom = symbol.input.substr(6,1);
1556− if (denom == "5" || denom == "6") {
1557− str = symbol.input.replace(/\\frac/,"\\frac ")+str;
1558− return [node,str,symbol.tag];
1559− }
1560− }
1561− }
1562− node = createMmlNode(symbol.tag,document.createTextNode(output));
1563− return [node,str,symbol.tag];
1564− case LONG: // added by DRW
1565− node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
1566− node.setAttribute("minsize","1.5");
1567− node.setAttribute("maxsize","1.5");
1568− node = createMmlNode("mover",node);
1569− node.appendChild(createMmlNode("mspace"));
1570− return [node,str,symbol.tag];
1571− case STRETCHY: // added by DRW
1572− if (isIE && symbol.input == "\\backslash")
1573− symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"
1574− node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
1575− if (symbol.input == "|" || symbol.input == "\\vert" ||
1576− symbol.input == "\\|" || symbol.input == "\\Vert") {
1577− node.setAttribute("lspace","0em");
1578− node.setAttribute("rspace","0em");
1579− }
1580− node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here
1581− if (symbol.rtag != null)
1582− return [node,str,symbol.rtag];
1583− else
1584− return [node,str,symbol.tag];
1585− case BIG: // added by DRW
1586− var atval = symbol.atval;
1587− if (isIE)
1588− atval = symbol.ieval;
1589− symbol = LMgetSymbol(str);
1590− if (symbol == null)
1591− return [null,str,null];
1592− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1593− node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));
1594− if (isIE) { // to get brackets to expand
1595− var space = createMmlNode("mspace");
1596− space.setAttribute("height",atval+"ex");
1597− node = createMmlNode("mrow",node);
1598− node.appendChild(space);
1599− } else { // ignored in IE
1600− node.setAttribute("minsize",atval);
1601− node.setAttribute("maxsize",atval);
1602− }
1603− return [node,str,symbol.tag];
1604− case LEFTBRACKET: //read (expr+)
1605− if (symbol.input == "\\left") { // left what?
1606− symbol = LMgetSymbol(str);
1607− if (symbol != null) {
1608− if (symbol.input == ".")
1609− symbol.invisible = true;
1610− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1611− }
1612− }
1613− result = LMparseExpr(str,true,false);
1614− if (symbol==null ||
1615− (typeof symbol.invisible == "boolean" && symbol.invisible))
1616− node = createMmlNode("mrow",result[0]);
1617− else {
1618− node = createMmlNode("mo",document.createTextNode(symbol.output));
1619− node = createMmlNode("mrow",node);
1620− node.appendChild(result[0]);
1621− }
1622− return [node,result[1],result[2]];
1623− case MATRIX: //read (expr+)
1624− if (symbol.input == "\\begin{array}") {
1625− var mask = "";
1626− symbol = LMgetSymbol(str);
1627− str = LMremoveCharsAndBlanks(str,0);
1628− if (symbol == null)
1629− mask = "l";
1630− else {
1631− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1632− if (symbol.input != "{")
1633− mask = "l";
1634− else do {
1635− symbol = LMgetSymbol(str);
1636− if (symbol != null) {
1637− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1638− if (symbol.input != "}")
1639− mask = mask+symbol.input;
1640− }
1641− } while (symbol != null && symbol.input != "" && symbol.input != "}");
1642− }
1643− result = LMparseExpr("{"+str,true,true);
1644−// if (result[0]==null) return [createMmlNode("mo",
1645−// document.createTextNode(symbol.input)),str];
1646− node = createMmlNode("mtable",result[0]);
1647− mask = mask.replace(/l/g,"left ");
1648− mask = mask.replace(/r/g,"right ");
1649− mask = mask.replace(/c/g,"center ");
1650− node.setAttribute("columnalign",mask);
1651− node.setAttribute("displaystyle","false");
1652− if (isIE)
1653− return [node,result[1],null];
1654−// trying to get a *little* bit of space around the array
1655−// (IE already includes it)
1656− var lspace = createMmlNode("mspace");
1657− lspace.setAttribute("width","0.167em");
1658− var rspace = createMmlNode("mspace");
1659− rspace.setAttribute("width","0.167em");
1660− var node1 = createMmlNode("mrow",lspace);
1661− node1.appendChild(node);
1662− node1.appendChild(rspace);
1663− return [node1,result[1],null];
1664− } else { // eqnarray
1665− result = LMparseExpr("{"+str,true,true);
1666− node = createMmlNode("mtable",result[0]);
1667− if (isIE)
1668− node.setAttribute("columnspacing","0.25em"); // best in practice?
1669− else
1670− node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)
1671− node.setAttribute("columnalign","right center left");
1672− node.setAttribute("displaystyle","true");
1673− node = createMmlNode("mrow",node);
1674− return [node,result[1],null];
1675− }
1676− case TEXT:
1677− if (str.charAt(0)=="{") i=str.indexOf("}");
1678− else i = 0;
1679− if (i==-1)
1680− i = str.length;
1681− st = str.slice(1,i);
1682− if (st.charAt(0) == " ") {
1683− node = createMmlNode("mspace");
1684− node.setAttribute("width","0.33em"); // was 1ex
1685− newFrag.appendChild(node);
1686− }
1687− newFrag.appendChild(
1688− createMmlNode(symbol.tag,document.createTextNode(st)));
1689− if (st.charAt(st.length-1) == " ") {
1690− node = createMmlNode("mspace");
1691− node.setAttribute("width","0.33em"); // was 1ex
1692− newFrag.appendChild(node);
1693− }
1694− str = LMremoveCharsAndBlanks(str,i+1);
1695− return [createMmlNode("mrow",newFrag),str,null];
1696− case UNARY:
1697− result = LMparseSexpr(str);
1698− if (result[0]==null) return [createMmlNode(symbol.tag,
1699− document.createTextNode(symbol.output)),str];
1700− if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
1701− st = str.charAt(0);
1702−// if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
1703− if (st=="^" || st=="_" || st==",") {
1704− return [createMmlNode(symbol.tag,
1705− document.createTextNode(symbol.output)),str,symbol.tag];
1706− } else {
1707− node = createMmlNode("mrow",
1708− createMmlNode(symbol.tag,document.createTextNode(symbol.output)));
1709− if (isIE) {
1710− var space = createMmlNode("mspace");
1711− space.setAttribute("width","0.167em");
1712− node.appendChild(space);
1713− }
1714− node.appendChild(result[0]);
1715− return [node,result[1],symbol.tag];
1716− }
1717− }
1718− if (symbol.input == "\\sqrt") { // sqrt
1719− if (isIE) { // set minsize, for \surd
1720− var space = createMmlNode("mspace");
1721− space.setAttribute("height","1.2ex");
1722− space.setAttribute("width","0em"); // probably no effect
1723− node = createMmlNode(symbol.tag,result[0])
1724−// node.setAttribute("minsize","1"); // ignored
1725−// node = createMmlNode("mrow",node); // hopefully unnecessary
1726− node.appendChild(space);
1727− return [node,result[1],symbol.tag];
1728− } else
1729− return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];
1730− } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
1731− node = createMmlNode(symbol.tag,result[0]);
1732− var output = symbol.output;
1733− if (isIE) {
1734− if (symbol.input == "\\hat")
1735− output = "\u0302";
1736− else if (symbol.input == "\\widehat")
1737− output = "\u005E";
1738− else if (symbol.input == "\\bar")
1739− output = "\u00AF";
1740− else if (symbol.input == "\\grave")
1741− output = "\u0300";
1742− else if (symbol.input == "\\tilde")
1743− output = "\u0303";
1744− }
1745− var node1 = createMmlNode("mo",document.createTextNode(output));
1746− if (symbol.input == "\\vec" || symbol.input == "\\check")
1747− // don't allow to stretch
1748− node1.setAttribute("maxsize","1.2");
1749− // why doesn't "1" work? \vec nearly disappears in firefox
1750− if (isIE && symbol.input == "\\bar")
1751− node1.setAttribute("maxsize","0.5");
1752− if (symbol.input == "\\underbrace" || symbol.input == "\\underline")
1753− node1.setAttribute("accentunder","true");
1754− else
1755− node1.setAttribute("accent","true");
1756− node.appendChild(node1);
1757− if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")
1758− node.ttype = UNDEROVER;
1759− return [node,result[1],symbol.tag];
1760− } else { // font change or displaystyle command
1761− if (!isIE && typeof symbol.codes != "undefined") {
1762− for (i=0; i<result[0].childNodes.length; i++)
1763− if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
1764− st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
1765− result[0].childNodes[i].firstChild.nodeValue);
1766− var newst = [];
1767− for (var j=0; j<st.length; j++)
1768− if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
1769− String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
1770− else newst = newst + st.charAt(j);
1771− if (result[0].nodeName=="mi")
1772− result[0]=createMmlNode("mo").
1773− appendChild(document.createTextNode(newst));
1774− else result[0].replaceChild(createMmlNode("mo").
1775− appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
1776− }
1777− }
1778− node = createMmlNode(symbol.tag,result[0]);
1779− node.setAttribute(symbol.atname,symbol.atval);
1780− if (symbol.input == "\\scriptstyle" ||
1781− symbol.input == "\\scriptscriptstyle")
1782− node.setAttribute("displaystyle","false");
1783− return [node,result[1],symbol.tag];
1784− }
1785− case BINARY:
1786− result = LMparseSexpr(str);
1787− if (result[0]==null) return [createMmlNode("mo",
1788− document.createTextNode(symbol.input)),str,null];
1789− result2 = LMparseSexpr(result[1]);
1790− if (result2[0]==null) return [createMmlNode("mo",
1791− document.createTextNode(symbol.input)),str,null];
1792− if (symbol.input=="\\root" || symbol.input=="\\stackrel")
1793− newFrag.appendChild(result2[0]);
1794− newFrag.appendChild(result[0]);
1795− if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);
1796− return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];
1797− case INFIX:
1798− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1799− return [createMmlNode("mo",document.createTextNode(symbol.output)),
1800− str,symbol.tag];
1801− default:
1802− return [createMmlNode(symbol.tag, //its a constant
1803− document.createTextNode(symbol.output)),str,symbol.tag];
1804− }
1805−}
1806−
1807−function LMparseIexpr(str) {
1808− var symbol, sym1, sym2, node, result, tag, underover;
1809− str = LMremoveCharsAndBlanks(str,0);
1810− sym1 = LMgetSymbol(str);
1811− result = LMparseSexpr(str);
1812− node = result[0];
1813− str = result[1];
1814− tag = result[2];
1815− symbol = LMgetSymbol(str);
1816− if (symbol.ttype == INFIX) {
1817− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1818− result = LMparseSexpr(str);
1819− if (result[0] == null) // show box in place of missing argument
1820− result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));
1821− str = result[1];
1822− tag = result[2];
1823− if (symbol.input == "_" || symbol.input == "^") {
1824− sym2 = LMgetSymbol(str);
1825− tag = null; // no space between x^2 and a following sin, cos, etc.
1826−// This is for \underbrace and \overbrace
1827− underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));
1828−// underover = (sym1.ttype == UNDEROVER);
1829− if (symbol.input == "_" && sym2.input == "^") {
1830− str = LMremoveCharsAndBlanks(str,sym2.input.length);
1831− var res2 = LMparseSexpr(str);
1832− str = res2[1];
1833− tag = res2[2]; // leave space between x_1^2 and a following sin etc.
1834− node = createMmlNode((underover?"munderover":"msubsup"),node);
1835− node.appendChild(result[0]);
1836− node.appendChild(res2[0]);
1837− } else if (symbol.input == "_") {
1838− node = createMmlNode((underover?"munder":"msub"),node);
1839− node.appendChild(result[0]);
1840− } else {
1841− node = createMmlNode((underover?"mover":"msup"),node);
1842− node.appendChild(result[0]);
1843− }
1844− node = createMmlNode("mrow",node); // so sum does not stretch
1845− } else {
1846− node = createMmlNode(symbol.tag,node);
1847− if (symbol.input == "\\atop" || symbol.input == "\\choose")
1848− node.setAttribute("linethickness","0ex");
1849− node.appendChild(result[0]);
1850− if (symbol.input == "\\choose")
1851− node = createMmlNode("mfenced",node);
1852− }
1853− }
1854− return [node,str,tag];
1855−}
1856−
1857−function LMparseExpr(str,rightbracket,matrix) {
1858− var symbol, node, result, i, tag,
1859− newFrag = document.createDocumentFragment();
1860− do {
1861− str = LMremoveCharsAndBlanks(str,0);
1862− result = LMparseIexpr(str);
1863− node = result[0];
1864− str = result[1];
1865− tag = result[2];
1866− symbol = LMgetSymbol(str);
1867− if (node!=undefined) {
1868− if ((tag == "mn" || tag == "mi") && symbol!=null &&
1869− typeof symbol.func == "boolean" && symbol.func) {
1870− // Add space before \sin in 2\sin x or x\sin x
1871− var space = createMmlNode("mspace");
1872− space.setAttribute("width","0.167em");
1873− node = createMmlNode("mrow",node);
1874− node.appendChild(space);
1875− }
1876− newFrag.appendChild(node);
1877− }
1878− } while ((symbol.ttype != RIGHTBRACKET)
1879− && symbol!=null && symbol.output!="");
1880− tag = null;
1881− if (symbol.ttype == RIGHTBRACKET) {
1882− if (symbol.input == "\\right") { // right what?
1883− str = LMremoveCharsAndBlanks(str,symbol.input.length);
1884− symbol = LMgetSymbol(str);
1885− if (symbol != null && symbol.input == ".")
1886− symbol.invisible = true;
1887− if (symbol != null)
1888− tag = symbol.rtag;
1889− }
1890− if (symbol!=null)
1891− str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return
1892− var len = newFrag.childNodes.length;
1893− if (matrix &&
1894− len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
1895− newFrag.childNodes[len-2].nodeName == "mo" &&
1896− newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix
1897− var pos = []; // positions of ampersands
1898− var m = newFrag.childNodes.length;
1899− for (i=0; matrix && i<m; i=i+2) {
1900− pos[i] = [];
1901− node = newFrag.childNodes[i];
1902− for (var j=0; j<node.childNodes.length; j++)
1903− if (node.childNodes[j].firstChild.nodeValue=="&")
1904− pos[i][pos[i].length]=j;
1905− }
1906− var row, frag, n, k, table = document.createDocumentFragment();
1907− for (i=0; i<m; i=i+2) {
1908− row = document.createDocumentFragment();
1909− frag = document.createDocumentFragment();
1910− node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>
1911− n = node.childNodes.length;
1912− k = 0;
1913− for (j=0; j<n; j++) {
1914− if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
1915− node.removeChild(node.firstChild); //remove &
1916− row.appendChild(createMmlNode("mtd",frag));
1917− k++;
1918− } else frag.appendChild(node.firstChild);
1919− }
1920− row.appendChild(createMmlNode("mtd",frag));
1921− if (newFrag.childNodes.length>2) {
1922− newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>
1923− newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>
1924− }
1925− table.appendChild(createMmlNode("mtr",row));
1926− }
1927− return [table,str];
1928− }
1929− if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
1930− node = createMmlNode("mo",document.createTextNode(symbol.output));
1931− newFrag.appendChild(node);
1932− }
1933− }
1934− return [newFrag,str,tag];
1935−}
1936−
1937−var tcnt = 0, dcnt = 0; //theorem and definition counters
1938−
1939−function simpleLaTeXformatting(st) {
1940− st = st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>");
1941− st = st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});
1942− st = st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});
1943− st = st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return "<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" &#x25A1;"});
1944− st = st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");
1945− st = st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");
1946− st = st.replace(/\\cite{(.*?)}/g,"[$1]");
1947− st = st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");
1948− st = st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");
1949− st = st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");
1950− st = st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");
1951− st = st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>");
1952− st = st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>");
1953− st = st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");
1954− st = st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>");
1955− st = st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");
1956− st = st.replace(/\\begin{description}/g,"<dl>");
1957− st = st.replace(/\\end{description}/g,"</dl>");
1958− st = st.replace(/\\newline\b/g,"<br/>");
1959− st = st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");
1960− st = st.replace(/\\par\b/g,"<p>&nbsp;</p>");
1961− st = st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\">&nbsp;</p>");
1962− st = st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\">&nbsp;</p>");
1963− st = st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\">&nbsp;</p>");
1964− st = st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");
1965− return st
1966−}
1967−
1968−function ASCIIandgraphformatting(st) {
1969− st = st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3");
1970−//st = st.replace(/<\/?font.*?>/gi,""); // do this only in amath...endamath
1971− st = st.replace(/(Proof:)/g,"<i>$1</i>");
1972− st = st.replace(/QED/g,"&nbsp; &nbsp; &#x25A1;");
1973− st = st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");
1974− st = st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");
1975− st = st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");
1976− st = st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\"");
1977− st = st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return "<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"});
1978− st = st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>");
1979−//alert(dsvglocation)
1980− return st
1981−}
1982−
1983−function LMprocessNode(n) {
1984− var frag,st;
1985− try {
1986− st = n.innerHTML;
1987− } catch(err) {}
1988− var am = /amath\b|graph/i.test(st);
1989− if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 ||
1990− st.indexOf("\\begin")!=-1 || am || st.slice(-1)=="$" ||
1991− st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){
1992− if (!avoidinnerHTML && translateLaTeXformatting)
1993− st = simpleLaTeXformatting(st);
1994− if (st!=null && am && !avoidinnerHTML) {
1995− st = ASCIIandgraphformatting(st);
1996− }
1997− st = st.replace(/%7E/g,"~"); // else PmWiki has url issues
1998−//alert(st)
1999− if (!avoidinnerHTML) n.innerHTML = st;
2000− processNodeR(n,false,true);
2001− }
2002−/* if (isIE) { //needed to match size and font of formula to surrounding text
2003− frag = document.getElementsByTagName('math');
2004− for (var i=0;i<frag.length;i++) frag[i].update() //is this really needed?
2005− }*/
2006−}
2007−
2008−/* ASCIIsvg.js
2009−==============
2010−JavaScript routines to dynamically generate Scalable Vector Graphics
2011−using a mathematical xy-coordinate system (y increases upwards) and
2012−very intuitive JavaScript commands (no programming experience required).
2013−ASCIIsvg.js is good for learning math and illustrating online math texts.
2014−Works with Internet Explorer+Adobe SVGviewer and SVG enabled Mozilla/Firefox.
2015−
2016−Ver 1.2.9 July 31, 2007 (c) Peter Jipsen http://www.chapman.edu/~jipsen
2017−Latest version at http://math.chapman.edu/~jipsen/math/pub/ASCIIsvg.js
2018−If you use it on a webpage, please send the URL to jipsen@chapman.edu
2019−
2020−This program is free software; you can redistribute it and/or modify
2021−it under the terms of the GNU Lesser General Public License as published by
2022−the Free Software Foundation; either version 2.1 of the License, or (at
2023−your option) any later version.
2024−
2025−This program is distributed in the hope that it will be useful,
2026−but WITHOUT ANY WARRANTY; without even the implied warranty of
2027−MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
2028−General Public License (at http://www.gnu.org/license/lgpl.html)
2029−for more details.*/
2030−
2031−// you can change these
2032−var checkIfSVGavailable = true;
2033−var notifyIfNoSVG = true;
2034−var alertIfNoSVG = false;
2035−var noSVG = false;
2036−
2037−// global defaults used if not specified by graph (you can change these)
2038−var defaultwidth = 300; defaultheight = 200; // in pixels
2039−var defaultxmin = -5.5; defaultxmax = 5.5; // in usercoords
2040−var defaultborder = 0; border = defaultborder; // in pixel
2041−var defaultstrokewidth = "1"; // default line width in pixel
2042−var defaultstroke = "blue"; // default line color
2043−var defaultstrokeopacity = 1; // transparent = 0, solid =1
2044−var defaultstrokedasharray = null; // "10,10" gives 10px long dashes
2045−var defaultfill = "none"; // default fill color
2046−var defaultfillopacity = 1; // transparent = 0, solid =1
2047−var defaultfontstyle = "normal"; // default text shape normal|italic|inherit
2048−var defaultfontfamily = "times"; // default font times|ariel|helvetica|...
2049−var defaultfontsize = "16"; // default size (scaled automatically)
2050−var defaultfontweight = "normal";// normal|bold|bolder|lighter|100|...|900
2051−var defaultfontstroke = "none"; // default font outline color
2052−var defaultfontfill = "none"; // default font color
2053−var defaultmarker = "none"; // "dot" | "arrow" | "+" | "-" | "|"
2054−var defaultendpoints = ""; // "c-d" where c is <|o|* and d is >|o|*
2055−
2056−// global values used for all pictures (you can change these)
2057−var showcoordinates = true;
2058−var markerstrokewidth = "1";
2059−var markerstroke = "black";
2060−var markerfill = "yellow";
2061−var markersize = 4;
2062−var arrowfill = stroke;
2063−var dotradius = 4;
2064−var ticklength = 4;
2065−var axesstroke = "black";
2066−var gridstroke = "grey";
2067−var backgroundstyle = "fill-opacity:0; fill:white";
2068−var singlelettersitalic = true;
2069−
2070−// internal variables (probably no need to change these)
2071−var picturepos = null; // position of picture relative to top of HTML page
2072−var xunitlength; // in pixels, used to convert to user coordinates
2073−var yunitlength; // in pixels
2074−var origin = [0,0]; // in pixels (default is bottom left corner)
2075−var above = "above"; // shorthands (to avoid typing quotes)
2076−var below = "below";
2077−var left = "left";
2078−var right = "right";
2079−var aboveleft = "aboveleft";
2080−var aboveright = "aboveright";
2081−var belowleft = "belowleft";
2082−var belowright = "belowright";
2083−var xmin, xmax, ymin, ymax, xscl, yscl,
2084− xgrid, ygrid, xtick, ytick, initialized;
2085−var strokewidth, strokedasharray, stroke, fill, strokeopacity, fillopacity;
2086−var fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill;
2087−var marker, endpoints, dynamic = {};
2088−var picture, svgpicture, doc, width, height;
2089−var isIE = document.createElementNS==null;
2090−
2091−//this is not used! var cpi = "\u03C0", ctheta = "\u03B8"; // character for pi, theta
2092−var log = function(x) { return ln(x)/ln(10) };
2093−var pi = Math.PI, e = Math.E, ln = Math.log, sqrt = Math.sqrt;
2094−var floor = Math.floor, ceil = Math.ceil, abs = Math.abs;
2095−var sin = Math.sin, cos = Math.cos, tan = Math.tan;
2096−var arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan;
2097−var sec = function(x) { return 1/Math.cos(x) };
2098−var csc = function(x) { return 1/Math.sin(x) };
2099−var cot = function(x) { return 1/Math.tan(x) };
2100−var arcsec = function(x) { return arccos(1/x) };
2101−var arccsc = function(x) { return arcsin(1/x) };
2102−var arccot = function(x) { return arctan(1/x) };
2103−var sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };
2104−var cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };
2105−var tanh =
2106− function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };
2107−var sech = function(x) { return 1/cosh(x) };
2108−var csch = function(x) { return 1/sinh(x) };
2109−var coth = function(x) { return 1/tanh(x) };
2110−var arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };
2111−var arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };
2112−var arctanh = function(x) { return ln((1+x)/(1-x))/2 };
2113−var sech = function(x) { return 1/cosh(x) };
2114−var csch = function(x) { return 1/sinh(x) };
2115−var coth = function(x) { return 1/tanh(x) };
2116−var arcsech = function(x) { return arccosh(1/x) };
2117−var arccsch = function(x) { return arcsinh(1/x) };
2118−var arccoth = function(x) { return arctanh(1/x) };
2119−var sign = function(x) { return (x==0?0:(x<0?-1:1)) };
2120−
2121−function factorial(x,n) { // Factorial function
2122− if (n==null) n=1;
2123− if (Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)
2124− x = Math.round(x*1000000)/1000000;
2125− if (x-Math.floor(x)!=0) return NaN;
2126− for (var i=x-n; i>0; i-=n) x*=i;
2127− return (x<0?NaN:(x==0?1:x));
2128−}
2129−
2130−function C(x,k) { // Binomial coefficient function
2131− var res=1;
2132− for (var i=0; i<k; i++) res*=(x-i)/(k-i);
2133− return res;
2134−}
2135−
2136−function chop(x,n) { // Truncate decimal number to n places after decimal point
2137− if (n==null) n=0;
2138− return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);
2139−}
2140−
2141−function ran(a,b,n) { // Generate random number in [a,b] with n digits after .
2142− if (n==null) n=0;
2143− return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);
2144−}
2145−
2146−function myCreateElementSVG(t) {
2147− if (isIE) return doc.createElement(t);
2148− else return doc.createElementNS("http://www.w3.org/2000/svg",t);
2149−}
2150−
2151−function getElementsByClass(container, tagName, clsName){
2152− var list = new Array(0);
2153− var collection = container.getElementsByTagName(tagName);
2154− for(var i = 0; i < collection.length; i++)
2155− if(collection[i].className.slice(0,clsName.length)==clsName)
2156− list[list.length] = collection[i];
2157− return list;
2158−}
2159−
2160−function showobj(obj) {
2161− var st="", i;
2162− for (i in obj)
2163− st += (obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i));
2164− return st;
2165−}
2166−
2167−function findPos(obj) { // top-left corner of obj on HTML page in pixel
2168− var curleft = curtop = 0;
2169− if (obj.offsetParent) {
2170− curleft = obj.offsetLeft
2171− curtop = obj.offsetTop
2172− while (obj = obj.offsetParent) {
2173− curleft += obj.offsetLeft
2174− curtop += obj.offsetTop
2175−//alert(showobj(obj)+[curleft,curtop])
2176− }
2177− }
2178− return [curleft,curtop];
2179−}
2180−
2181−function checkSVG(){
2182− if (navigator.appName.slice(0,8)=="Netscape")
2183− if (window['SVGElement']) noSVG = null;
2184− else noSVG = true;
2185− else if (navigator.appName.slice(0,9)=="Microsoft")
2186− try {
2187− var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");
2188− noSVG = null;
2189− } catch (e) {
2190− noSVG = true;
2191− }
2192− else if (navigator.appName.slice(0,5)=="Opera") // works only for 9.50b1
2193− noSVG = null;
2194− else noSVG = true;
2195−//noSVG = true; //uncomment to check
2196− if (noSVG && notifyIfNoSVG) {
2197− var msg = "To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later."
2198− if (alertIfNoSVG)
2199− alert(msg);
2200− else return msg;
2201− }
2202−}
2203−
2204−function setText(st,id) { // add text to an existing node with given id
2205− var node = document.getElementById(id);
2206− if (node!=null)
2207− if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st;
2208− else node.appendChild(document.createTextNode(st));
2209−}
2210−
2211−function getX(evt) { // return mouse x-coord in user coordinate system
2212− var svgroot = evt.target.parentNode;
2213− pos = findPos(svgroot.parentNode);
2214− return (evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength"));
2215−}
2216−
2217−function getY(evt) { // return mouse y-coord in user coordinate system
2218− var svgroot = evt.target.parentNode;
2219− pos = findPos(svgroot.parentNode);
2220−//alert(showobj(svgroot)+svgroot.getAttribute("mytop"))
2221− return (svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength"));
2222−}
2223−
2224−function translateandeval(src) { //modify user input to JavaScript syntax
2225− var errstr;
2226− // replace plot(f(x),...) with plot("f(x)",...)
2227− src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\",");
2228− src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")");
2229−
2230− // replace (expr,expr) by [expr,expr] where expr has no (,) in it
2231− src = src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]");
2232−//alert(src)
2233− // insert * between digit and letter e.g. 2x --> 2*x
2234− src = src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2");
2235− src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
2236−
2237− try {
2238− with (Math) eval(src); // here the svgpicture object is created
2239− } catch(err) {
2240− if (err!="wait") {
2241−//alert(dsvglocation)
2242− if (typeof err=="object")
2243− errstr = err.name+" "+err.message+" "+err.number+" "+err.description;
2244− else errstr = err;
2245− alert(errstr+"\n"+src)
2246− }
2247− }
2248−}
2249−
2250−var lastSlot = 0;
2251−
2252−function drawPictures() { // main routine; called after webpage has loaded
2253− var src, id, dsvg, nd, node, ht, index, cols, arr, i, node2;
2254− var ASbody = document.getElementsByTagName("body")[0];
2255− pictures = getElementsByClass(ASbody,"embed","ASCIIsvg");
2256− var len = pictures.length;
2257− if(len==0) return;
2258− for (index = lastSlot; index < len+lastSlot; index++) {
2259− width = null; height = null;
2260− xmin = null; xmax = null; ymin = null; ymax = null;
2261− xscl = null; xgrid = null; yscl = null; ygrid = null;
2262− initialized = false;
2263− picture = pictures[index-lastSlot]; // current picture object
2264− src = picture.getAttribute("script"); // get the ASCIIsvg code
2265− if (src==null) src = "";
2266− // insert "axes()" if not present ******** experimental
2267− if (!/axes\b|initPicture/.test(src)) {
2268− var i = 0;
2269− while (/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i))) i++;
2270− src = (i==0?"axes(); "+src: src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();"));
2271− }
2272− ht = picture.getAttribute("height");
2273− if (isIE) {
2274− picture.setAttribute("wmode","transparent");
2275−//alert("*"+picture.getAttribute("src")+dsvglocation);
2276−//adding d.svg dynamically greates problems in IE...
2277−// if (picture.getAttribute("src")=="") picture.setAttribute("src",dsvglocation+"d.svg");
2278− }
2279− if (document.getElementById("picture"+(index+1)+"mml")==null) {
2280− picture.parentNode.style.position = "relative";
2281− node = createElementXHTML("div");
2282− node.style.position = "absolute";
2283− node.style.top = "0px";
2284− node.style.left = "0px";
2285− node.setAttribute("id","picture"+(index+1)+"mml");
2286− picture.parentNode.insertBefore(node,picture.nextSibling);
2287− }
2288− if (ht==null) ht ="";
2289−// if (ht!="") defaultborder = 25;
2290− if (ht=="" || src=="")
2291− if (document.getElementById("picture"+(index+1)+"input")==null) {
2292− node = createElementXHTML("textarea");
2293− arr = src.split("\n");
2294− cols = 0;
2295− for (i=0;i<arr.length;i++) cols = Math.max(cols,arr[i].length);
2296− node.setAttribute("rows",Math.min(10,arr.length)+1);
2297− node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5);
2298−// node.setAttribute("style","display:block");
2299− if (isIE) src = src.replace(/([^\r])\n/g,"$1\r");
2300− node.appendChild(document.createTextNode(src));
2301− if (src.indexOf("showcode()")==-1) node.style.display = "none";
2302− node.setAttribute("id","picture"+(index+1)+"input");
2303− picture.parentNode.insertBefore(node,picture.nextSibling);
2304− picture.parentNode.insertBefore(createElementXHTML("br"),node);
2305− node2 = createElementXHTML("button");
2306− node2.setAttribute("id","picture"+(index+1)+"button");
2307− if (isIE) node2.onclick = function() {updatePicture(this)};
2308− else node2.setAttribute("onclick","updatePicture(this)");
2309− node2.appendChild(document.createTextNode("Update"));
2310− if (src.indexOf("showcode()")==-1) node2.style.display = "none";
2311− picture.parentNode.insertBefore(node2,node);
2312−// picture.parentNode.insertBefore(document.createTextNode("ASCII"),node);
2313− picture.parentNode.insertBefore(createElementXHTML("br"),node);
2314− } else src = document.getElementById("picture"+(index+1)+"input").value;
2315− id = picture.getAttribute("id");
2316− dsvg = picture.getAttribute("src");
2317− if (id == null || id == "") {
2318− id = "picture"+(index+1);
2319− picture.setAttribute("id",id);
2320− }
2321− translateandeval(src);
2322− }
2323− lastSlot+=len;
2324−}
2325−
2326−function setdefaults() { //called before each graph is evaluated
2327− strokewidth = defaultstrokewidth;
2328− stroke = defaultstroke;
2329− strokeopacity = defaultstrokeopacity;
2330− strokedasharray = defaultstrokedasharray;
2331− fill = defaultfill;
2332− fillopacity = defaultfillopacity;
2333− fontstyle = defaultfontstyle;
2334− fontfamily = defaultfontfamily;
2335− fontsize = defaultfontsize;
2336− fontweight = defaultfontweight;
2337− fontstroke = defaultfontstroke;
2338− fontfill = defaultfontfill;
2339− marker = defaultmarker;
2340− endpoints = defaultendpoints;
2341−}
2342−
2343−function switchTo(id) { // used by dynamic code to select appropriate graph
2344− if (id==undefined) return;
2345− var name = id;
2346− if (typeof name!="string") name = id.target.parentNode.getAttribute("name");
2347− picture = document.getElementById(name);
2348− width = picture.getAttribute("width")-0;
2349− height = picture.getAttribute("height")-0;
2350− setdefaults();
2351− if ((picture.nodeName == "EMBED" || picture.nodeName == "embed") && isIE) {
2352− svgpicture = picture.getSVGDocument().getElementById("root");
2353− doc = picture.getSVGDocument();
2354− } else {
2355− svgpicture = picture;
2356− doc = document;
2357− }
2358− xunitlength = parseFloat(svgpicture.getAttribute("xunitlength"));
2359− yunitlength = parseFloat(svgpicture.getAttribute("yunitlength"));
2360− xmin = parseFloat(svgpicture.getAttribute("xmin"));
2361− xmax = parseFloat(svgpicture.getAttribute("xmax"));
2362− ymin = parseFloat(svgpicture.getAttribute("ymin"));
2363− ymax = parseFloat(svgpicture.getAttribute("ymax"));
2364− origin = [svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];
2365−}
2366−
2367−function updatePicture(obj) {
2368− var node, src, id, top, left;
2369− if (typeof obj=="object") id = obj.id.slice(0,-6);
2370− else id = (typeof obj=="string"?obj:"picture"+(obj+1));
2371− src = document.getElementById(id+"input").value;
2372− xmin = null; xmax = null; ymin = null; ymax = null;
2373− xscl = null; xgrid = null; yscl = null; ygrid = null;
2374− initialized = false;
2375− picture = document.getElementById(id);
2376− translateandeval(src)
2377−}
2378−
2379−function changepicturesize(evt,factor) {
2380− var obj = evt.target;
2381− var name = obj.parentNode.getAttribute("name");
2382− var pic = document.getElementById(name);
2383− var src = document.getElementById(name+"input").value;
2384− if (!/height/.test(src)) src = "height=0; "+src;
2385− if (!/width/.test(src)) src = "width=0; "+src;
2386− src = src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0)));
2387− src = src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0)));
2388− document.getElementById(name+"input").value = src;
2389−//alert(getKey(evt.keycode))
2390− updatePicture(name);
2391−}
2392−
2393−function zoom(evt,factor) {
2394− switchTo(evt);
2395− var obj = evt.target;
2396− var name = obj.parentNode.getAttribute("name");
2397− var pic = document.getElementById(name);
2398− var src = document.getElementById(name+"input").value;
2399− var xlen = (xmax-xmin)/2;
2400− var ylen = (ymax-ymin)/2;
2401− var xcen = getX(evt), ycen = getY(evt);
2402− if (!/ymax/.test(src)) src = "ymax=0; "+src;
2403− if (!/ymin/.test(src)) src = "ymin=0; "+src;
2404− if (!/xmax/.test(src)) src = "xmax=0; "+src;
2405− if (!/xmin/.test(src)) src = "xmin=0; "+src;
2406− src = src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen));
2407− src = src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen));
2408− src = src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen));
2409− src = src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen));
2410− document.getElementById(name+"input").value = src;
2411− updatePicture(name);
2412−}
2413−
2414−var sinceFirstClick = 0; // ondblclick simulation from
2415−var dblClkTimer; // http://www.enja.org/david/?cat=13 Thanks!
2416−function timer() {
2417− if(sinceFirstClick<60) {
2418− sinceFirstClick++;
2419− setTimeout("timer()",10);
2420− } else {
2421− clearTimeout(dblClkTimer);
2422− dblClkTimer = "";
2423− }
2424−}
2425−function mClick(evt) {
2426− if(sinceFirstClick!=0) {
2427− if(sinceFirstClick <= 40) {
2428− if (evt.shiftKey) {
2429− if (evt.altKey) changepicturesize(evt,2);
2430− else zoom(evt,.5);
2431− } else if (evt.altKey) zoom(evt,2);//changepicturesize(evt,.5);
2432− else showHideCode(evt); // do this on dblclick
2433− clearTimeout(dblClkTimer);
2434− dblClkTimer = "";
2435− } else {
2436− clearTimeout(dblClkTimer);
2437− sinceFirstClick = 0;
2438− dblClkTimer = setTimeout("timer()",10);
2439− }
2440− } else {
2441− sinceFirstClick = 0;
2442− dblClkTimer = setTimeout("timer()",10);
2443− }
2444−}
2445−
2446−function showHideCode(evt) { // called by onclick event
2447−// if (evt.getDetail()==2) {//getDetail unfortunately not in Firefox
2448− var obj=evt.target;
2449− var name = obj.parentNode.getAttribute("name");
2450− var node = document.getElementById(name+"input");
2451− node.style.display = (node.style.display == "none"?"":"none");
2452− var node = document.getElementById(name+"button");
2453− node.style.display = (node.style.display == "none"?"":"none");
2454−// }
2455−}
2456−
2457−function showcode() {} // do nothing
2458−
2459−function setBorder(x) { border = x } //deprecate
2460−
2461−function initPicture(x_min,x_max,y_min,y_max) { // set up the graph
2462−// usually called by axes() or noaxes(), but can be used directly
2463− if (!initialized) {
2464− setdefaults();
2465− initialized = true;
2466− if (x_min!=null) xmin = x_min;
2467− if (x_max!=null) xmax = x_max;
2468− if (y_min!=null) ymin = y_min;
2469− if (y_max!=null) ymax = y_max;
2470− if (xmin==null) xmin = defaultxmin;
2471− if (xmax==null) xmax = defaultxmax;
2472− if (typeof xmin != "number" || typeof xmax != "number" || xmin >= xmax)
2473− alert("Picture requires at least two numbers: xmin < xmax");
2474− else if (y_max != null && (typeof y_min != "number" ||
2475− typeof y_max != "number" || y_min >= y_max))
2476− alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");
2477− else {
2478− if (width==null) {
2479− width = picture.getAttribute("width");
2480− if (width==null || width=="") width=defaultwidth;
2481− }
2482− picture.setAttribute("width",width);
2483− if (height==null) {
2484− height = picture.getAttribute("height");
2485− if (height==null || height=="") height=defaultheight;
2486− }
2487− picture.setAttribute("height",height);
2488− xunitlength = (width-2*border)/(xmax-xmin);
2489− yunitlength = xunitlength;
2490−//alert(xmin+" "+xmax+" "+ymin+" "+ymax)
2491− if (ymin==null) {
2492− origin = [-xmin*xunitlength+border,height/2];
2493− ymin = -(height-2*border)/(2*yunitlength);
2494− ymax = -ymin;
2495− } else {
2496− if (ymax!=null) yunitlength = (height-2*border)/(ymax-ymin);
2497− else ymax = (height-2*border)/yunitlength + ymin;
2498− origin = [-xmin*xunitlength+border,-ymin*yunitlength+border];
2499− }
2500− if (isIE) {
2501− if (picture.FULLSCREEN==undefined) {
2502− setTimeout('drawPictures()',50);
2503− throw "wait";
2504− }
2505− svgpicture = picture.getSVGDocument().getElementById("root");
2506− if (svgpicture==null) {
2507− setTimeout('drawPictures()',50);
2508− throw "wait";
2509− }
2510− svgpicture = picture.getSVGDocument().getElementById("root");
2511− while (svgpicture.childNodes.length>0)
2512− svgpicture.removeChild(svgpicture.lastChild);
2513− svgpicture.setAttribute("width",width);
2514− svgpicture.setAttribute("height",height);
2515− svgpicture.setAttribute("name",picture.getAttribute("id"));
2516− doc = picture.getSVGDocument();
2517− } else {
2518− var qnode = document.createElementNS("http://www.w3.org/2000/svg","svg");
2519− qnode.setAttribute("id",picture.getAttribute("id"));
2520− qnode.setAttribute("name",picture.getAttribute("id"));
2521−// qnode.setAttribute("style","display:inline");
2522− qnode.setAttribute("width",picture.getAttribute("width"));
2523− qnode.setAttribute("height",picture.getAttribute("height"));
2524− picturepos = findPos(picture);
2525−// qnode.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
2526− if (picture.parentNode!=null) {
2527− picture.parentNode.replaceChild(qnode,picture);
2528− } else {
2529− svgpicture.parentNode.replaceChild(qnode,svgpicture);
2530− }
2531− svgpicture = qnode;
2532− doc = document;
2533− }
2534− var nd = document.getElementById(picture.getAttribute("id")+"mml");
2535− if (nd!=null) // clear out MathML layer
2536− while (nd.childNodes.length>0) nd.removeChild(nd.lastChild);
2537− svgpicture.setAttribute("xunitlength",xunitlength);
2538− svgpicture.setAttribute("yunitlength",yunitlength);
2539− svgpicture.setAttribute("xmin",xmin);
2540− svgpicture.setAttribute("xmax",xmax);
2541− svgpicture.setAttribute("ymin",ymin);
2542− svgpicture.setAttribute("ymax",ymax);
2543− svgpicture.setAttribute("ox",origin[0]);
2544− svgpicture.setAttribute("oy",origin[1]);
2545− var node = myCreateElementSVG("rect");
2546− node.setAttribute("x","0");
2547− node.setAttribute("y","0");
2548− node.setAttribute("width",width);
2549− node.setAttribute("height",height);
2550− node.setAttribute("style",backgroundstyle);
2551− svgpicture.appendChild(node);
2552− svgpicture.setAttribute("onmousemove","displayCoord(evt)");
2553− svgpicture.setAttribute("onmouseout","removeCoord(evt)");
2554− svgpicture.setAttribute("onclick","mClick(evt)");
2555− node = myCreateElementSVG("text"); // used for displayCoord
2556− node.appendChild(doc.createTextNode(" "));
2557− node.setAttribute("id","coords");
2558− svgpicture.appendChild(node);
2559− node = myCreateElementSVG("text"); // used for text display
2560− node.appendChild(doc.createTextNode(" "));
2561− node.setAttribute("id","coords");
2562− svgpicture.appendChild(node);
2563− border = defaultborder;
2564− }
2565− }
2566−}
2567−
2568−//////////////////////////user graphics commands start/////////////////////////
2569−
2570−function line(p,q,id,endpts) { // segment connecting points p,q (coordinates in units)
2571− var node;
2572− if (id!=null) node = doc.getElementById(id);
2573− if (node==null) {
2574− node = myCreateElementSVG("path");
2575− node.setAttribute("id", id);
2576− svgpicture.appendChild(node);
2577− }
2578− node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+
2579− (height-p[1]*yunitlength-origin[1])+" "+
2580− (q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));
2581− node.setAttribute("stroke-width", strokewidth);
2582− if (strokedasharray!=null)
2583− node.setAttribute("stroke-dasharray", strokedasharray);
2584− node.setAttribute("stroke", stroke);
2585− node.setAttribute("fill", fill);
2586− node.setAttribute("stroke-opacity", strokeopacity);
2587− node.setAttribute("fill-opacity", fillopacity);
2588− if (marker=="dot" || marker=="arrowdot") {
2589− ASdot(p,markersize,markerstroke,markerfill);
2590− if (marker=="arrowdot") arrowhead(p,q);
2591− ASdot(q,markersize,markerstroke,markerfill);
2592− } else if (marker=="arrow") arrowhead(p,q);
2593− if (endpts==null && endpoints!="") endpts = endpoints;
2594− if (endpts!=null) {
2595− if (endpts.indexOf("<-") != -1) arrowhead(q,p);
2596− if (endpts.indexOf("o-") != -1) dot(p, "open");
2597− if (endpts.indexOf("*-") != -1) dot(p, "closed");
2598− if (endpts.indexOf("->") != -1) arrowhead(p,q);
2599− if (endpts.indexOf("-o") != -1) dot(q, "open");
2600− if (endpts.indexOf("-*") != -1) dot(q, "closed");
2601− }
2602−}
2603−
2604−function path(plist,id,c,endpts) {
2605− if (c==null) c="";
2606− var node, st, i;
2607− if (id!=null) node = doc.getElementById(id);
2608− if (node==null) {
2609− node = myCreateElementSVG("path");
2610− node.setAttribute("id", id);
2611− svgpicture.appendChild(node);
2612− }
2613− if (typeof plist == "string") st = plist;
2614− else {
2615− st = "M";
2616− st += (plist[0][0]*xunitlength+origin[0])+","+
2617− (height-plist[0][1]*yunitlength-origin[1])+" "+c;
2618− for (i=1; i<plist.length; i++)
2619− st += (plist[i][0]*xunitlength+origin[0])+","+
2620− (height-plist[i][1]*yunitlength-origin[1])+" ";
2621− }
2622− node.setAttribute("d", st);
2623− node.setAttribute("stroke-width", strokewidth);
2624− if (strokedasharray!=null)
2625− node.setAttribute("stroke-dasharray", strokedasharray);
2626− node.setAttribute("stroke", stroke);
2627− node.setAttribute("fill", fill);
2628− node.setAttribute("stroke-opacity", strokeopacity);
2629− node.setAttribute("fill-opacity", fillopacity);
2630− if (marker=="dot" || marker=="arrowdot")
2631− for (i=0; i<plist.length; i++)
2632− if (c!="C" && c!="T" || i!=1 && i!=2)
2633− ASdot(plist[i],markersize,markerstroke,markerfill);
2634− if (endpts==null && endpoints!="") endpts = endpoints;
2635− if (endpts!=null) {
2636− if (endpts.indexOf("<-") != -1) arrowhead(plist[1],plist[0]);
2637− if (endpts.indexOf("o-") != -1) dot(plist[0], "open");
2638− if (endpts.indexOf("*-") != -1) dot(plist[0], "closed");
2639− if (endpts.indexOf("->") != -1) arrowhead(plist[plist.length-2],plist[plist.length-1]);
2640− if (endpts.indexOf("-o") != -1) dot(plist[plist.length-1], "open");
2641− if (endpts.indexOf("-*") != -1) dot(plist[plist.length-1], "closed");
2642− }
2643−}
2644−
2645−function curve(plist,id,endpts) {
2646− path(plist,id,"T",endpts);
2647−}
2648−
2649−function vector(p,q,id) {
2650− line(p,q,id,"","->");
2651−}
2652−
2653−function circle(center,radius,id) { // coordinates in units
2654− var node;
2655− if (id!=null) node = doc.getElementById(id);
2656− if (node==null) {
2657− node = myCreateElementSVG("circle");
2658− node.setAttribute("id", id);
2659− svgpicture.appendChild(node);
2660− }
2661− node.setAttribute("cx",center[0]*xunitlength+origin[0]);
2662− node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
2663− node.setAttribute("r",radius*xunitlength);
2664− node.setAttribute("stroke-width", strokewidth);
2665− node.setAttribute("stroke", stroke);
2666− node.setAttribute("fill", fill);
2667− node.setAttribute("stroke-opacity", strokeopacity);
2668− node.setAttribute("fill-opacity", fillopacity);
2669−}
2670−
2671−function loop(p,d,id) {
2672−// d is a direction vector e.g. [1,0] means loop starts in that direction
2673− if (d==null) d=[1,0];
2674− path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");
2675− if (marker=="arrow" || marker=="arrowdot")
2676− arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],
2677− p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);
2678−}
2679−
2680−function arc(start,end,radius,id,largearc) { // coordinates in units
2681− var node, v;
2682−//alert([fill, stroke, origin, xunitlength, yunitlength, height])
2683− if (id!=null) node = doc.getElementById(id);
2684− if (largearc==null) largearc=0;
2685− if (radius==null) {
2686− v=[end[0]-start[0],end[1]-start[1]];
2687− radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);
2688− }
2689− if (node==null) {
2690− node = myCreateElementSVG("path");
2691− node.setAttribute("id", id);
2692− svgpicture.appendChild(node);
2693− }
2694− node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+
2695− (height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+
2696− radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+
2697− (height-end[1]*yunitlength-origin[1]));
2698− node.setAttribute("stroke-width", strokewidth);
2699− node.setAttribute("stroke", stroke);
2700− node.setAttribute("fill", fill);
2701− node.setAttribute("stroke-opacity", strokeopacity);
2702− node.setAttribute("fill-opacity", fillopacity);
2703− if (marker=="arrow" || marker=="arrowdot") {
2704− u = [(end[1]-start[1])/4,(start[0]-end[0])/4];
2705− v = [(end[0]-start[0])/2,(end[1]-start[1])/2];
2706−//alert([u,v])
2707− v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];
2708− } else v=[start[0],start[1]];
2709− if (marker=="dot" || marker=="arrowdot") {
2710− ASdot(start,markersize,markerstroke,markerfill);
2711− if (marker=="arrowdot") arrowhead(v,end);
2712− ASdot(end,markersize,markerstroke,markerfill);
2713− } else if (marker=="arrow") arrowhead(v,end);
2714−}
2715−
2716−function sector(center,start,end,id) { // center,start,end should be isoceles
2717− var rx = start[0]-center[0], ry = start[1]-center[1];
2718− arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc");
2719− path([end,center,start],id+"path");
2720−}
2721−
2722−function ellipse(center,rx,ry,id) { // coordinates in units
2723− var node;
2724− if (id!=null) node = doc.getElementById(id);
2725− if (node==null) {
2726− node = myCreateElementSVG("ellipse");
2727− node.setAttribute("id", id);
2728− svgpicture.appendChild(node);
2729− }
2730− node.setAttribute("cx",center[0]*xunitlength+origin[0]);
2731− node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
2732− node.setAttribute("rx",rx*xunitlength);
2733− node.setAttribute("ry",ry*yunitlength);
2734− node.setAttribute("stroke-width", strokewidth);
2735− node.setAttribute("stroke", stroke);
2736− node.setAttribute("fill", fill);
2737− node.setAttribute("stroke-opacity", strokeopacity);
2738− node.setAttribute("fill-opacity", fillopacity);
2739−}
2740−
2741−function triangle(p,q,r,id) {
2742− path([p,q,r,p],id)
2743−}
2744−
2745−function rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii
2746− var node;
2747− if (id!=null) node = doc.getElementById(id);
2748− if (node==null) {
2749− node = myCreateElementSVG("rect");
2750− node.setAttribute("id", id);
2751− svgpicture.appendChild(node);
2752− }
2753− node.setAttribute("x",p[0]*xunitlength+origin[0]);
2754− node.setAttribute("y",height-q[1]*yunitlength-origin[1]);
2755− node.setAttribute("width",(q[0]-p[0])*xunitlength);
2756− node.setAttribute("height",(q[1]-p[1])*yunitlength);
2757− if (rx!=null) node.setAttribute("rx",rx*xunitlength);
2758− if (ry!=null) node.setAttribute("ry",ry*yunitlength);
2759− node.setAttribute("stroke-width", strokewidth);
2760− node.setAttribute("stroke", stroke);
2761− node.setAttribute("fill", fill);
2762− node.setAttribute("stroke-opacity", strokeopacity);
2763− node.setAttribute("fill-opacity", fillopacity);
2764−}
2765−
2766−function text(p,st,pos,id,fontsty) {
2767− var dnode, node, dx = 0, dy = fontsize/3, str = st.toString();
2768− if (/(`|\$)/.test(str)) { // layer for ASCIIMathML and LaTeXMathML
2769− dnode = document.getElementById(svgpicture.getAttribute("name")+"mml");
2770− if (dnode!=null) {
2771− if (id!=null) node = document.getElementById(id);
2772− if (node==null) {
2773−//alert(dnode.childNodes.length)
2774− node = createElementXHTML("div");
2775− node.setAttribute("id", id);
2776− node.style.position = "absolute";
2777− dnode.appendChild(node);
2778− }
2779− while (node.childNodes.length>0) node.removeChild(node.lastChild);
2780− node.appendChild(document.createTextNode(str));
2781− if (/`/.test(str)) AMprocessNode(node); else LMprocessNode(node);
2782− dx = -node.offsetWidth/2;
2783− dy = -node.offsetHeight/2;
2784− if (pos!=null) {
2785− if (/above/.test(pos)) dy = -node.offsetHeight;
2786− if (/below/.test(pos)) dy = 0;
2787− if (/right/.test(pos)) dx = 0;
2788− if ( /left/.test(pos)) dx = -node.offsetWidth;
2789− }
2790− node.style.left = ""+(p[0]*xunitlength+origin[0]+dx)+"px";
2791− node.style.top = ""+(height-p[1]*yunitlength-origin[1]+dy)+"px";
2792− }
2793− return p;
2794− }
2795− var textanchor = "middle"; // regular text goes into SVG
2796− if (pos!=null) {
2797− if (/above/.test(pos)) dy = -fontsize/2;
2798− if (/below/.test(pos)) dy = fontsize-0;
2799− if (/right/.test(pos)) {textanchor = "start"; dx = fontsize/4;}
2800− if ( /left/.test(pos)) {textanchor = "end"; dx = -fontsize/4;}
2801− }
2802− if (id!=null) node = doc.getElementById(id);
2803− if (node==null) {
2804− node = myCreateElementSVG("text");
2805− node.setAttribute("id", id);
2806− svgpicture.appendChild(node);
2807− node.appendChild(doc.createTextNode(str));
2808− }
2809− while (node.childNodes.length>1) node.removeChild(node.lastChild);
2810− node.lastChild.nodeValue = "\xA0"+str+"\xA0";
2811− node.setAttribute("x",p[0]*xunitlength+origin[0]+dx);
2812− node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy);
2813− node.setAttribute("font-style",(fontsty!=null?fontsty:
2814− (str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle)));
2815− node.setAttribute("font-family",fontfamily);
2816− node.setAttribute("font-size",fontsize);
2817− node.setAttribute("font-weight",fontweight);
2818− node.setAttribute("text-anchor",textanchor);
2819− if (fontstroke!="none") node.setAttribute("stroke",fontstroke);
2820− if (fontfill!="none") node.setAttribute("fill",fontfill);
2821− return p;
2822−}
2823−
2824−function mtext(p,st,pos,fontsty,fontsz) { // method for updating text on an svg
2825−// "this" is the text object or the svgpicture object
2826− var textanchor = "middle";
2827− var dx = 0; var dy = fontsize/3;
2828− if (pos!=null) {
2829− if (pos.slice(0,5)=="above") dy = -fontsize/2;
2830− if (pos.slice(0,5)=="below") dy = fontsize-0;
2831− if (pos.slice(0,5)=="right" || pos.slice(5,10)=="right") {
2832− textanchor = "start";
2833− dx = fontsize/2;
2834− }
2835− if (pos.slice(0,4)=="left" || pos.slice(5,9)=="left") {
2836− textanchor = "end";
2837− dx = -fontsize/2;
2838− }
2839− }
2840− var node = this;
2841− if (this.nodeName=="svg") {
2842− node = myCreateElementSVG("text");
2843− this.appendChild(node);
2844− node.appendChild(doc.createTextNode(st));
2845− }
2846− node.lastChild.nodeValue = st;
2847− node.setAttribute("x",p[0]+dx);
2848− node.setAttribute("y",p[1]+dy);
2849− node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));
2850− node.setAttribute("font-family",fontfamily);
2851− node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize));
2852− node.setAttribute("font-weight",fontweight);
2853− node.setAttribute("text-anchor",textanchor);
2854− if (fontstroke!="none") node.setAttribute("stroke",fontstroke);
2855− if (fontfill!="none") node.setAttribute("fill",fontfill);
2856−}
2857−
2858−function image(imgurl,p,w,h,id) { // not working yet
2859− var node;
2860− if (id!=null) node = doc.getElementById(id);
2861− if (node==null) {
2862− node = myCreateElementSVG("image");
2863− node.setAttribute("id", id);
2864− svgpicture.appendChild(node);
2865− }
2866− node.setAttribute("x",p[0]*xunitlength+origin[0]);
2867− node.setAttribute("y",height-p[1]*yunitlength-origin[1]);
2868− node.setAttribute("width",w);
2869− node.setAttribute("height",h);
2870− node.setAttribute("xlink:href", imgurl);
2871−}
2872−
2873−function ASdot(center,radius,s,f) { // coordinates in units, radius in pixel
2874− if (s==null) s = stroke; if (f==null) f = fill;
2875− var node = myCreateElementSVG("circle");
2876− node.setAttribute("cx",center[0]*xunitlength+origin[0]);
2877− node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
2878− node.setAttribute("r",radius);
2879− node.setAttribute("stroke-width", strokewidth);
2880− node.setAttribute("stroke", s);
2881− node.setAttribute("fill", f);
2882− svgpicture.appendChild(node);
2883−}
2884−
2885−function dot(center, typ, label, pos, id) {
2886− var node;
2887− var cx = center[0]*xunitlength+origin[0];
2888− var cy = height-center[1]*yunitlength-origin[1];
2889− if (id!=null) node = doc.getElementById(id);
2890− if (typ=="+" || typ=="-" || typ=="|") {
2891− if (node==null) {
2892− node = myCreateElementSVG("path");
2893− node.setAttribute("id", id);
2894− svgpicture.appendChild(node);
2895− }
2896− if (typ=="+") {
2897− node.setAttribute("d",
2898− " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+
2899− " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));
2900− node.setAttribute("stroke-width", .5);
2901− node.setAttribute("stroke", axesstroke);
2902− } else {
2903− if (typ=="-") node.setAttribute("d",
2904− " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);
2905− else node.setAttribute("d",
2906− " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));
2907− node.setAttribute("stroke-width", strokewidth);
2908− node.setAttribute("stroke", stroke);
2909− }
2910− } else {
2911− if (node==null) {
2912− node = myCreateElementSVG("circle");
2913− node.setAttribute("id", id);
2914− svgpicture.appendChild(node);
2915− }
2916− node.setAttribute("cx",cx);
2917− node.setAttribute("cy",cy);
2918− node.setAttribute("r",dotradius);
2919− node.setAttribute("stroke-width", strokewidth);
2920− node.setAttribute("stroke", stroke);
2921− node.setAttribute("fill", (typ=="open"?"white":
2922− (typ=="closed"?stroke:markerfill)));
2923− }
2924− if (label!=null)
2925− text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))
2926−}
2927−
2928−point = dot; //alternative name
2929−
2930−function arrowhead(p,q) { // draw arrowhead at q (in units) add size param
2931− var up;
2932− var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];
2933− var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];
2934− var u = [w[0]-v[0],w[1]-v[1]];
2935− var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);
2936− if (d > 0.00000001) {
2937− u = [u[0]/d, u[1]/d];
2938− up = [-u[1],u[0]];
2939− var node = myCreateElementSVG("path");
2940− node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+
2941− (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+
2942− (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");
2943− node.setAttribute("stroke-width", markerstrokewidth);
2944− node.setAttribute("stroke", stroke); /*was markerstroke*/
2945− node.setAttribute("fill", stroke); /*was arrowfill*/
2946− node.setAttribute("stroke-opacity", strokeopacity);
2947− node.setAttribute("fill-opacity", fillopacity);
2948− svgpicture.appendChild(node);
2949− }
2950−}
2951−
2952−function chopZ(st) {
2953− var k = st.indexOf(".");
2954− if (k==-1) return st;
2955− for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--);
2956− if (i==k) i--;
2957− return st.slice(0,i+1);
2958−}
2959−
2960−function grid(dx,dy) { // for backward compatibility
2961− axes(dx,dy,null,dx,dy)
2962−}
2963−
2964−function noaxes() {
2965− if (!initialized) initPicture();
2966−}
2967−
2968−function axes(dx,dy,labels,gdx,gdy) {
2969−//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;
2970− var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;
2971− if (!initialized) initPicture();
2972− if (typeof dx=="string") { labels = dx; dx = null; }
2973− if (typeof dy=="string") { gdx = dy; dy = null; }
2974− if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx}
2975− if (yscl!=null) {dy = yscl; gdy = yscl}
2976− if (xtick!=null) {dx = xtick}
2977− if (ytick!=null) {dy = ytick}
2978− dx = (dx==null?xunitlength:dx*xunitlength);
2979− dy = (dy==null?dx:dy*yunitlength);
2980− fontsize = Math.min(dx/2,dy/2,16); //alert(fontsize)
2981− ticklength = fontsize/4;
2982− if (xgrid!=null) gdx = xgrid;
2983− if (ygrid!=null) gdy = ygrid;
2984− if (gdx!=null) {
2985− gdx = (typeof gdx=="string"?dx:gdx*xunitlength);
2986− gdy = (gdy==null?dy:gdy*yunitlength);
2987− pnode = myCreateElementSVG("path");
2988− st="";
2989− for (x = origin[0]; x<width; x = x+gdx)
2990− st += " M"+x+",0"+" "+x+","+height;
2991− for (x = origin[0]-gdx; x>0; x = x-gdx)
2992− st += " M"+x+",0"+" "+x+","+height;
2993− for (y = height-origin[1]; y<height; y = y+gdy)
2994− st += " M0,"+y+" "+width+","+y;
2995− for (y = height-origin[1]-gdy; y>0; y = y-gdy)
2996− st += " M0,"+y+" "+width+","+y;
2997− pnode.setAttribute("d",st);
2998− pnode.setAttribute("stroke-width", .5);
2999− pnode.setAttribute("stroke", gridstroke);
3000− pnode.setAttribute("fill", fill);
3001− svgpicture.appendChild(pnode);
3002− }
3003− pnode = myCreateElementSVG("path");
3004− st="M0,"+(height-origin[1])+" "+width+","+
3005− (height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height;
3006− for (x = origin[0]+dx; x<width; x = x+dx)
3007− st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
3008− (height-origin[1]-ticklength);
3009− for (x = origin[0]-dx; x>0; x = x-dx)
3010− st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
3011− (height-origin[1]-ticklength);
3012− for (y = height-origin[1]+dy; y<height; y = y+dy)
3013− st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;
3014− for (y = height-origin[1]-dy; y>0; y = y-dy)
3015− st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;
3016− if (labels!=null) with (Math) {
3017− ldx = dx/xunitlength;
3018− ldy = dy/yunitlength;
3019− lx = (xmin>0 || xmax<0?xmin:0);
3020− ly = (ymin>0 || ymax<0?ymin:0);
3021− lxp = (ly==0?"below":"above");
3022− lyp = (lx==0?"left":"right");
3023− var ddx = floor(1.1-log(ldx)/log(10))+1;
3024− var ddy = floor(1.1-log(ldy)/log(10))+1;
3025− for (x = ldx; x<=xmax; x = x+ldx)
3026− text([x,ly],chopZ(x.toFixed(ddx)),lxp);
3027− for (x = -ldx; xmin<=x; x = x-ldx)
3028− text([x,ly],chopZ(x.toFixed(ddx)),lxp);
3029− for (y = ldy; y<=ymax; y = y+ldy)
3030− text([lx,y],chopZ(y.toFixed(ddy)),lyp);
3031− for (y = -ldy; ymin<=y; y = y-ldy)
3032− text([lx,y],chopZ(y.toFixed(ddy)),lyp);
3033− }
3034− fontsize = defaultfontsize;
3035− pnode.setAttribute("d",st);
3036− pnode.setAttribute("stroke-width", .5);
3037− pnode.setAttribute("stroke", axesstroke);
3038− pnode.setAttribute("fill", fill);
3039− pnode.setAttribute("stroke-opacity", strokeopacity);
3040− pnode.setAttribute("fill-opacity", fillopacity);
3041− svgpicture.appendChild(pnode);
3042−}
3043−
3044−function mathjs(st) {
3045− //translate a math formula to js function notation
3046− // a^b --> pow(a,b)
3047− // na --> n*a
3048− // (...)d --> (...)*d
3049− // n! --> factorial(n)
3050− // sin^-1 --> arcsin etc.
3051− //while ^ in string, find term on left and right
3052− //slice and concat new formula string
3053− st = st.replace(/\s/g,"");
3054− if (st.indexOf("^-1")!=-1) {
3055− st = st.replace(/sin\^-1/g,"arcsin");
3056− st = st.replace(/cos\^-1/g,"arccos");
3057− st = st.replace(/tan\^-1/g,"arctan");
3058− st = st.replace(/sec\^-1/g,"arcsec");
3059− st = st.replace(/csc\^-1/g,"arccsc");
3060− st = st.replace(/cot\^-1/g,"arccot");
3061− st = st.replace(/sinh\^-1/g,"arcsinh");
3062− st = st.replace(/cosh\^-1/g,"arccosh");
3063− st = st.replace(/tanh\^-1/g,"arctanh");
3064− st = st.replace(/sech\^-1/g,"arcsech");
3065− st = st.replace(/csch\^-1/g,"arccsch");
3066− st = st.replace(/coth\^-1/g,"arccoth");
3067− }
3068− st = st.replace(/^e$/g,"(Math.E)");
3069− st = st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1");
3070− st = st.replace(/([^a-zA-Z])e/g,"$1(Math.E)");
3071−// st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(Math.E)$2");
3072− st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");
3073− st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
3074− var i,j,k, ch, nested;
3075− while ((i=st.indexOf("^"))!=-1) {
3076− //find left argument
3077− if (i==0) return "Error: missing argument";
3078− j = i-1;
3079− ch = st.charAt(j);
3080− if (ch>="0" && ch<="9") {// look for (decimal) number
3081− j--;
3082− while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
3083− if (ch==".") {
3084− j--;
3085− while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
3086− }
3087− } else if (ch==")") {// look for matching opening bracket and function name
3088− nested = 1;
3089− j--;
3090− while (j>=0 && nested>0) {
3091− ch = st.charAt(j);
3092− if (ch=="(") nested--;
3093− else if (ch==")") nested++;
3094− j--;
3095− }
3096− while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
3097− j--;
3098− } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
3099− j--;
3100− while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
3101− j--;
3102− } else {
3103− return "Error: incorrect syntax in "+st+" at position "+j;
3104− }
3105− //find right argument
3106− if (i==st.length-1) return "Error: missing argument";
3107− k = i+1;
3108− ch = st.charAt(k);
3109− if (ch>="0" && ch<="9" || ch=="-") {// look for signed (decimal) number
3110− k++;
3111− while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
3112− if (ch==".") {
3113− k++;
3114− while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
3115− }
3116− } else if (ch=="(") {// look for matching closing bracket and function name
3117− nested = 1;
3118− k++;
3119− while (k<st.length && nested>0) {
3120− ch = st.charAt(k);
3121− if (ch=="(") nested++;
3122− else if (ch==")") nested--;
3123− k++;
3124− }
3125− } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
3126− k++;
3127− while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" ||
3128− ch>="A" && ch<="Z") k++;
3129− } else {
3130− return "Error: incorrect syntax in "+st+" at position "+k;
3131− }
3132− st = st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+
3133− st.slice(k);
3134− }
3135− while ((i=st.indexOf("!"))!=-1) {
3136− //find left argument
3137− if (i==0) return "Error: missing argument";
3138− j = i-1;
3139− ch = st.charAt(j);
3140− if (ch>="0" && ch<="9") {// look for (decimal) number
3141− j--;
3142− while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
3143− if (ch==".") {
3144− j--;
3145− while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
3146− }
3147− } else if (ch==")") {// look for matching opening bracket and function name
3148− nested = 1;
3149− j--;
3150− while (j>=0 && nested>0) {
3151− ch = st.charAt(j);
3152− if (ch=="(") nested--;
3153− else if (ch==")") nested++;
3154− j--;
3155− }
3156− while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
3157− j--;
3158− } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
3159− j--;
3160− while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
3161− j--;
3162− } else {
3163− return "Error: incorrect syntax in "+st+" at position "+j;
3164− }
3165− st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);
3166− }
3167− return st;
3168−}
3169−
3170−function plot(fun,x_min,x_max,points,id,endpts) {
3171− var pth = [];
3172− var f = function(x) { return x }, g = fun;
3173− var name = null;
3174− if (typeof fun=="string")
3175− eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");
3176− else if (typeof fun=="object") {
3177− eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");
3178− eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");
3179− }
3180− if (typeof x_min=="string") { name = x_min; x_min = xmin }
3181− else name = id;
3182− var min = (x_min==null?xmin:x_min);
3183− var max = (x_max==null?xmax:x_max);
3184− var inc = max-min-0.000001*(max-min);
3185− inc = (points==null?inc/200:inc/points);
3186− var gt;
3187−//alert(typeof g(min))
3188− for (var t = min; t <= max; t += inc) {
3189− gt = g(t);
3190− if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt];
3191− }
3192− path(pth,name,null,endpts);
3193− return pth;
3194−}
3195−
3196−// make polar plot
3197−
3198−// make Riemann sums
3199−
3200−function slopefield(fun,dx,dy) {
3201− var g = fun;
3202− if (typeof fun=="string")
3203− eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");
3204− var gxy,x,y,u,v,dz;
3205− if (dx==null) dx=1;
3206− if (dy==null) dy=1;
3207− dz = Math.sqrt(dx*dx+dy*dy)/6;
3208− var x_min = Math.ceil(xmin/dx);
3209− var y_min = Math.ceil(ymin/dy);
3210− for (x = x_min; x <= xmax; x += dx)
3211− for (y = y_min; y <= ymax; y += dy) {
3212− gxy = g(x,y);
3213− if (!isNaN(gxy)) {
3214− if (Math.abs(gxy)=="Infinity") {u = 0; v = dz;}
3215− else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;}
3216− line([x-u,y-v],[x+u,y+v]);
3217− }
3218− }
3219−}
3220−
3221−///////////////////////user graphics commands end here/////////////////////////
3222−
3223−function show_props(obj) {
3224− var result = "";
3225− for (var i=0; i< obj.childNodes.length; i++)
3226− result += obj.childNodes.item(i) + "\n";
3227− return result;
3228−}
3229−
3230−function displayCoord(evt) {
3231− if (showcoordinates) {
3232− var svgroot = evt.target.parentNode;
3233− var nl = svgroot.childNodes;
3234− for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);
3235− var cnode = nl.item(i);
3236− cnode.mtext = mtext;
3237− cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")", "left", "", "11");
3238−/* var dnode = nl.item(i+1);
3239− dnode.mtext = mtext;
3240− dnode.mtext([0,svgroot.getAttribute("height")-6],"Try (shift/alt)-dblclick", "right", "", "8");
3241−*/ }
3242−}
3243−
3244−function removeCoord(evt) {
3245− var svgroot = evt.target.parentNode;
3246− var nl = svgroot.childNodes;
3247− for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);
3248− var cnode = nl.item(i);
3249− cnode.mtext = mtext;
3250− cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"", "aboveleft", "");
3251−/* var dnode = nl.item(i+1);
3252− dnode.mtext = mtext;
3253− dnode.mtext([0,svgroot.getAttribute("height")-0],"", "aboveright", "");
3254−*/}
3255−
3256−function initASCIIMathCalculators(li) {
3257− var i;
3258− for (i=0; i<li.length; i++) {
3259− li[i].innerHTML = calcstr;
3260− AMprocessNode(li[i]);
3261− }
3262− li = document.getElementsByTagName("textarea");
3263− var st;
3264− for (i=0; i<li.length; i++) {
3265− st = li[i].getAttribute("onkeyup");
3266− if (st!=null) eval(String(st).replace(/function anonymous\(\)/,""));
3267− }
3268−}
3269−
3270−function calculate(inputId,outputId) {
3271− var str = document.getElementById(inputId).value;
3272− var err = "";
3273− var ind = str.lastIndexOf("\n");
3274− if (ind==str.length-1) str = str.slice(0,ind);
3275− str = str.slice(str.lastIndexOf("\n")+1);
3276− try {
3277− var res = eval(mathjs(str));
3278− } catch(e) {
3279− err = "syntax incomplete";
3280− }
3281− if (!isNaN(res) && res!="Infinity")
3282− str = "`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err;
3283− else if (str!="") str = "`"+str+"` = undefined"; //debug:+mathjs(str);
3284− var outnode = document.getElementById(outputId);
3285− var n = outnode.childNodes.length;
3286− for (var i=0; i<n; i++)
3287− outnode.removeChild(outnode.firstChild);
3288− outnode.appendChild(document.createTextNode(str));
3289− AMprocessNode(outnode);
3290−}
3291−
3292−function append(st){
3293− document.getElementById('in').value+=st;
3294− calculate('in','out');
3295− document.getElementById('in').scrollTop = 1000;
3296− document.getElementById('in').focus();
3297−}
3298−
3299−function clearTextArea(){
3300− document.getElementById('in').value="";
3301− calculate('in','out');
3302− document.getElementById('in').focus();
3303−}
3304−
3305−var calcstr = "<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: &nbsp; &nbsp; <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\">&nbsp;`C`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button></td>\n<td><button onclick=\"append('sin(')\">&nbsp;`sin`</button></td>\n<td><button onclick=\"append('cos(')\">&nbsp;`cos`</button></td>\n<td><button onclick=\"append('tan(')\">&nbsp;`tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\">&nbsp; `!` &nbsp;</button></td>\n\n<td><button onclick=\"append('(')\"><font size=2>&nbsp;&nbsp;`(`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append(')')\"><font size=2>&nbsp;&nbsp;`)`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\">&nbsp;`-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\">&nbsp; `7` &nbsp;</button></td>\n<td><button onclick=\"append('8')\">&nbsp; `8` &nbsp;</button></td>\n\n<td><button onclick=\"append('9')\">&nbsp; `9` &nbsp;</button></td>\n<td><button onclick=\"append('*')\">&nbsp;`times`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\">&nbsp;`ln`&nbsp;</button></td>\n<td><button onclick=\"append('4')\">&nbsp; `4` &nbsp;</button></td>\n<td><button onclick=\"append('5')\">&nbsp; `5` &nbsp;</button></td>\n<td><button onclick=\"append('6')\">&nbsp; `6` &nbsp;</button></td>\n\n<td><button onclick=\"append('-')\">&nbsp;`-{::}`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\">&nbsp; `e` &nbsp;</button></td>\n<td><button onclick=\"append('1')\">&nbsp;&nbsp;`1` &nbsp;</button></td>\n<td><button onclick=\"append('2')\">&nbsp; `2` &nbsp;</button></td>\n<td><button onclick=\"append('3')\">&nbsp; `3` &nbsp;</button></td>\n<td><button onclick=\"append('+')\">&nbsp;`+{::}`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button--></td>\n<td><button onclick=\"append('0')\">&nbsp; `0` &nbsp;</button></td>\n<td><button onclick=\"append('.')\">&nbsp; `.` &nbsp;</button></td>\n<td><button onclick=\"append('\\n')\">&nbsp;`\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>";
3306−
3307−// GO1.1 Generic onload by Brothercake
3308−// http://www.brothercake.com/
3309−//onload function (replaces the onload="translate()" in the <body> tag)
3310−function generic()
3311−{
3312− if(!init()) return;
3313− if (translateOnLoad) {
3314− var nd = document.getElementById("processasciimathinmoodle");
3315− if (nd!=null) dsvglocation = nd.className;
3316− if (nd!=null || !checkforprocessasciimathinmoodle) {
3317− translate();
3318− if (!noSVG && translateASCIIsvg) drawPictures();
3319− }
3320− var li = getElementsByClass(document,"div","ASCIIMathCalculator");
3321− if (!noMathML && li.length>0) initASCIIMathCalculators(li);
3322− }
3323−};
3324−//setup onload function
3325−if(typeof window.addEventListener != 'undefined')
3326−{
3327− //.. gecko, safari, konqueror and standard
3328− window.addEventListener('load', generic, false);
3329−}
3330−else if(typeof document.addEventListener != 'undefined')
3331−{
3332− //.. opera 7
3333− document.addEventListener('load', generic, false);
3334−}
3335−else if(typeof window.attachEvent != 'undefined')
3336−{
3337− //.. win/ie
3338− window.attachEvent('onload', generic);
3339−}
3340−//** remove this condition to degrade older browsers
3341−else
3342−{
3343− //.. mac/ie5 and anything else that gets this far
3344− //if there's an existing onload function
3345− if(typeof window.onload == 'function')
3346− {
3347− //store it
3348− var existing = onload;
3349− //add new onload handler
3350− window.onload = function()
3351− {
3352− //call existing onload function
3353− existing();
3354− //call generic onload function
3355− generic();
3356− };
3357− }
3358− else
3359− {
3360− //setup onload function
3361− window.onload = generic;
3362− }
3363−}
data/ASCIIMathML.js.commentdeleted−2
@@ -1,2 +0,0 @@
1−/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
2− See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
data/ASCIIMathML.js.packeddeleted−374
@@ -1,374 +0,0 @@
1−var mathcolor="";var mathfontsize="1em";var mathfontfamily="serif";var automathrecognize=false;var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var translateOnLoad=true;var translateLaTeX=true;var translateLaTeXformatting=true;var translateASCIIMath=true;var translateASCIIsvg=true;var avoidinnerHTML=false;var displaystyle=true;var showasciiformulaonhover=true;var decimalsign=".";var AMdelimiter1="`",AMescape1="\\\\`";var AMdocumentId="wikitext"
2−var checkforprocessasciimathinmoodle=false;var dsvglocation="";var isIE=document.createElementNS==null;var noMathML=false,translated=false;if(isIE){document.write("<object id=\"mathplayer\"\
3− classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}
4−function setStylesheet(s){var id="AMMLcustomStyleSheet";var n=document.getElementById(id);if(document.createStyleSheet){if(n)
5−n.parentNode.removeChild(n);document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd","&nbsp;<style id='"+id+"'>"+s+"</style>");}else{if(n){n.replaceChild(document.createTextNode(s),n.firstChild);}else{n=document.createElement("style");n.type="text/css";n.id=id;n.appendChild(document.createTextNode(s));document.getElementsByTagName("head")[0].appendChild(n);}}}
6−setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}");function init(){var msg,warnings=new Array();if(document.getElementById==null){alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer");return null;}
7−if(checkForMathML&&(msg=checkMathML()))warnings.push(msg);if(checkIfSVGavailable&&(msg=checkSVG()))warnings.push(msg);if(warnings.length>0)displayWarnings(warnings);if(!noMathML)initSymbols();return true;}
8−function checkMathML(){if(navigator.appName.slice(0,8)=="Netscape")
9−if(navigator.appVersion.slice(0,1)>="5")noMathML=null;else noMathML=true;else if(navigator.appName.slice(0,9)=="Microsoft")
10−try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");noMathML=null;}catch(e){noMathML=true;}
11−else noMathML=true;if(noMathML&&notifyIfNoMathML){var msg="To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.";if(alertIfNoMathML)
12−alert(msg);else return msg;}}
13−function hideWarning(){var body=document.getElementsByTagName("body")[0];body.removeChild(document.getElementById('AMMLwarningBox'));body.onclick=null;}
14−function displayWarnings(warnings){var i,frag,nd=createElementXHTML("div");var body=document.getElementsByTagName("body")[0];body.onclick=hideWarning;nd.id='AMMLwarningBox';for(i=0;i<warnings.length;i++){frag=createElementXHTML("div");frag.appendChild(document.createTextNode(warnings[i]));frag.style.paddingBottom="1.0em";nd.appendChild(frag);}
15−nd.appendChild(createElementXHTML("p"));nd.appendChild(document.createTextNode("For instructions see the "));var an=createElementXHTML("a");an.appendChild(document.createTextNode("ASCIIMathML"));an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" homepage"));an=createElementXHTML("div");an.id='AMMLcloseDiv';an.appendChild(document.createTextNode('(click anywhere to close this warning)'));nd.appendChild(an);var body=document.getElementsByTagName("body")[0];body.insertBefore(nd,body.childNodes[0]);}
16−function translate(spanclassAM){if(!translated){translated=true;var body=document.getElementsByTagName("body")[0];var processN=document.getElementById(AMdocumentId);if(translateLaTeX)LMprocessNode((processN!=null?processN:body));if(translateASCIIMath)AMprocessNode((processN!=null?processN:body),false,spanclassAM);}}
17−function createElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}
18−function createMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS("http://www.w3.org/1998/Math/MathML",t);if(frag)node.appendChild(frag);return node;}
19−var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,LEFTRIGHT=9,TEXT=10,BIG=11,LONG=12,STRETCHY=13,MATRIX=14;;var AMquote={input:"\"",tag:"mtext",output:"mbox",tex:null,ttype:TEXT};var AMsymbols=[{input:"alpha",tag:"mi",output:"\u03B1",tex:null,ttype:CONST},{input:"beta",tag:"mi",output:"\u03B2",tex:null,ttype:CONST},{input:"chi",tag:"mi",output:"\u03C7",tex:null,ttype:CONST},{input:"delta",tag:"mi",output:"\u03B4",tex:null,ttype:CONST},{input:"Delta",tag:"mo",output:"\u0394",tex:null,ttype:CONST},{input:"epsi",tag:"mi",output:"\u03B5",tex:"epsilon",ttype:CONST},{input:"varepsilon",tag:"mi",output:"\u025B",tex:null,ttype:CONST},{input:"eta",tag:"mi",output:"\u03B7",tex:null,ttype:CONST},{input:"gamma",tag:"mi",output:"\u03B3",tex:null,ttype:CONST},{input:"Gamma",tag:"mo",output:"\u0393",tex:null,ttype:CONST},{input:"iota",tag:"mi",output:"\u03B9",tex:null,ttype:CONST},{input:"kappa",tag:"mi",output:"\u03BA",tex:null,ttype:CONST},{input:"lambda",tag:"mi",output:"\u03BB",tex:null,ttype:CONST},{input:"Lambda",tag:"mo",output:"\u039B",tex:null,ttype:CONST},{input:"mu",tag:"mi",output:"\u03BC",tex:null,ttype:CONST},{input:"nu",tag:"mi",output:"\u03BD",tex:null,ttype:CONST},{input:"omega",tag:"mi",output:"\u03C9",tex:null,ttype:CONST},{input:"Omega",tag:"mo",output:"\u03A9",tex:null,ttype:CONST},{input:"phi",tag:"mi",output:"\u03C6",tex:null,ttype:CONST},{input:"varphi",tag:"mi",output:"\u03D5",tex:null,ttype:CONST},{input:"Phi",tag:"mo",output:"\u03A6",tex:null,ttype:CONST},{input:"pi",tag:"mi",output:"\u03C0",tex:null,ttype:CONST},{input:"Pi",tag:"mo",output:"\u03A0",tex:null,ttype:CONST},{input:"psi",tag:"mi",output:"\u03C8",tex:null,ttype:CONST},{input:"Psi",tag:"mi",output:"\u03A8",tex:null,ttype:CONST},{input:"rho",tag:"mi",output:"\u03C1",tex:null,ttype:CONST},{input:"sigma",tag:"mi",output:"\u03C3",tex:null,ttype:CONST},{input:"Sigma",tag:"mo",output:"\u03A3",tex:null,ttype:CONST},{input:"tau",tag:"mi",output:"\u03C4",tex:null,ttype:CONST},{input:"theta",tag:"mi",output:"\u03B8",tex:null,ttype:CONST},{input:"vartheta",tag:"mi",output:"\u03D1",tex:null,ttype:CONST},{input:"Theta",tag:"mo",output:"\u0398",tex:null,ttype:CONST},{input:"upsilon",tag:"mi",output:"\u03C5",tex:null,ttype:CONST},{input:"xi",tag:"mi",output:"\u03BE",tex:null,ttype:CONST},{input:"Xi",tag:"mo",output:"\u039E",tex:null,ttype:CONST},{input:"zeta",tag:"mi",output:"\u03B6",tex:null,ttype:CONST},{input:"*",tag:"mo",output:"\u22C5",tex:"cdot",ttype:CONST},{input:"**",tag:"mo",output:"\u22C6",tex:"star",ttype:CONST},{input:"//",tag:"mo",output:"/",tex:null,ttype:CONST},{input:"\\\\",tag:"mo",output:"\\",tex:"backslash",ttype:CONST},{input:"setminus",tag:"mo",output:"\\",tex:null,ttype:CONST},{input:"xx",tag:"mo",output:"\u00D7",tex:"times",ttype:CONST},{input:"-:",tag:"mo",output:"\u00F7",tex:"divide",ttype:CONST},{input:"@",tag:"mo",output:"\u2218",tex:"circ",ttype:CONST},{input:"o+",tag:"mo",output:"\u2295",tex:"oplus",ttype:CONST},{input:"ox",tag:"mo",output:"\u2297",tex:"otimes",ttype:CONST},{input:"o.",tag:"mo",output:"\u2299",tex:"odot",ttype:CONST},{input:"sum",tag:"mo",output:"\u2211",tex:null,ttype:UNDEROVER},{input:"prod",tag:"mo",output:"\u220F",tex:null,ttype:UNDEROVER},{input:"^^",tag:"mo",output:"\u2227",tex:"wedge",ttype:CONST},{input:"^^^",tag:"mo",output:"\u22C0",tex:"bigwedge",ttype:UNDEROVER},{input:"vv",tag:"mo",output:"\u2228",tex:"vee",ttype:CONST},{input:"vvv",tag:"mo",output:"\u22C1",tex:"bigvee",ttype:UNDEROVER},{input:"nn",tag:"mo",output:"\u2229",tex:"cap",ttype:CONST},{input:"nnn",tag:"mo",output:"\u22C2",tex:"bigcap",ttype:UNDEROVER},{input:"uu",tag:"mo",output:"\u222A",tex:"cup",ttype:CONST},{input:"uuu",tag:"mo",output:"\u22C3",tex:"bigcup",ttype:UNDEROVER},{input:"!=",tag:"mo",output:"\u2260",tex:"ne",ttype:CONST},{input:":=",tag:"mo",output:":=",tex:null,ttype:CONST},{input:"lt",tag:"mo",output:"<",tex:null,ttype:CONST},{input:"<=",tag:"mo",output:"\u2264",tex:"le",ttype:CONST},{input:"lt=",tag:"mo",output:"\u2264",tex:"leq",ttype:CONST},{input:">=",tag:"mo",output:"\u2265",tex:"ge",ttype:CONST},{input:"geq",tag:"mo",output:"\u2265",tex:null,ttype:CONST},{input:"-<",tag:"mo",output:"\u227A",tex:"prec",ttype:CONST},{input:"-lt",tag:"mo",output:"\u227A",tex:null,ttype:CONST},{input:">-",tag:"mo",output:"\u227B",tex:"succ",ttype:CONST},{input:"-<=",tag:"mo",output:"\u2AAF",tex:"preceq",ttype:CONST},{input:">-=",tag:"mo",output:"\u2AB0",tex:"succeq",ttype:CONST},{input:"in",tag:"mo",output:"\u2208",tex:null,ttype:CONST},{input:"!in",tag:"mo",output:"\u2209",tex:"notin",ttype:CONST},{input:"sub",tag:"mo",output:"\u2282",tex:"subset",ttype:CONST},{input:"sup",tag:"mo",output:"\u2283",tex:"supset",ttype:CONST},{input:"sube",tag:"mo",output:"\u2286",tex:"subseteq",ttype:CONST},{input:"supe",tag:"mo",output:"\u2287",tex:"supseteq",ttype:CONST},{input:"-=",tag:"mo",output:"\u2261",tex:"equiv",ttype:CONST},{input:"~=",tag:"mo",output:"\u2245",tex:"cong",ttype:CONST},{input:"~~",tag:"mo",output:"\u2248",tex:"approx",ttype:CONST},{input:"prop",tag:"mo",output:"\u221D",tex:"propto",ttype:CONST},{input:"and",tag:"mtext",output:"and",tex:null,ttype:SPACE},{input:"or",tag:"mtext",output:"or",tex:null,ttype:SPACE},{input:"not",tag:"mo",output:"\u00AC",tex:"neg",ttype:CONST},{input:"=>",tag:"mo",output:"\u21D2",tex:"implies",ttype:CONST},{input:"if",tag:"mo",output:"if",tex:null,ttype:SPACE},{input:"<=>",tag:"mo",output:"\u21D4",tex:"iff",ttype:CONST},{input:"AA",tag:"mo",output:"\u2200",tex:"forall",ttype:CONST},{input:"EE",tag:"mo",output:"\u2203",tex:"exists",ttype:CONST},{input:"_|_",tag:"mo",output:"\u22A5",tex:"bot",ttype:CONST},{input:"TT",tag:"mo",output:"\u22A4",tex:"top",ttype:CONST},{input:"|--",tag:"mo",output:"\u22A2",tex:"vdash",ttype:CONST},{input:"|==",tag:"mo",output:"\u22A8",tex:"models",ttype:CONST},{input:"(",tag:"mo",output:"(",tex:null,ttype:LEFTBRACKET},{input:")",tag:"mo",output:")",tex:null,ttype:RIGHTBRACKET},{input:"[",tag:"mo",output:"[",tex:null,ttype:LEFTBRACKET},{input:"]",tag:"mo",output:"]",tex:null,ttype:RIGHTBRACKET},{input:"{",tag:"mo",output:"{",tex:null,ttype:LEFTBRACKET},{input:"}",tag:"mo",output:"}",tex:null,ttype:RIGHTBRACKET},{input:"|",tag:"mo",output:"|",tex:null,ttype:LEFTRIGHT},{input:"(:",tag:"mo",output:"\u2329",tex:"langle",ttype:LEFTBRACKET},{input:":)",tag:"mo",output:"\u232A",tex:"rangle",ttype:RIGHTBRACKET},{input:"<<",tag:"mo",output:"\u2329",tex:null,ttype:LEFTBRACKET},{input:">>",tag:"mo",output:"\u232A",tex:null,ttype:RIGHTBRACKET},{input:"{:",tag:"mo",output:"{:",tex:null,ttype:LEFTBRACKET,invisible:true},{input:":}",tag:"mo",output:":}",tex:null,ttype:RIGHTBRACKET,invisible:true},{input:"int",tag:"mo",output:"\u222B",tex:null,ttype:CONST},{input:"dx",tag:"mi",output:"{:d x:}",tex:null,ttype:DEFINITION},{input:"dy",tag:"mi",output:"{:d y:}",tex:null,ttype:DEFINITION},{input:"dz",tag:"mi",output:"{:d z:}",tex:null,ttype:DEFINITION},{input:"dt",tag:"mi",output:"{:d t:}",tex:null,ttype:DEFINITION},{input:"oint",tag:"mo",output:"\u222E",tex:null,ttype:CONST},{input:"del",tag:"mo",output:"\u2202",tex:"partial",ttype:CONST},{input:"grad",tag:"mo",output:"\u2207",tex:"nabla",ttype:CONST},{input:"+-",tag:"mo",output:"\u00B1",tex:"pm",ttype:CONST},{input:"O/",tag:"mo",output:"\u2205",tex:"emptyset",ttype:CONST},{input:"oo",tag:"mo",output:"\u221E",tex:"infty",ttype:CONST},{input:"aleph",tag:"mo",output:"\u2135",tex:null,ttype:CONST},{input:"...",tag:"mo",output:"...",tex:"ldots",ttype:CONST},{input:":.",tag:"mo",output:"\u2234",tex:"therefore",ttype:CONST},{input:"/_",tag:"mo",output:"\u2220",tex:"angle",ttype:CONST},{input:"\\ ",tag:"mo",output:"\u00A0",tex:null,ttype:CONST},{input:"quad",tag:"mo",output:"\u00A0\u00A0",tex:null,ttype:CONST},{input:"qquad",tag:"mo",output:"\u00A0\u00A0\u00A0\u00A0",tex:null,ttype:CONST},{input:"cdots",tag:"mo",output:"\u22EF",tex:null,ttype:CONST},{input:"vdots",tag:"mo",output:"\u22EE",tex:null,ttype:CONST},{input:"ddots",tag:"mo",output:"\u22F1",tex:null,ttype:CONST},{input:"diamond",tag:"mo",output:"\u22C4",tex:null,ttype:CONST},{input:"square",tag:"mo",output:"\u25A1",tex:null,ttype:CONST},{input:"|__",tag:"mo",output:"\u230A",tex:"lfloor",ttype:CONST},{input:"__|",tag:"mo",output:"\u230B",tex:"rfloor",ttype:CONST},{input:"|~",tag:"mo",output:"\u2308",tex:"lceiling",ttype:CONST},{input:"~|",tag:"mo",output:"\u2309",tex:"rceiling",ttype:CONST},{input:"CC",tag:"mo",output:"\u2102",tex:null,ttype:CONST},{input:"NN",tag:"mo",output:"\u2115",tex:null,ttype:CONST},{input:"QQ",tag:"mo",output:"\u211A",tex:null,ttype:CONST},{input:"RR",tag:"mo",output:"\u211D",tex:null,ttype:CONST},{input:"ZZ",tag:"mo",output:"\u2124",tex:null,ttype:CONST},{input:"f",tag:"mi",output:"f",tex:null,ttype:UNARY,func:true},{input:"g",tag:"mi",output:"g",tex:null,ttype:UNARY,func:true},{input:"lim",tag:"mo",output:"lim",tex:null,ttype:UNDEROVER},{input:"Lim",tag:"mo",output:"Lim",tex:null,ttype:UNDEROVER},{input:"sin",tag:"mo",output:"sin",tex:null,ttype:UNARY,func:true},{input:"cos",tag:"mo",output:"cos",tex:null,ttype:UNARY,func:true},{input:"tan",tag:"mo",output:"tan",tex:null,ttype:UNARY,func:true},{input:"sinh",tag:"mo",output:"sinh",tex:null,ttype:UNARY,func:true},{input:"cosh",tag:"mo",output:"cosh",tex:null,ttype:UNARY,func:true},{input:"tanh",tag:"mo",output:"tanh",tex:null,ttype:UNARY,func:true},{input:"cot",tag:"mo",output:"cot",tex:null,ttype:UNARY,func:true},{input:"sec",tag:"mo",output:"sec",tex:null,ttype:UNARY,func:true},{input:"csc",tag:"mo",output:"csc",tex:null,ttype:UNARY,func:true},{input:"log",tag:"mo",output:"log",tex:null,ttype:UNARY,func:true},{input:"ln",tag:"mo",output:"ln",tex:null,ttype:UNARY,func:true},{input:"det",tag:"mo",output:"det",tex:null,ttype:UNARY,func:true},{input:"dim",tag:"mo",output:"dim",tex:null,ttype:CONST},{input:"mod",tag:"mo",output:"mod",tex:null,ttype:CONST},{input:"gcd",tag:"mo",output:"gcd",tex:null,ttype:UNARY,func:true},{input:"lcm",tag:"mo",output:"lcm",tex:null,ttype:UNARY,func:true},{input:"lub",tag:"mo",output:"lub",tex:null,ttype:CONST},{input:"glb",tag:"mo",output:"glb",tex:null,ttype:CONST},{input:"min",tag:"mo",output:"min",tex:null,ttype:UNDEROVER},{input:"max",tag:"mo",output:"max",tex:null,ttype:UNDEROVER},{input:"uarr",tag:"mo",output:"\u2191",tex:"uparrow",ttype:CONST},{input:"darr",tag:"mo",output:"\u2193",tex:"downarrow",ttype:CONST},{input:"rarr",tag:"mo",output:"\u2192",tex:"rightarrow",ttype:CONST},{input:"->",tag:"mo",output:"\u2192",tex:"to",ttype:CONST},{input:">->",tag:"mo",output:"\u21A3",tex:"rightarrowtail",ttype:CONST},{input:"->>",tag:"mo",output:"\u21A0",tex:"twoheadrightarrow",ttype:CONST},{input:">->>",tag:"mo",output:"\u2916",tex:"twoheadrightarrowtail",ttype:CONST},{input:"|->",tag:"mo",output:"\u21A6",tex:"mapsto",ttype:CONST},{input:"larr",tag:"mo",output:"\u2190",tex:"leftarrow",ttype:CONST},{input:"harr",tag:"mo",output:"\u2194",tex:"leftrightarrow",ttype:CONST},{input:"rArr",tag:"mo",output:"\u21D2",tex:"Rightarrow",ttype:CONST},{input:"lArr",tag:"mo",output:"\u21D0",tex:"Leftarrow",ttype:CONST},{input:"hArr",tag:"mo",output:"\u21D4",tex:"Leftrightarrow",ttype:CONST},{input:"sqrt",tag:"msqrt",output:"sqrt",tex:null,ttype:UNARY},{input:"root",tag:"mroot",output:"root",tex:null,ttype:BINARY},{input:"frac",tag:"mfrac",output:"/",tex:null,ttype:BINARY},{input:"/",tag:"mfrac",output:"/",tex:null,ttype:INFIX},{input:"stackrel",tag:"mover",output:"stackrel",tex:null,ttype:BINARY},{input:"_",tag:"msub",output:"_",tex:null,ttype:INFIX},{input:"^",tag:"msup",output:"^",tex:null,ttype:INFIX},{input:"hat",tag:"mover",output:"\u005E",tex:null,ttype:UNARY,acc:true},{input:"bar",tag:"mover",output:"\u00AF",tex:"overline",ttype:UNARY,acc:true},{input:"vec",tag:"mover",output:"\u2192",tex:null,ttype:UNARY,acc:true},{input:"dot",tag:"mover",output:".",tex:null,ttype:UNARY,acc:true},{input:"ddot",tag:"mover",output:"..",tex:null,ttype:UNARY,acc:true},{input:"ul",tag:"munder",output:"\u0332",tex:"underline",ttype:UNARY,acc:true},{input:"text",tag:"mtext",output:"text",tex:null,ttype:TEXT},{input:"mbox",tag:"mtext",output:"mbox",tex:null,ttype:TEXT},AMquote,{input:"bb",tag:"mstyle",atname:"fontweight",atval:"bold",output:"bb",tex:null,ttype:UNARY},{input:"mathbf",tag:"mstyle",atname:"fontweight",atval:"bold",output:"mathbf",tex:null,ttype:UNARY},{input:"sf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"sf",tex:null,ttype:UNARY},{input:"mathsf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"mathsf",tex:null,ttype:UNARY},{input:"bbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"bbb",tex:null,ttype:UNARY,codes:AMbbb},{input:"mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"mathbb",tex:null,ttype:UNARY,codes:AMbbb},{input:"cc",tag:"mstyle",atname:"mathvariant",atval:"script",output:"cc",tex:null,ttype:UNARY,codes:AMcal},{input:"mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",output:"mathcal",tex:null,ttype:UNARY,codes:AMcal},{input:"tt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"tt",tex:null,ttype:UNARY},{input:"mathtt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"mathtt",tex:null,ttype:UNARY},{input:"fr",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"fr",tex:null,ttype:UNARY,codes:AMfrk},{input:"mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"mathfrak",tex:null,ttype:UNARY,codes:AMfrk}];function compareNames(s1,s2){if(s1.input>s2.input)return 1
20−else return-1;}
21−var AMnames=[];function initSymbols(){var texsymbols=[],i;for(i=0;i<AMsymbols.length;i++)
22−if(AMsymbols[i].tex)
23−texsymbols[texsymbols.length]={input:AMsymbols[i].tex,tag:AMsymbols[i].tag,output:AMsymbols[i].output,ttype:AMsymbols[i].ttype};AMsymbols=AMsymbols.concat(texsymbols);refreshSymbols();}
24−function refreshSymbols(){var i;AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;LMsymbols.sort(compareNames);for(i=0;i<LMsymbols.length;i++)LMnames[i]=LMsymbols[i].input;}
25−function define(oldstr,newstr){if(oldstr.substr(0,1)=="\\")
26−LMsymbols=LMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);else
27−AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,tex:null,ttype:DEFINITION}]);refreshSymbols();}
28−function AMremoveCharsAndBlanks(str,n){var st;if(str.charAt(n)=="\\"&&str.charAt(n+1)!="\\"&&str.charAt(n+1)!=" ")
29−st=str.slice(n+1);else st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
30−function position(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}
31−return h;}else
32−for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}
33−function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=position(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}
34−more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}
35−AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}
36−AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);var integ=true;while("0"<=st&&st<="9"&&k<=str.length){st=str.slice(k,k+1);k++;}
37−if(st==decimalsign){st=str.slice(k,k+1);if("0"<=st&&st<="9"){integ=false;k++;while("0"<=st&&st<="9"&&k<=str.length){st=str.slice(k,k+1);k++;}}}
38−if((integ&&k>1)||k>2){st=str.slice(0,k-1);tagst="mn";}else{k=2;st=str.slice(0,1);tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");}
39−if(st=="-"&&AMpreviousSymbol==INFIX){AMcurrentSymbol=INFIX;return{input:st,tag:tagst,output:st,ttype:UNARY,func:true};}
40−return{input:st,tag:tagst,output:st,ttype:CONST};}
41−function AMremoveBrackets(node){var st;if(node.nodeName=="mrow"){st=node.firstChild.firstChild.nodeValue;if(st=="("||st=="["||st=="{")node.removeChild(node.firstChild);}
42−if(node.nodeName=="mrow"){st=node.lastChild.firstChild.nodeValue;if(st==")"||st=="]"||st=="}")node.removeChild(node.lastChild);}}
43−var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET&&AMnestingDepth>0){return[null,str];}
44−if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);}
45−switch(symbol.ttype){case UNDEROVER:case CONST:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];case LEFTBRACKET:AMnestingDepth++;str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseExpr(str,true);AMnestingDepth--;if(typeof symbol.invisible=="boolean"&&symbol.invisible)
46−node=createMmlNode("mrow",result[0]);else{node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);}
47−return[node,result[1]];case TEXT:if(symbol!=AMquote)str=AMremoveCharsAndBlanks(str,symbol.input.length);if(str.charAt(0)=="{")i=str.indexOf("}");else if(str.charAt(0)=="(")i=str.indexOf(")");else if(str.charAt(0)=="[")i=str.indexOf("]");else if(symbol==AMquote)i=str.slice(1).indexOf("\"")+1;else i=0;if(i==-1)i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);}
48−newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);}
49−str=AMremoveCharsAndBlanks(str,i+1);return[createMmlNode("mrow",newFrag),str];case UNARY:str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st=="/"||st=="|"||st==","){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];}else{node=createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node.appendChild(result[0]);return[node,result[1]];}}
50−AMremoveBrackets(result[0]);if(symbol.input=="sqrt"){return[createMmlNode(symbol.tag,result[0]),result[1]];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=createMmlNode(symbol.tag,result[0]);node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));return[node,result[1]];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)
51−if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)
52−if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+
53−String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")
54−result[0]=createMmlNode("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(createMmlNode("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
55−node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);return[node,result[1]];}
56−case BINARY:str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str];AMremoveBrackets(result[0]);var result2=AMparseSexpr(result[1]);if(result2[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str];AMremoveBrackets(result2[0]);if(symbol.input=="root"||symbol.input=="stackrel")
57−newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="frac")newFrag.appendChild(result2[0]);return[createMmlNode(symbol.tag,newFrag),result2[1]];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode("mo",document.createTextNode(symbol.output)),str];case SPACE:str=AMremoveCharsAndBlanks(str,symbol.input.length);node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);return[createMmlNode("mrow",newFrag),str];case LEFTRIGHT:AMnestingDepth++;str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseExpr(str,false);AMnestingDepth--;var st="";if(result[0].lastChild!=null)
58−st=result[0].lastChild.firstChild.nodeValue;if(st=="|"){node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);return[node,result[1]];}else{node=createMmlNode("mo",document.createTextNode("\u2223"));node=createMmlNode("mrow",node);return[node,str];}
59−default:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];}}
60−function AMparseIexpr(str){var symbol,sym1,sym2,node,result,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX&&symbol.input!="/"){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)
61−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));else AMremoveBrackets(result[0]);str=result[1];if(symbol.input=="_"){sym2=AMgetSymbol(str);underover=(sym1.ttype==UNDEROVER);if(sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);AMremoveBrackets(res2[0]);str=res2[1];node=createMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);node=createMmlNode("mrow",node);}else{node=createMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}}else{node=createMmlNode(symbol.tag,node);node.appendChild(result[0]);}}
62−return[node,str];}
63−function AMparseExpr(str,rightbracket){var symbol,node,result,i,nodeList=[],newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX&&symbol.input=="/"){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseIexpr(str);if(result[0]==null)
64−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));else AMremoveBrackets(result[0]);str=result[1];AMremoveBrackets(node);node=createMmlNode(symbol.tag,node);node.appendChild(result[0]);newFrag.appendChild(node);symbol=AMgetSymbol(str);}
65−else if(node!=undefined)newFrag.appendChild(node);}while((symbol.ttype!=RIGHTBRACKET&&(symbol.ttype!=LEFTRIGHT||rightbracket)||AMnestingDepth==0)&&symbol!=null&&symbol.output!="");if(symbol.ttype==RIGHTBRACKET||symbol.ttype==LEFTRIGHT){var len=newFrag.childNodes.length;if(len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue==","){var right=newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;if(right==")"||right=="]"){var left=newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;if(left=="("&&right==")"&&symbol.output!="}"||left=="["&&right=="]"){var pos=[];var matrix=true;var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];if(matrix)matrix=node.nodeName=="mrow"&&(i==m-1||node.nextSibling.nodeName=="mo"&&node.nextSibling.firstChild.nodeValue==",")&&node.firstChild.firstChild.nodeValue==left&&node.lastChild.firstChild.nodeValue==right;if(matrix)
66−for(var j=0;j<node.childNodes.length;j++)
67−if(node.childNodes[j].firstChild.nodeValue==",")
68−pos[i][pos[i].length]=j;if(matrix&&i>1)matrix=pos[i].length==pos[i-2].length;}
69−if(matrix){var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;node.removeChild(node.firstChild);for(j=1;j<n-1;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
70−row.appendChild(createMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
71−table.appendChild(createMmlNode("mtr",row));}
72−node=createMmlNode("mtable",table);if(typeof symbol.invisible=="boolean"&&symbol.invisible)node.setAttribute("columnalign","left");newFrag.replaceChild(node,newFrag.firstChild);}}}}
73−str=AMremoveCharsAndBlanks(str,symbol.input.length);if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=createMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
74−return[newFrag,str];}
75−function parseMath(str,latex){var frag,node;AMnestingDepth=0;frag=latex?LMparseExpr(str.replace(/^\s+/g,""),false,false)[0]:AMparseExpr(str.replace(/^\s+/g,""),false)[0];node=createMmlNode("mstyle",frag);node.setAttribute("mathcolor",mathcolor);node.setAttribute("fontfamily",mathfontfamily);node.setAttribute("mathsize",mathfontsize);if(displaystyle)node.setAttribute("displaystyle","true");node=createMmlNode("math",node);if(showasciiformulaonhover)
76−node.setAttribute("title",str.replace(/\s+/g," "));return node;}
77−function strarr2docFrag(arr,linebreaks,latex){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(parseMath(arr[i],latex));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(createElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(createElementXHTML("p"));newFrag.appendChild(createElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}
78−expr=!expr;}
79−return newFrag;}
80−function AMautomathrec(str){var texcommand="\\\\[a-zA-Z]+|\\\\\\s|";var ambigAMtoken="\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";var englishAMtoken="\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";var secondenglishAMtoken="|\\bI\\b|\\bin\\b|\\btext\\b";var simpleAMtoken="NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta";var letter="[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";var token=letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;var re=new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");str=str.replace(re," `$2`$7");var arr=str.split(AMdelimiter1);var re1=new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");var re2=new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g");for(i=0;i<arr.length;i++)
81−if(i%2==0){arr[i]=arr[i].replace(re1," `$2`$3");arr[i]=arr[i].replace(re2," `$2`$3");arr[i]=arr[i].replace(/([{}[\]])/,"`$1`");}
82−str=arr.join(AMdelimiter1);str=str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)");str=str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3");str=str.replace(/\sin`/g,"` in");str=str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");str=str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");str=str.replace(/`([0-9.]+:)`/g,"$1");return str;}
83−function processNodeR(n,linebreaks,latex){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");if(latex){mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)
84−arr[i]=arr[i].replace(/\\\$/g,"\$");}else{mtch=false;str=str.replace(new RegExp(AMescape1,"g"),function(){mtch=true;return"AMescape1"});str=str.replace(/\\?end{?a?math}?/i,function(){automathrecognize=false;mtch=true;return""});str=str.replace(/amath\b|\\begin{a?math}/i,function(){automathrecognize=true;mtch=true;return""});arr=str.split(AMdelimiter1);if(automathrecognize)
85−for(i=0;i<arr.length;i++)
86−if(i%2==0)arr[i]=AMautomathrec(arr[i]);str=arr.join(AMdelimiter1);arr=str.split(AMdelimiter1);for(i=0;i<arr.length;i++)
87−arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);}
88−if(arr.length>1||mtch){if(!noMathML){frg=strarr2docFrag(arr,n.nodeType==8,latex);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)
89−i+=processNodeR(n.childNodes[i],linebreaks,latex);}
90−return 0;}
91−function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")
92−for(var i=0;i<frag.length;i++)
93−if(frag[i].className=="AM")
94−processNodeR(frag[i],linebreaks,false);}else{try{st=n.innerHTML;}catch(err){}
95−if(st==null||/amath\b|\\begin{a?math}/i.test(st)||st.indexOf(AMdelimiter1+" ")!=-1||st.slice(-1)==AMdelimiter1||st.indexOf(AMdelimiter1+"<")!=-1||st.indexOf(AMdelimiter1+"\n")!=-1){processNodeR(n,linebreaks,false);}}}
96−var LMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\implies",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},{input:"\\root",tag:"mroot",output:"root",ttype:BINARY},{input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},{input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},{input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},{input:"_",tag:"msub",output:"_",ttype:INFIX},{input:"^",tag:"msup",output:"^",ttype:INFIX},{input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk}];var LMnames=[];function LMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
97−function LMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=position(LMnames,st,j);if(k<LMnames.length&&str.slice(0,LMnames[k].length)==LMnames[k]){match=LMnames[k];mk=k;i=match.length;}
98−more=k<LMnames.length&&str.slice(0,LMnames[k].length)>=LMnames[k];}
99−LMpreviousSymbol=LMcurrentSymbol;if(match!=""){LMcurrentSymbol=LMsymbols[mk].ttype;return LMsymbols[mk];}
100−LMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}
101−var LMpreviousSymbol,LMcurrentSymbol;function LMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=LMremoveCharsAndBlanks(str,0);symbol=LMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
102−return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);symbol=LMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
103−return[null,str,null];}
104−str=LMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=createMmlNode(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=LMgetSymbol(str);symbol.ttype=UNDEROVER;str=LMremoveCharsAndBlanks(str,symbol.input.length);}}
105−return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")
106−output="\u2032";else if(symbol.input=="''")
107−output="\u2033";else if(symbol.input=="'''")
108−output="\u2033\u2032";else if(symbol.input=="''''")
109−output="\u2033\u2033";else if(symbol.input=="\\square")
110−output="\u25A1";else if(symbol.input.substr(0,5)=="\\frac"){var denom=symbol.input.substr(6,1);if(denom=="5"||denom=="6"){str=symbol.input.replace(/\\frac/,"\\frac ")+str;return[node,str,symbol.tag];}}}
111−node=createMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=createMmlNode("mover",node);node.appendChild(createMmlNode("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")
112−symbol.output="\\";node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}
113−node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)
114−return[node,str,symbol.rtag];else
115−return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)
116−atval=symbol.ieval;symbol=LMgetSymbol(str);if(symbol==null)
117−return[null,str,null];str=LMremoveCharsAndBlanks(str,symbol.input.length);node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=createMmlNode("mspace");space.setAttribute("height",atval+"ex");node=createMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}
118−return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=LMgetSymbol(str);if(symbol!=null){if(symbol.input==".")
119−symbol.invisible=true;str=LMremoveCharsAndBlanks(str,symbol.input.length);}}
120−result=LMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))
121−node=createMmlNode("mrow",result[0]);else{node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);}
122−return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=LMgetSymbol(str);str=LMremoveCharsAndBlanks(str,0);if(symbol==null)
123−mask="l";else{str=LMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")
124−mask="l";else do{symbol=LMgetSymbol(str);if(symbol!=null){str=LMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")
125−mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}
126−result=LMparseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)
127−return[node,result[1],null];var lspace=createMmlNode("mspace");lspace.setAttribute("width","0.167em");var rspace=createMmlNode("mspace");rspace.setAttribute("width","0.167em");var node1=createMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=LMparseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);if(isIE)
128−node.setAttribute("columnspacing","0.25em");else
129−node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=createMmlNode("mrow",node);return[node,result[1],null];}
130−case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)
131−i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=createMmlNode("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
132−newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=createMmlNode("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
133−str=LMremoveCharsAndBlanks(str,i+1);return[createMmlNode("mrow",newFrag),str,null];case UNARY:result=LMparseSexpr(str);if(result[0]==null)return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=createMmlNode("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}
134−node.appendChild(result[0]);return[node,result[1],symbol.tag];}}
135−if(symbol.input=="\\sqrt"){if(isIE){var space=createMmlNode("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=createMmlNode(symbol.tag,result[0])
136−node.appendChild(space);return[node,result[1],symbol.tag];}else
137−return[createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=createMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")
138−output="\u0302";else if(symbol.input=="\\widehat")
139−output="\u005E";else if(symbol.input=="\\bar")
140−output="\u00AF";else if(symbol.input=="\\grave")
141−output="\u0300";else if(symbol.input=="\\tilde")
142−output="\u0303";}
143−var node1=createMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")
144−node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")
145−node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")
146−node1.setAttribute("accentunder","true");else
147−node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")
148−node.ttype=UNDEROVER;return[node,result[1],symbol.tag];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)
149−if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)
150−if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+
151−String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")
152−result[0]=createMmlNode("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(createMmlNode("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
153−node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")
154−node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}
155−case BINARY:result=LMparseSexpr(str);if(result[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=LMparseSexpr(result[1]);if(result2[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\root"||symbol.input=="\\stackrel")
156−newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=LMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}
157−function LMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=LMremoveCharsAndBlanks(str,0);sym1=LMgetSymbol(str);result=LMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=LMgetSymbol(str);if(symbol.ttype==INFIX){str=LMremoveCharsAndBlanks(str,symbol.input.length);result=LMparseSexpr(str);if(result[0]==null)
158−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=LMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=LMremoveCharsAndBlanks(str,sym2.input.length);var res2=LMparseSexpr(str);str=res2[1];tag=res2[2];node=createMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=createMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=createMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}
159−node=createMmlNode("mrow",node);}else{node=createMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")
160−node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")
161−node=createMmlNode("mfenced",node);}}
162−return[node,str,tag];}
163−function LMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=LMremoveCharsAndBlanks(str,0);result=LMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=LMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=createMmlNode("mspace");space.setAttribute("width","0.167em");node=createMmlNode("mrow",node);node.appendChild(space);}
164−newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=LMremoveCharsAndBlanks(str,symbol.input.length);symbol=LMgetSymbol(str);if(symbol!=null&&symbol.input==".")
165−symbol.invisible=true;if(symbol!=null)
166−tag=symbol.rtag;}
167−if(symbol!=null)
168−str=LMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)
169−if(node.childNodes[j].firstChild.nodeValue=="&")
170−pos[i][pos[i].length]=j;}
171−var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
172−row.appendChild(createMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
173−table.appendChild(createMmlNode("mtr",row));}
174−return[table,str];}
175−if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=createMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
176−return[newFrag,str,tag];}
177−var tcnt=0,dcnt=0;function simpleLaTeXformatting(st){st=st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>");st=st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++;return"<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});st=st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++;return"<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});st=st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return"<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" &#x25A1;"});st=st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");st=st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");st=st.replace(/\\cite{(.*?)}/g,"[$1]");st=st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");st=st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");st=st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");st=st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");st=st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>");st=st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>");st=st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");st=st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>");st=st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");st=st.replace(/\\begin{description}/g,"<dl>");st=st.replace(/\\end{description}/g,"</dl>");st=st.replace(/\\newline\b/g,"<br/>");st=st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");st=st.replace(/\\par\b/g,"<p>&nbsp;</p>");st=st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\">&nbsp;</p>");st=st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\">&nbsp;</p>");st=st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\">&nbsp;</p>");st=st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");return st}
178−function ASCIIandgraphformatting(st){st=st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3");st=st.replace(/(Proof:)/g,"<i>$1</i>");st=st.replace(/QED/g,"&nbsp; &nbsp; &#x25A1;");st=st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");st=st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");st=st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");st=st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\"");st=st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return"<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"});st=st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>");return st}
179−function LMprocessNode(n){var frag,st;try{st=n.innerHTML;}catch(err){}
180−var am=/amath\b|graph/i.test(st);if((st==null||st.indexOf("\$ ")!=-1||st.indexOf("\$<")!=-1||st.indexOf("\\begin")!=-1||am||st.slice(-1)=="$"||st.indexOf("\$\n")!=-1)&&!/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){if(!avoidinnerHTML&&translateLaTeXformatting)
181−st=simpleLaTeXformatting(st);if(st!=null&&am&&!avoidinnerHTML){st=ASCIIandgraphformatting(st);}
182−st=st.replace(/%7E/g,"~");if(!avoidinnerHTML)n.innerHTML=st;processNodeR(n,false,true);}}
183−var checkIfSVGavailable=true;var notifyIfNoSVG=true;var alertIfNoSVG=false;var noSVG=false;var defaultwidth=300;defaultheight=200;var defaultxmin=-5.5;defaultxmax=5.5;var defaultborder=0;border=defaultborder;var defaultstrokewidth="1";var defaultstroke="blue";var defaultstrokeopacity=1;var defaultstrokedasharray=null;var defaultfill="none";var defaultfillopacity=1;var defaultfontstyle="normal";var defaultfontfamily="times";var defaultfontsize="16";var defaultfontweight="normal";var defaultfontstroke="none";var defaultfontfill="none";var defaultmarker="none";var defaultendpoints="";var showcoordinates=true;var markerstrokewidth="1";var markerstroke="black";var markerfill="yellow";var markersize=4;var arrowfill=stroke;var dotradius=4;var ticklength=4;var axesstroke="black";var gridstroke="grey";var backgroundstyle="fill-opacity:0; fill:white";var singlelettersitalic=true;var picturepos=null;var xunitlength;var yunitlength;var origin=[0,0];var above="above";var below="below";var left="left";var right="right";var aboveleft="aboveleft";var aboveright="aboveright";var belowleft="belowleft";var belowright="belowright";var xmin,xmax,ymin,ymax,xscl,yscl,xgrid,ygrid,xtick,ytick,initialized;var strokewidth,strokedasharray,stroke,fill,strokeopacity,fillopacity;var fontstyle,fontfamily,fontsize,fontweight,fontstroke,fontfill;var marker,endpoints,dynamic={};var picture,svgpicture,doc,width,height;var isIE=document.createElementNS==null;var log=function(x){return ln(x)/ln(10)};var pi=Math.PI,e=Math.E,ln=Math.log,sqrt=Math.sqrt;var floor=Math.floor,ceil=Math.ceil,abs=Math.abs;var sin=Math.sin,cos=Math.cos,tan=Math.tan;var arcsin=Math.asin,arccos=Math.acos,arctan=Math.atan;var sec=function(x){return 1/Math.cos(x)};var csc=function(x){return 1/Math.sin(x)};var cot=function(x){return 1/Math.tan(x)};var arcsec=function(x){return arccos(1/x)};var arccsc=function(x){return arcsin(1/x)};var arccot=function(x){return arctan(1/x)};var sinh=function(x){return(Math.exp(x)-Math.exp(-x))/2};var cosh=function(x){return(Math.exp(x)+Math.exp(-x))/2};var tanh=function(x){return(Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x))};var sech=function(x){return 1/cosh(x)};var csch=function(x){return 1/sinh(x)};var coth=function(x){return 1/tanh(x)};var arcsinh=function(x){return ln(x+Math.sqrt(x*x+1))};var arccosh=function(x){return ln(x+Math.sqrt(x*x-1))};var arctanh=function(x){return ln((1+x)/(1-x))/2};var sech=function(x){return 1/cosh(x)};var csch=function(x){return 1/sinh(x)};var coth=function(x){return 1/tanh(x)};var arcsech=function(x){return arccosh(1/x)};var arccsch=function(x){return arcsinh(1/x)};var arccoth=function(x){return arctanh(1/x)};var sign=function(x){return(x==0?0:(x<0?-1:1))};function factorial(x,n){if(n==null)n=1;if(Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)
184−x=Math.round(x*1000000)/1000000;if(x-Math.floor(x)!=0)return NaN;for(var i=x-n;i>0;i-=n)x*=i;return(x<0?NaN:(x==0?1:x));}
185−function C(x,k){var res=1;for(var i=0;i<k;i++)res*=(x-i)/(k-i);return res;}
186−function chop(x,n){if(n==null)n=0;return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);}
187−function ran(a,b,n){if(n==null)n=0;return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);}
188−function myCreateElementSVG(t){if(isIE)return doc.createElement(t);else return doc.createElementNS("http://www.w3.org/2000/svg",t);}
189−function getElementsByClass(container,tagName,clsName){var list=new Array(0);var collection=container.getElementsByTagName(tagName);for(var i=0;i<collection.length;i++)
190−if(collection[i].className.slice(0,clsName.length)==clsName)
191−list[list.length]=collection[i];return list;}
192−function showobj(obj){var st="",i;for(i in obj)
193−st+=(obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i));return st;}
194−function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
195−curtop=obj.offsetTop
196−while(obj=obj.offsetParent){curleft+=obj.offsetLeft
197−curtop+=obj.offsetTop}}
198−return[curleft,curtop];}
199−function checkSVG(){if(navigator.appName.slice(0,8)=="Netscape")
200−if(window['SVGElement'])noSVG=null;else noSVG=true;else if(navigator.appName.slice(0,9)=="Microsoft")
201−try{var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");noSVG=null;}catch(e){noSVG=true;}
202−else if(navigator.appName.slice(0,5)=="Opera")
203−noSVG=null;else noSVG=true;if(noSVG&&notifyIfNoSVG){var msg="To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later."
204−if(alertIfNoSVG)
205−alert(msg);else return msg;}}
206−function setText(st,id){var node=document.getElementById(id);if(node!=null)
207−if(node.childNodes.length!=0)node.childNodes[0].nodeValue=st;else node.appendChild(document.createTextNode(st));}
208−function getX(evt){var svgroot=evt.target.parentNode;pos=findPos(svgroot.parentNode);return(evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength"));}
209−function getY(evt){var svgroot=evt.target.parentNode;pos=findPos(svgroot.parentNode);return(svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength"));}
210−function translateandeval(src){var errstr;src=src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\",");src=src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")");src=src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]");src=src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2");src=src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");try{with(Math)eval(src);}catch(err){if(err!="wait"){if(typeof err=="object")
211−errstr=err.name+" "+err.message+" "+err.number+" "+err.description;else errstr=err;alert(errstr+"\n"+src)}}}
212−var lastSlot=0;function drawPictures(){var src,id,dsvg,nd,node,ht,index,cols,arr,i,node2;var ASbody=document.getElementsByTagName("body")[0];pictures=getElementsByClass(ASbody,"embed","ASCIIsvg");var len=pictures.length;if(len==0)return;for(index=lastSlot;index<len+lastSlot;index++){width=null;height=null;xmin=null;xmax=null;ymin=null;ymax=null;xscl=null;xgrid=null;yscl=null;ygrid=null;initialized=false;picture=pictures[index-lastSlot];src=picture.getAttribute("script");if(src==null)src="";if(!/axes\b|initPicture/.test(src)){var i=0;while(/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i)))i++;src=(i==0?"axes(); "+src:src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();"));}
213−ht=picture.getAttribute("height");if(isIE){picture.setAttribute("wmode","transparent");}
214−if(document.getElementById("picture"+(index+1)+"mml")==null){picture.parentNode.style.position="relative";node=createElementXHTML("div");node.style.position="absolute";node.style.top="0px";node.style.left="0px";node.setAttribute("id","picture"+(index+1)+"mml");picture.parentNode.insertBefore(node,picture.nextSibling);}
215−if(ht==null)ht="";if(ht==""||src=="")
216−if(document.getElementById("picture"+(index+1)+"input")==null){node=createElementXHTML("textarea");arr=src.split("\n");cols=0;for(i=0;i<arr.length;i++)cols=Math.max(cols,arr[i].length);node.setAttribute("rows",Math.min(10,arr.length)+1);node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5);if(isIE)src=src.replace(/([^\r])\n/g,"$1\r");node.appendChild(document.createTextNode(src));if(src.indexOf("showcode()")==-1)node.style.display="none";node.setAttribute("id","picture"+(index+1)+"input");picture.parentNode.insertBefore(node,picture.nextSibling);picture.parentNode.insertBefore(createElementXHTML("br"),node);node2=createElementXHTML("button");node2.setAttribute("id","picture"+(index+1)+"button");if(isIE)node2.onclick=function(){updatePicture(this)};else node2.setAttribute("onclick","updatePicture(this)");node2.appendChild(document.createTextNode("Update"));if(src.indexOf("showcode()")==-1)node2.style.display="none";picture.parentNode.insertBefore(node2,node);picture.parentNode.insertBefore(createElementXHTML("br"),node);}else src=document.getElementById("picture"+(index+1)+"input").value;id=picture.getAttribute("id");dsvg=picture.getAttribute("src");if(id==null||id==""){id="picture"+(index+1);picture.setAttribute("id",id);}
217−translateandeval(src);}
218−lastSlot+=len;}
219−function setdefaults(){strokewidth=defaultstrokewidth;stroke=defaultstroke;strokeopacity=defaultstrokeopacity;strokedasharray=defaultstrokedasharray;fill=defaultfill;fillopacity=defaultfillopacity;fontstyle=defaultfontstyle;fontfamily=defaultfontfamily;fontsize=defaultfontsize;fontweight=defaultfontweight;fontstroke=defaultfontstroke;fontfill=defaultfontfill;marker=defaultmarker;endpoints=defaultendpoints;}
220−function switchTo(id){if(id==undefined)return;var name=id;if(typeof name!="string")name=id.target.parentNode.getAttribute("name");picture=document.getElementById(name);width=picture.getAttribute("width")-0;height=picture.getAttribute("height")-0;setdefaults();if((picture.nodeName=="EMBED"||picture.nodeName=="embed")&&isIE){svgpicture=picture.getSVGDocument().getElementById("root");doc=picture.getSVGDocument();}else{svgpicture=picture;doc=document;}
221−xunitlength=parseFloat(svgpicture.getAttribute("xunitlength"));yunitlength=parseFloat(svgpicture.getAttribute("yunitlength"));xmin=parseFloat(svgpicture.getAttribute("xmin"));xmax=parseFloat(svgpicture.getAttribute("xmax"));ymin=parseFloat(svgpicture.getAttribute("ymin"));ymax=parseFloat(svgpicture.getAttribute("ymax"));origin=[svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];}
222−function updatePicture(obj){var node,src,id,top,left;if(typeof obj=="object")id=obj.id.slice(0,-6);else id=(typeof obj=="string"?obj:"picture"+(obj+1));src=document.getElementById(id+"input").value;xmin=null;xmax=null;ymin=null;ymax=null;xscl=null;xgrid=null;yscl=null;ygrid=null;initialized=false;picture=document.getElementById(id);translateandeval(src)}
223−function changepicturesize(evt,factor){var obj=evt.target;var name=obj.parentNode.getAttribute("name");var pic=document.getElementById(name);var src=document.getElementById(name+"input").value;if(!/height/.test(src))src="height=0; "+src;if(!/width/.test(src))src="width=0; "+src;src=src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0)));src=src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0)));document.getElementById(name+"input").value=src;updatePicture(name);}
224−function zoom(evt,factor){switchTo(evt);var obj=evt.target;var name=obj.parentNode.getAttribute("name");var pic=document.getElementById(name);var src=document.getElementById(name+"input").value;var xlen=(xmax-xmin)/2;var ylen=(ymax-ymin)/2;var xcen=getX(evt),ycen=getY(evt);if(!/ymax/.test(src))src="ymax=0; "+src;if(!/ymin/.test(src))src="ymin=0; "+src;if(!/xmax/.test(src))src="xmax=0; "+src;if(!/xmin/.test(src))src="xmin=0; "+src;src=src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen));src=src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen));src=src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen));src=src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen));document.getElementById(name+"input").value=src;updatePicture(name);}
225−var sinceFirstClick=0;var dblClkTimer;function timer(){if(sinceFirstClick<60){sinceFirstClick++;setTimeout("timer()",10);}else{clearTimeout(dblClkTimer);dblClkTimer="";}}
226−function mClick(evt){if(sinceFirstClick!=0){if(sinceFirstClick<=40){if(evt.shiftKey){if(evt.altKey)changepicturesize(evt,2);else zoom(evt,.5);}else if(evt.altKey)zoom(evt,2);else showHideCode(evt);clearTimeout(dblClkTimer);dblClkTimer="";}else{clearTimeout(dblClkTimer);sinceFirstClick=0;dblClkTimer=setTimeout("timer()",10);}}else{sinceFirstClick=0;dblClkTimer=setTimeout("timer()",10);}}
227−function showHideCode(evt){var obj=evt.target;var name=obj.parentNode.getAttribute("name");var node=document.getElementById(name+"input");node.style.display=(node.style.display=="none"?"":"none");var node=document.getElementById(name+"button");node.style.display=(node.style.display=="none"?"":"none");}
228−function showcode(){}
229−function setBorder(x){border=x}
230−function initPicture(x_min,x_max,y_min,y_max){if(!initialized){setdefaults();initialized=true;if(x_min!=null)xmin=x_min;if(x_max!=null)xmax=x_max;if(y_min!=null)ymin=y_min;if(y_max!=null)ymax=y_max;if(xmin==null)xmin=defaultxmin;if(xmax==null)xmax=defaultxmax;if(typeof xmin!="number"||typeof xmax!="number"||xmin>=xmax)
231−alert("Picture requires at least two numbers: xmin < xmax");else if(y_max!=null&&(typeof y_min!="number"||typeof y_max!="number"||y_min>=y_max))
232−alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");else{if(width==null){width=picture.getAttribute("width");if(width==null||width=="")width=defaultwidth;}
233−picture.setAttribute("width",width);if(height==null){height=picture.getAttribute("height");if(height==null||height=="")height=defaultheight;}
234−picture.setAttribute("height",height);xunitlength=(width-2*border)/(xmax-xmin);yunitlength=xunitlength;if(ymin==null){origin=[-xmin*xunitlength+border,height/2];ymin=-(height-2*border)/(2*yunitlength);ymax=-ymin;}else{if(ymax!=null)yunitlength=(height-2*border)/(ymax-ymin);else ymax=(height-2*border)/yunitlength+ymin;origin=[-xmin*xunitlength+border,-ymin*yunitlength+border];}
235−if(isIE){if(picture.FULLSCREEN==undefined){setTimeout('drawPictures()',50);throw"wait";}
236−svgpicture=picture.getSVGDocument().getElementById("root");if(svgpicture==null){setTimeout('drawPictures()',50);throw"wait";}
237−svgpicture=picture.getSVGDocument().getElementById("root");while(svgpicture.childNodes.length>0)
238−svgpicture.removeChild(svgpicture.lastChild);svgpicture.setAttribute("width",width);svgpicture.setAttribute("height",height);svgpicture.setAttribute("name",picture.getAttribute("id"));doc=picture.getSVGDocument();}else{var qnode=document.createElementNS("http://www.w3.org/2000/svg","svg");qnode.setAttribute("id",picture.getAttribute("id"));qnode.setAttribute("name",picture.getAttribute("id"));qnode.setAttribute("width",picture.getAttribute("width"));qnode.setAttribute("height",picture.getAttribute("height"));picturepos=findPos(picture);if(picture.parentNode!=null){picture.parentNode.replaceChild(qnode,picture);}else{svgpicture.parentNode.replaceChild(qnode,svgpicture);}
239−svgpicture=qnode;doc=document;}
240−var nd=document.getElementById(picture.getAttribute("id")+"mml");if(nd!=null)
241−while(nd.childNodes.length>0)nd.removeChild(nd.lastChild);svgpicture.setAttribute("xunitlength",xunitlength);svgpicture.setAttribute("yunitlength",yunitlength);svgpicture.setAttribute("xmin",xmin);svgpicture.setAttribute("xmax",xmax);svgpicture.setAttribute("ymin",ymin);svgpicture.setAttribute("ymax",ymax);svgpicture.setAttribute("ox",origin[0]);svgpicture.setAttribute("oy",origin[1]);var node=myCreateElementSVG("rect");node.setAttribute("x","0");node.setAttribute("y","0");node.setAttribute("width",width);node.setAttribute("height",height);node.setAttribute("style",backgroundstyle);svgpicture.appendChild(node);svgpicture.setAttribute("onmousemove","displayCoord(evt)");svgpicture.setAttribute("onmouseout","removeCoord(evt)");svgpicture.setAttribute("onclick","mClick(evt)");node=myCreateElementSVG("text");node.appendChild(doc.createTextNode(" "));node.setAttribute("id","coords");svgpicture.appendChild(node);node=myCreateElementSVG("text");node.appendChild(doc.createTextNode(" "));node.setAttribute("id","coords");svgpicture.appendChild(node);border=defaultborder;}}}
242−function line(p,q,id,endpts){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
243−node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+
244−(height-p[1]*yunitlength-origin[1])+" "+
245−(q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));node.setAttribute("stroke-width",strokewidth);if(strokedasharray!=null)
246−node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="dot"||marker=="arrowdot"){ASdot(p,markersize,markerstroke,markerfill);if(marker=="arrowdot")arrowhead(p,q);ASdot(q,markersize,markerstroke,markerfill);}else if(marker=="arrow")arrowhead(p,q);if(endpts==null&&endpoints!="")endpts=endpoints;if(endpts!=null){if(endpts.indexOf("<-")!=-1)arrowhead(q,p);if(endpts.indexOf("o-")!=-1)dot(p,"open");if(endpts.indexOf("*-")!=-1)dot(p,"closed");if(endpts.indexOf("->")!=-1)arrowhead(p,q);if(endpts.indexOf("-o")!=-1)dot(q,"open");if(endpts.indexOf("-*")!=-1)dot(q,"closed");}}
247−function path(plist,id,c,endpts){if(c==null)c="";var node,st,i;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
248−if(typeof plist=="string")st=plist;else{st="M";st+=(plist[0][0]*xunitlength+origin[0])+","+
249−(height-plist[0][1]*yunitlength-origin[1])+" "+c;for(i=1;i<plist.length;i++)
250−st+=(plist[i][0]*xunitlength+origin[0])+","+
251−(height-plist[i][1]*yunitlength-origin[1])+" ";}
252−node.setAttribute("d",st);node.setAttribute("stroke-width",strokewidth);if(strokedasharray!=null)
253−node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="dot"||marker=="arrowdot")
254−for(i=0;i<plist.length;i++)
255−if(c!="C"&&c!="T"||i!=1&&i!=2)
256−ASdot(plist[i],markersize,markerstroke,markerfill);if(endpts==null&&endpoints!="")endpts=endpoints;if(endpts!=null){if(endpts.indexOf("<-")!=-1)arrowhead(plist[1],plist[0]);if(endpts.indexOf("o-")!=-1)dot(plist[0],"open");if(endpts.indexOf("*-")!=-1)dot(plist[0],"closed");if(endpts.indexOf("->")!=-1)arrowhead(plist[plist.length-2],plist[plist.length-1]);if(endpts.indexOf("-o")!=-1)dot(plist[plist.length-1],"open");if(endpts.indexOf("-*")!=-1)dot(plist[plist.length-1],"closed");}}
257−function curve(plist,id,endpts){path(plist,id,"T",endpts);}
258−function vector(p,q,id){line(p,q,id,"","->");}
259−function circle(center,radius,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("circle");node.setAttribute("id",id);svgpicture.appendChild(node);}
260−node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("r",radius*xunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
261−function loop(p,d,id){if(d==null)d=[1,0];path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");if(marker=="arrow"||marker=="arrowdot")
262−arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);}
263−function arc(start,end,radius,id,largearc){var node,v;if(id!=null)node=doc.getElementById(id);if(largearc==null)largearc=0;if(radius==null){v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1]);}
264−if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
265−node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+
266−(height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+
267−radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+
268−(height-end[1]*yunitlength-origin[1]));node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="arrow"||marker=="arrowdot"){u=[(end[1]-start[1])/4,(start[0]-end[0])/4];v=[(end[0]-start[0])/2,(end[1]-start[1])/2];v=[start[0]+v[0]+u[0],start[1]+v[1]+u[1]];}else v=[start[0],start[1]];if(marker=="dot"||marker=="arrowdot"){ASdot(start,markersize,markerstroke,markerfill);if(marker=="arrowdot")arrowhead(v,end);ASdot(end,markersize,markerstroke,markerfill);}else if(marker=="arrow")arrowhead(v,end);}
269−function sector(center,start,end,id){var rx=start[0]-center[0],ry=start[1]-center[1];arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc");path([end,center,start],id+"path");}
270−function ellipse(center,rx,ry,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("ellipse");node.setAttribute("id",id);svgpicture.appendChild(node);}
271−node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("rx",rx*xunitlength);node.setAttribute("ry",ry*yunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
272−function triangle(p,q,r,id){path([p,q,r,p],id)}
273−function rect(p,q,id,rx,ry){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("rect");node.setAttribute("id",id);svgpicture.appendChild(node);}
274−node.setAttribute("x",p[0]*xunitlength+origin[0]);node.setAttribute("y",height-q[1]*yunitlength-origin[1]);node.setAttribute("width",(q[0]-p[0])*xunitlength);node.setAttribute("height",(q[1]-p[1])*yunitlength);if(rx!=null)node.setAttribute("rx",rx*xunitlength);if(ry!=null)node.setAttribute("ry",ry*yunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
275−function text(p,st,pos,id,fontsty){var dnode,node,dx=0,dy=fontsize/3,str=st.toString();if(/(`|\$)/.test(str)){dnode=document.getElementById(svgpicture.getAttribute("name")+"mml");if(dnode!=null){if(id!=null)node=document.getElementById(id);if(node==null){node=createElementXHTML("div");node.setAttribute("id",id);node.style.position="absolute";dnode.appendChild(node);}
276−while(node.childNodes.length>0)node.removeChild(node.lastChild);node.appendChild(document.createTextNode(str));if(/`/.test(str))AMprocessNode(node);else LMprocessNode(node);dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(pos!=null){if(/above/.test(pos))dy=-node.offsetHeight;if(/below/.test(pos))dy=0;if(/right/.test(pos))dx=0;if(/left/.test(pos))dx=-node.offsetWidth;}
277−node.style.left=""+(p[0]*xunitlength+origin[0]+dx)+"px";node.style.top=""+(height-p[1]*yunitlength-origin[1]+dy)+"px";}
278−return p;}
279−var textanchor="middle";if(pos!=null){if(/above/.test(pos))dy=-fontsize/2;if(/below/.test(pos))dy=fontsize-0;if(/right/.test(pos)){textanchor="start";dx=fontsize/4;}
280−if(/left/.test(pos)){textanchor="end";dx=-fontsize/4;}}
281−if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("text");node.setAttribute("id",id);svgpicture.appendChild(node);node.appendChild(doc.createTextNode(str));}
282−while(node.childNodes.length>1)node.removeChild(node.lastChild);node.lastChild.nodeValue="\xA0"+str+"\xA0";node.setAttribute("x",p[0]*xunitlength+origin[0]+dx);node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy);node.setAttribute("font-style",(fontsty!=null?fontsty:(str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle)));node.setAttribute("font-family",fontfamily);node.setAttribute("font-size",fontsize);node.setAttribute("font-weight",fontweight);node.setAttribute("text-anchor",textanchor);if(fontstroke!="none")node.setAttribute("stroke",fontstroke);if(fontfill!="none")node.setAttribute("fill",fontfill);return p;}
283−function mtext(p,st,pos,fontsty,fontsz){var textanchor="middle";var dx=0;var dy=fontsize/3;if(pos!=null){if(pos.slice(0,5)=="above")dy=-fontsize/2;if(pos.slice(0,5)=="below")dy=fontsize-0;if(pos.slice(0,5)=="right"||pos.slice(5,10)=="right"){textanchor="start";dx=fontsize/2;}
284−if(pos.slice(0,4)=="left"||pos.slice(5,9)=="left"){textanchor="end";dx=-fontsize/2;}}
285−var node=this;if(this.nodeName=="svg"){node=myCreateElementSVG("text");this.appendChild(node);node.appendChild(doc.createTextNode(st));}
286−node.lastChild.nodeValue=st;node.setAttribute("x",p[0]+dx);node.setAttribute("y",p[1]+dy);node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));node.setAttribute("font-family",fontfamily);node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize));node.setAttribute("font-weight",fontweight);node.setAttribute("text-anchor",textanchor);if(fontstroke!="none")node.setAttribute("stroke",fontstroke);if(fontfill!="none")node.setAttribute("fill",fontfill);}
287−function image(imgurl,p,w,h,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("image");node.setAttribute("id",id);svgpicture.appendChild(node);}
288−node.setAttribute("x",p[0]*xunitlength+origin[0]);node.setAttribute("y",height-p[1]*yunitlength-origin[1]);node.setAttribute("width",w);node.setAttribute("height",h);node.setAttribute("xlink:href",imgurl);}
289−function ASdot(center,radius,s,f){if(s==null)s=stroke;if(f==null)f=fill;var node=myCreateElementSVG("circle");node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("r",radius);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",s);node.setAttribute("fill",f);svgpicture.appendChild(node);}
290−function dot(center,typ,label,pos,id){var node;var cx=center[0]*xunitlength+origin[0];var cy=height-center[1]*yunitlength-origin[1];if(id!=null)node=doc.getElementById(id);if(typ=="+"||typ=="-"||typ=="|"){if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
291−if(typ=="+"){node.setAttribute("d"," M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+" M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));node.setAttribute("stroke-width",.5);node.setAttribute("stroke",axesstroke);}else{if(typ=="-")node.setAttribute("d"," M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);else node.setAttribute("d"," M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);}}else{if(node==null){node=myCreateElementSVG("circle");node.setAttribute("id",id);svgpicture.appendChild(node);}
292−node.setAttribute("cx",cx);node.setAttribute("cy",cy);node.setAttribute("r",dotradius);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",(typ=="open"?"white":(typ=="closed"?stroke:markerfill)));}
293−if(label!=null)
294−text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))}
295−point=dot;function arrowhead(p,q){var up;var v=[p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];var w=[q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];var u=[w[0]-v[0],w[1]-v[1]];var d=Math.sqrt(u[0]*u[0]+u[1]*u[1]);if(d>0.00000001){u=[u[0]/d,u[1]/d];up=[-u[1],u[0]];var node=myCreateElementSVG("path");node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+
296−(w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+
297−(w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");node.setAttribute("stroke-width",markerstrokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",stroke);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);svgpicture.appendChild(node);}}
298−function chopZ(st){var k=st.indexOf(".");if(k==-1)return st;for(var i=st.length-1;i>k&&st.charAt(i)=="0";i--);if(i==k)i--;return st.slice(0,i+1);}
299−function grid(dx,dy){axes(dx,dy,null,dx,dy)}
300−function noaxes(){if(!initialized)initPicture();}
301−function axes(dx,dy,labels,gdx,gdy){var x,y,ldx,ldy,lx,ly,lxp,lyp,pnode,st;if(!initialized)initPicture();if(typeof dx=="string"){labels=dx;dx=null;}
302−if(typeof dy=="string"){gdx=dy;dy=null;}
303−if(xscl!=null){dx=xscl;gdx=xscl;labels=dx}
304−if(yscl!=null){dy=yscl;gdy=yscl}
305−if(xtick!=null){dx=xtick}
306−if(ytick!=null){dy=ytick}
307−dx=(dx==null?xunitlength:dx*xunitlength);dy=(dy==null?dx:dy*yunitlength);fontsize=Math.min(dx/2,dy/2,16);ticklength=fontsize/4;if(xgrid!=null)gdx=xgrid;if(ygrid!=null)gdy=ygrid;if(gdx!=null){gdx=(typeof gdx=="string"?dx:gdx*xunitlength);gdy=(gdy==null?dy:gdy*yunitlength);pnode=myCreateElementSVG("path");st="";for(x=origin[0];x<width;x=x+gdx)
308−st+=" M"+x+",0"+" "+x+","+height;for(x=origin[0]-gdx;x>0;x=x-gdx)
309−st+=" M"+x+",0"+" "+x+","+height;for(y=height-origin[1];y<height;y=y+gdy)
310−st+=" M0,"+y+" "+width+","+y;for(y=height-origin[1]-gdy;y>0;y=y-gdy)
311−st+=" M0,"+y+" "+width+","+y;pnode.setAttribute("d",st);pnode.setAttribute("stroke-width",.5);pnode.setAttribute("stroke",gridstroke);pnode.setAttribute("fill",fill);svgpicture.appendChild(pnode);}
312−pnode=myCreateElementSVG("path");st="M0,"+(height-origin[1])+" "+width+","+
313−(height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height;for(x=origin[0]+dx;x<width;x=x+dx)
314−st+=" M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
315−(height-origin[1]-ticklength);for(x=origin[0]-dx;x>0;x=x-dx)
316−st+=" M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
317−(height-origin[1]-ticklength);for(y=height-origin[1]+dy;y<height;y=y+dy)
318−st+=" M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;for(y=height-origin[1]-dy;y>0;y=y-dy)
319−st+=" M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;if(labels!=null)with(Math){ldx=dx/xunitlength;ldy=dy/yunitlength;lx=(xmin>0||xmax<0?xmin:0);ly=(ymin>0||ymax<0?ymin:0);lxp=(ly==0?"below":"above");lyp=(lx==0?"left":"right");var ddx=floor(1.1-log(ldx)/log(10))+1;var ddy=floor(1.1-log(ldy)/log(10))+1;for(x=ldx;x<=xmax;x=x+ldx)
320−text([x,ly],chopZ(x.toFixed(ddx)),lxp);for(x=-ldx;xmin<=x;x=x-ldx)
321−text([x,ly],chopZ(x.toFixed(ddx)),lxp);for(y=ldy;y<=ymax;y=y+ldy)
322−text([lx,y],chopZ(y.toFixed(ddy)),lyp);for(y=-ldy;ymin<=y;y=y-ldy)
323−text([lx,y],chopZ(y.toFixed(ddy)),lyp);}
324−fontsize=defaultfontsize;pnode.setAttribute("d",st);pnode.setAttribute("stroke-width",.5);pnode.setAttribute("stroke",axesstroke);pnode.setAttribute("fill",fill);pnode.setAttribute("stroke-opacity",strokeopacity);pnode.setAttribute("fill-opacity",fillopacity);svgpicture.appendChild(pnode);}
325−function mathjs(st){st=st.replace(/\s/g,"");if(st.indexOf("^-1")!=-1){st=st.replace(/sin\^-1/g,"arcsin");st=st.replace(/cos\^-1/g,"arccos");st=st.replace(/tan\^-1/g,"arctan");st=st.replace(/sec\^-1/g,"arcsec");st=st.replace(/csc\^-1/g,"arccsc");st=st.replace(/cot\^-1/g,"arccot");st=st.replace(/sinh\^-1/g,"arcsinh");st=st.replace(/cosh\^-1/g,"arccosh");st=st.replace(/tanh\^-1/g,"arctanh");st=st.replace(/sech\^-1/g,"arcsech");st=st.replace(/csch\^-1/g,"arccsch");st=st.replace(/coth\^-1/g,"arccoth");}
326−st=st.replace(/^e$/g,"(Math.E)");st=st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1");st=st.replace(/([^a-zA-Z])e/g,"$1(Math.E)");st=st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");st=st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");var i,j,k,ch,nested;while((i=st.indexOf("^"))!=-1){if(i==0)return"Error: missing argument";j=i-1;ch=st.charAt(j);if(ch>="0"&&ch<="9"){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;if(ch=="."){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;}}else if(ch==")"){nested=1;j--;while(j>=0&&nested>0){ch=st.charAt(j);if(ch=="(")nested--;else if(ch==")")nested++;j--;}
327−while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
328−j--;}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){j--;while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
329−j--;}else{return"Error: incorrect syntax in "+st+" at position "+j;}
330−if(i==st.length-1)return"Error: missing argument";k=i+1;ch=st.charAt(k);if(ch>="0"&&ch<="9"||ch=="-"){k++;while(k<st.length&&(ch=st.charAt(k))>="0"&&ch<="9")k++;if(ch=="."){k++;while(k<st.length&&(ch=st.charAt(k))>="0"&&ch<="9")k++;}}else if(ch=="("){nested=1;k++;while(k<st.length&&nested>0){ch=st.charAt(k);if(ch=="(")nested++;else if(ch==")")nested--;k++;}}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){k++;while(k<st.length&&(ch=st.charAt(k))>="a"&&ch<="z"||ch>="A"&&ch<="Z")k++;}else{return"Error: incorrect syntax in "+st+" at position "+k;}
331−st=st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+
332−st.slice(k);}
333−while((i=st.indexOf("!"))!=-1){if(i==0)return"Error: missing argument";j=i-1;ch=st.charAt(j);if(ch>="0"&&ch<="9"){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;if(ch=="."){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;}}else if(ch==")"){nested=1;j--;while(j>=0&&nested>0){ch=st.charAt(j);if(ch=="(")nested--;else if(ch==")")nested++;j--;}
334−while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
335−j--;}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){j--;while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
336−j--;}else{return"Error: incorrect syntax in "+st+" at position "+j;}
337−st=st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);}
338−return st;}
339−function plot(fun,x_min,x_max,points,id,endpts){var pth=[];var f=function(x){return x},g=fun;var name=null;if(typeof fun=="string")
340−eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");else if(typeof fun=="object"){eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");}
341−if(typeof x_min=="string"){name=x_min;x_min=xmin}
342−else name=id;var min=(x_min==null?xmin:x_min);var max=(x_max==null?xmax:x_max);var inc=max-min-0.000001*(max-min);inc=(points==null?inc/200:inc/points);var gt;for(var t=min;t<=max;t+=inc){gt=g(t);if(!(isNaN(gt)||Math.abs(gt)=="Infinity"))pth[pth.length]=[f(t),gt];}
343−path(pth,name,null,endpts);return pth;}
344−function slopefield(fun,dx,dy){var g=fun;if(typeof fun=="string")
345−eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");var gxy,x,y,u,v,dz;if(dx==null)dx=1;if(dy==null)dy=1;dz=Math.sqrt(dx*dx+dy*dy)/6;var x_min=Math.ceil(xmin/dx);var y_min=Math.ceil(ymin/dy);for(x=x_min;x<=xmax;x+=dx)
346−for(y=y_min;y<=ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)=="Infinity"){u=0;v=dz;}
347−else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u;}
348−line([x-u,y-v],[x+u,y+v]);}}}
349−function show_props(obj){var result="";for(var i=0;i<obj.childNodes.length;i++)
350−result+=obj.childNodes.item(i)+"\n";return result;}
351−function displayCoord(evt){if(showcoordinates){var svgroot=evt.target.parentNode;var nl=svgroot.childNodes;for(var i=0;i<nl.length&&nl.item(i).nodeName!="text";i++);var cnode=nl.item(i);cnode.mtext=mtext;cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")","left","","11");}}
352−function removeCoord(evt){var svgroot=evt.target.parentNode;var nl=svgroot.childNodes;for(var i=0;i<nl.length&&nl.item(i).nodeName!="text";i++);var cnode=nl.item(i);cnode.mtext=mtext;cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"","aboveleft","");}
353−function initASCIIMathCalculators(li){var i;for(i=0;i<li.length;i++){li[i].innerHTML=calcstr;AMprocessNode(li[i]);}
354−li=document.getElementsByTagName("textarea");var st;for(i=0;i<li.length;i++){st=li[i].getAttribute("onkeyup");if(st!=null)eval(String(st).replace(/function anonymous\(\)/,""));}}
355−function calculate(inputId,outputId){var str=document.getElementById(inputId).value;var err="";var ind=str.lastIndexOf("\n");if(ind==str.length-1)str=str.slice(0,ind);str=str.slice(str.lastIndexOf("\n")+1);try{var res=eval(mathjs(str));}catch(e){err="syntax incomplete";}
356−if(!isNaN(res)&&res!="Infinity")
357−str="`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err;else if(str!="")str="`"+str+"` = undefined";var outnode=document.getElementById(outputId);var n=outnode.childNodes.length;for(var i=0;i<n;i++)
358−outnode.removeChild(outnode.firstChild);outnode.appendChild(document.createTextNode(str));AMprocessNode(outnode);}
359−function append(st){document.getElementById('in').value+=st;calculate('in','out');document.getElementById('in').scrollTop=1000;document.getElementById('in').focus();}
360−function clearTextArea(){document.getElementById('in').value="";calculate('in','out');document.getElementById('in').focus();}
361−var calcstr="<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: &nbsp; &nbsp; <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\">&nbsp;`C`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button></td>\n<td><button onclick=\"append('sin(')\">&nbsp;`sin`</button></td>\n<td><button onclick=\"append('cos(')\">&nbsp;`cos`</button></td>\n<td><button onclick=\"append('tan(')\">&nbsp;`tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\">&nbsp; `!` &nbsp;</button></td>\n\n<td><button onclick=\"append('(')\"><font size=2>&nbsp;&nbsp;`(`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append(')')\"><font size=2>&nbsp;&nbsp;`)`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\">&nbsp;`-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\">&nbsp; `7` &nbsp;</button></td>\n<td><button onclick=\"append('8')\">&nbsp; `8` &nbsp;</button></td>\n\n<td><button onclick=\"append('9')\">&nbsp; `9` &nbsp;</button></td>\n<td><button onclick=\"append('*')\">&nbsp;`times`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\">&nbsp;`ln`&nbsp;</button></td>\n<td><button onclick=\"append('4')\">&nbsp; `4` &nbsp;</button></td>\n<td><button onclick=\"append('5')\">&nbsp; `5` &nbsp;</button></td>\n<td><button onclick=\"append('6')\">&nbsp; `6` &nbsp;</button></td>\n\n<td><button onclick=\"append('-')\">&nbsp;`-{::}`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\">&nbsp; `e` &nbsp;</button></td>\n<td><button onclick=\"append('1')\">&nbsp;&nbsp;`1` &nbsp;</button></td>\n<td><button onclick=\"append('2')\">&nbsp; `2` &nbsp;</button></td>\n<td><button onclick=\"append('3')\">&nbsp; `3` &nbsp;</button></td>\n<td><button onclick=\"append('+')\">&nbsp;`+{::}`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button--></td>\n<td><button onclick=\"append('0')\">&nbsp; `0` &nbsp;</button></td>\n<td><button onclick=\"append('.')\">&nbsp; `.` &nbsp;</button></td>\n<td><button onclick=\"append('\\n')\">&nbsp;`\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>";function generic()
362−{if(!init())return;if(translateOnLoad){var nd=document.getElementById("processasciimathinmoodle");if(nd!=null)dsvglocation=nd.className;if(nd!=null||!checkforprocessasciimathinmoodle){translate();if(!noSVG&&translateASCIIsvg)drawPictures();}
363−var li=getElementsByClass(document,"div","ASCIIMathCalculator");if(!noMathML&&li.length>0)initASCIIMathCalculators(li);}};if(typeof window.addEventListener!='undefined')
364−{window.addEventListener('load',generic,false);}
365−else if(typeof document.addEventListener!='undefined')
366−{document.addEventListener('load',generic,false);}
367−else if(typeof window.attachEvent!='undefined')
368−{window.attachEvent('onload',generic);}
369−else
370−{if(typeof window.onload=='function')
371−{var existing=onload;window.onload=function()
372−{existing();generic();};}
373−else
374−{window.onload=generic;}}
data/LaTeXMathML.js.commentnew file+16
@@ -0,0 +1,16 @@
1+/*
2+LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/
3+Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,
4+(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.
5+
6+This program is free software; you can redistribute it and/or modify
7+it under the terms of the GNU General Public License as published by
8+the Free Software Foundation; either version 2 of the License, or (at
9+your option) any later version.
10+
11+This program is distributed in the hope that it will be useful,
12+but WITHOUT ANY WARRANTY; without even the implied warranty of
13+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+General Public License (at http://www.gnu.org/copyleft/gpl.html)
15+for more details.
16+*/
data/LaTeXMathML.js.packednew file+191
@@ -0,0 +1,191 @@
1+
2+var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var mathcolor="";var mathfontfamily="";var showasciiformulaonhover=true;var isIE=document.createElementNS==null;if(document.getElementById==null)
3+alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
4+function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}
5+function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")
6+nd.appendChild(AMcreateElementXHTML("p"));nd.appendChild(document.createTextNode("To view the "));var an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("LaTeXMathML"));an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("MathPlayer"));an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");nd.appendChild(an);nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));nd.appendChild(AMcreateElementXHTML("p"));return nd;}
7+function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")
8+if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")
9+try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}
10+else return AMnoMathMLNote();}
11+var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,TEXT=9,BIG=10,LONG=11,STRETCHY=12,MATRIX=13;var AMsqrt={input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},AMroot={input:"\\root",tag:"mroot",output:"root",ttype:BINARY},AMfrac={input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},AMover={input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},AMatop={input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},AMchoose={input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},AMsub={input:"_",tag:"msub",output:"_",ttype:INFIX},AMsup={input:"^",tag:"msup",output:"^",ttype:INFIX},AMtext={input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},AMmbox={input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT};var AMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},AMsqrt,AMroot,AMfrac,AMover,AMsub,AMsup,AMtext,AMmbox,AMatop,AMchoose,{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\uFE37",ttype:UNARY,acc:true},{input:"\\overbracket",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\uFE38",ttype:UNARY,acc:true},{input:"\\underbracket",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk},{input:"\\textcolor",tag:"mstyle",atname:"mathvariant",atval:"mathcolor",ttype:BINARY},{input:"\\colorbox",tag:"mstyle",atname:"mathvariant",atval:"background",ttype:BINARY}];function compareNames(s1,s2){if(s1.input>s2.input)return 1
12+else return-1;}
13+var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}
14+var AMmathml="http://www.w3.org/1998/Math/MathML";function AMcreateElementMathML(t){if(isIE)return document.createElement("m:"+t);else return document.createElementNS(AMmathml,t);}
15+function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}
16+function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}
17+function AMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
18+function AMposition(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}
19+return h;}else
20+for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}
21+function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=AMposition(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}
22+more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}
23+AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}
24+AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}
25+var AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
26+return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
27+return[null,str,null];}
28+str=AMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=AMcreateElementMathML(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=AMgetSymbol(str);symbol.ttype=UNDEROVER;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}
29+return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")
30+output="\u2032";else if(symbol.input=="''")
31+output="\u2033";else if(symbol.input=="'''")
32+output="\u2033\u2032";else if(symbol.input=="''''")
33+output="\u2033\u2033";else if(symbol.input=="\\square")
34+output="\u25A1";else if(symbol.input.substr(0,5)=="\\frac"){var denom=symbol.input.substr(6,1);if(denom=="5"||denom=="6"){str=symbol.input.replace(/\\frac/,"\\frac ")+str;return[node,str,symbol.tag];}}}
35+node=AMcreateMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=AMcreateMmlNode("mover",node);node.appendChild(AMcreateElementMathML("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")
36+symbol.output="\\";node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}
37+node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)
38+return[node,str,symbol.rtag];else
39+return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)
40+atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)
41+return[null,str,null];str=AMremoveCharsAndBlanks(str,symbol.input.length);node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height",atval+"ex");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}
42+return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")
43+symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}
44+result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))
45+node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}
46+return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=AMgetSymbol(str);str=AMremoveCharsAndBlanks(str,0);if(symbol==null)
47+mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")
48+mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")
49+mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}
50+result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)
51+return[node,result[1],null];var lspace=AMcreateElementMathML("mspace");lspace.setAttribute("width","0.167em");var rspace=AMcreateElementMathML("mspace");rspace.setAttribute("width","0.167em");var node1=AMcreateMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);if(isIE)
52+node.setAttribute("columnspacing","0.25em");else
53+node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}
54+case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)
55+i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
56+newFrag.appendChild(AMcreateMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
57+str=AMremoveCharsAndBlanks(str,i+1);return[AMcreateMmlNode("mrow",newFrag),str,null];case UNARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=AMcreateMmlNode("mrow",AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}
58+node.appendChild(result[0]);return[node,result[1],symbol.tag];}}
59+if(symbol.input=="\\sqrt"){if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=AMcreateMmlNode(symbol.tag,result[0])
60+node.appendChild(space);return[node,result[1],symbol.tag];}else
61+return[AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=AMcreateMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")
62+output="\u0302";else if(symbol.input=="\\widehat")
63+output="\u005E";else if(symbol.input=="\\bar")
64+output="\u00AF";else if(symbol.input=="\\grave")
65+output="\u0300";else if(symbol.input=="\\tilde")
66+output="\u0303";}
67+var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")
68+node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")
69+node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")
70+node1.setAttribute("accentunder","true");else
71+node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")
72+node.ttype=UNDEROVER;return[node,result[1],symbol.tag];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)
73+if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)
74+if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+
75+String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")
76+result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
77+node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")
78+node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}
79+case BINARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=AMparseSexpr(result[1]);if(result2[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\textcolor"||symbol.input=="\\colorbox"){var tclr=str.match(/\{\s*([#\w]+)\s*\}/);str=str.replace(/\{\s*[#\w]+\s*\}/,"");if(tclr!=null){if(IsColorName.test(tclr[1].toLowerCase())){tclr=LaTeXColor[tclr[1].toLowerCase()];}else{tclr=tclr[1];}
80+node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}
81+if(symbol.input=="\\root"||symbol.input=="\\stackrel")newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}
82+function AMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)
83+result[0]=AMcreateMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=AMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);str=res2[1];tag=res2[2];node=AMcreateMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=AMcreateMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=AMcreateMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}
84+node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")
85+node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")
86+node=AMcreateMmlNode("mfenced",node);}}
87+return[node,str,tag];}
88+function AMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}
89+newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol!=null&&symbol.input==".")
90+symbol.invisible=true;if(symbol!=null)
91+tag=symbol.rtag;}
92+if(symbol!=null)
93+str=AMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)
94+if(node.childNodes[j].firstChild.nodeValue=="&")
95+pos[i][pos[i].length]=j;}
96+var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(AMcreateMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
97+row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
98+table.appendChild(AMcreateMmlNode("mtr",row));}
99+return[table,str];}
100+if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
101+return[newFrag,str,tag];}
102+function AMparseMath(str){var result,node=AMcreateElementMathML("mstyle");var cclr=str.match(/\\color\s*\{\s*([#\w]+)\s*\}/);str=str.replace(/\\color\s*\{\s*[#\w]+\s*\}/g,"");if(cclr!=null){if(IsColorName.test(cclr[1].toLowerCase())){cclr=LaTeXColor[cclr[1].toLowerCase()];}else{cclr=cclr[1];}
103+node.setAttribute("mathcolor",cclr);}else{if(mathcolor!="")node.setAttribute("mathcolor",mathcolor);};if(mathfontfamily!="")node.setAttribute("fontfamily",mathfontfamily);node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);node=AMcreateMmlNode("math",node);if(showasciiformulaonhover)
104+node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}
105+return node;}
106+function AMstrarr2docFrag(arr,linebreaks){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(AMparseMath(arr[i]));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(AMcreateElementXHTML("p"));newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}
107+expr=!expr;}
108+return newFrag;}
109+function AMprocessNodeR(n,linebreaks){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"&&n.parentNode.nodeName!="pre"&&n.parentNode.nodeName!="PRE"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)
110+arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)
111+if(alertIfNoMathML)
112+alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\nor Firefox/Mozilla/Netscape");else AMbody.insertBefore(nd,AMbody.childNodes[0]);}
113+if(!AMnoMathML){frg=AMstrarr2docFrag(arr,n.nodeType==8);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)
114+i+=AMprocessNodeR(n.childNodes[i],linebreaks);}
115+return 0;}
116+function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")
117+for(var i=0;i<frag.length;i++)
118+if(frag[i].className=="AM")
119+AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}
120+if(st==null||st.indexOf("\$")!=-1)
121+AMprocessNodeR(n,linebreaks);}
122+if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}
123+var inAppendix=false;var sectionCntr=0;var IEcommentWarning=true;var biblist=[];var bibcntr=0;var LaTeXCounter=[];LaTeXCounter["definition"]=0;LaTeXCounter["proposition"]=0;LaTeXCounter["lemma"]=0;LaTeXCounter["theorem"]=0;LaTeXCounter["corollary"]=0;LaTeXCounter["example"]=0;LaTeXCounter["exercise"]=0;LaTeXCounter["subsection"]=0;LaTeXCounter["subsubsection"]=0;LaTeXCounter["figure"]=0;LaTeXCounter["equation"]=0;LaTeXCounter["table"]=0;var LaTeXColor=[];LaTeXColor["greenyellow"]="#D9FF4F";LaTeXColor["yellow"]="#FFFF00";LaTeXColor["goldenrod"]="#FFE529";LaTeXColor["dandelion"]="#FFB529";LaTeXColor["apricot"]="#FFAD7A";LaTeXColor["peach"]="#FF804D";LaTeXColor["melon"]="#FF8A80";LaTeXColor["yelloworange"]="#FF9400";LaTeXColor["orange"]="#FF6321";LaTeXColor["burntorange"]="#FF7D00";LaTeXColor["bittersweet"]="#C20300";LaTeXColor["redorange"]="#FF3B21";LaTeXColor["mahogany"]="#A60000";LaTeXColor["maroon"]="#AD0000";LaTeXColor["brickred"]="#B80000";LaTeXColor["red"]="#FF0000";LaTeXColor["orangered"]="#FF0080";LaTeXColor["rubinered"]="#FF00DE";LaTeXColor["wildstrawberry"]="#FF0A9C";LaTeXColor["salmon"]="#FF789E";LaTeXColor["carnationpink"]="#FF5EFF";LaTeXColor["magenta"]="#FF00FF";LaTeXColor["violetred"]="#FF30FF";LaTeXColor["rhodamine"]="#FF2EFF";LaTeXColor["mulberry"]="#A314FA";LaTeXColor["redviolet"]="#9600A8";LaTeXColor["fuchsia"]="#7303EB";LaTeXColor["lavender"]="#FF85FF";LaTeXColor["thistle"]="#E069FF";LaTeXColor["orchid"]="#AD5CFF";LaTeXColor["darkorchid"]="#9933CC";LaTeXColor["purple"]="#8C24FF";LaTeXColor["plum"]="#8000FF";LaTeXColor["violet"]="#361FFF";LaTeXColor["royalpurple"]="#401AFF";LaTeXColor["blueviolet"]="#1A0DF5";LaTeXColor["periwinkle"]="#6E73FF";LaTeXColor["cadetblue"]="#616EC4";LaTeXColor["cornflowerblue"]="#59DEFF";LaTeXColor["midnightblue"]="#007091";LaTeXColor["navyblue"]="#0F75FF";LaTeXColor["royalblue"]="#0080FF";LaTeXColor["blue"]="#0000FF";LaTeXColor["cerulean"]="#0FE3FF";LaTeXColor["cyan"]="#00FFFF";LaTeXColor["processblue"]="#0AFFFF";LaTeXColor["skyblue"]="#61FFE0";LaTeXColor["turquoise"]="#26FFCC";LaTeXColor["tealblue"]="#1FFAA3";LaTeXColor["aquamarine"]="#2EFFB2";LaTeXColor["bluegreen"]="#26FFAB";LaTeXColor["emerald"]="#00FF80";LaTeXColor["junglegreen"]="#03FF7A";LaTeXColor["seagreen"]="#4FFF80";LaTeXColor["green"]="#00FF00";LaTeXColor["forestgreen"]="#00E000";LaTeXColor["pinegreen"]="#00BF29";LaTeXColor["limegreen"]="#80FF00";LaTeXColor["yellowgreen"]="#8FFF42";LaTeXColor["springgreen"]="#BDFF3D";LaTeXColor["olivegreen"]="#009900";LaTeXColor["rawsienna"]="#8C0000";LaTeXColor["sepia"]="#4D0000";LaTeXColor["brown"]="#660000";LaTeXColor["tan"]="#DB9470";LaTeXColor["gray"]="#808080";LaTeXColor["grey"]="#808080";LaTeXColor["black"]="#000000";LaTeXColor["white"]="#FFFFFF";var IsColorName=/^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;var IsCounter=/^(?:definition|proposition|lemma|theorem|corollary|example|exercise|subsection|subsubsection|figure|equation|table)$/;var IsLaTeXElement=/^(?:displayequation|title|author|address|date|abstract|keyword|section|subsection|subsubsection|ref|cite|thebibliography|definition|proposition|lemma|theorem|corollary|example|exercise|itemize|enumerate|enddefinition|endproposition|endlemma|endtheorem|endcorollary|endexample|endexercise|enditemize|endenumerate|LaTeXMathMLlabel|LaTeXMathML|smallskip|medskip|bigskip|quote|quotation|endquote|endquotation|center|endcenter|description|enddescription|inlinemath)$/;var IsTextOnlyArea=/^(?:form|textarea|pre)$/i;var tableid=0;function makeNumberString(cntr){if(sectionCntr>0){if(inAppendix){return"A"+sectionCntr+"."+cntr;}else{return sectionCntr+"."+cntr;}}else{return""+cntr;}};function LaTeXpreProcess(thebody){var TheBody=thebody;if(TheBody.hasChildNodes()){if(!(IsLaTeXElement.test(TheBody.className)))
124+{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}
125+else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))
126+{var str=TheBody.nodeValue;if(!(str==null)){str=str.replace(/\\%/g,"<per>");str=str.replace(/%[^\n]*(?=\n)/g,"");str=str.replace(/%[^\r]*(?=\r)/g,"");str=str.replace(/%[^\n]*$/,"")
127+if(isIE&&str.match(/%/g)!=null&&IEcommentWarning){alert("Comments may not have parsed properly. Try putting in <pre class='LaTeX><div>..</div></pre> structure.");IEcommentWarning=false;}
128+str=str.replace(/<per>/g,"%");if(str.match(/XXX[\s\S]*/)!=null){var tmp=str.match(/XXX[\s\S]*/)[0];var tmpstr=tmp.charCodeAt(7)+"::"+tmp.charCodeAt(8)+"::"+tmp.charCodeAt(9)+"::"+tmp.charCodeAt(10)+"::"+tmp.charCodeAt(11)+"::"+tmp.charCodeAt(12)+"::"+tmp.charCodeAt(13);alert(tmpstr);}
129+str=str.replace(/([^\\])\\(\s)/g,"$1\u00A0$2");str=str.replace(/\\quad/g,"\u2001");str=str.replace(/\\qquad/g,"\u2001\u2001");str=str.replace(/\\enspace/g,"\u2002");str=str.replace(/\\;/g,"\u2004");str=str.replace(/\\:/g,"\u2005");str=str.replace(/\\,/g,"\u2006");str=str.replace(/\\thinspace/g,"\u200A");str=str.replace(/([^\\])~/g,"$1\u00A0");str=str.replace(/\\~/g,"~");str=str.replace(/\\\[/g," <DEQ> $\\displaystyle{");str=str.replace(/\\\]/g,"}$ <DEQ> ");str=str.replace(/\$\$/g,"${$<DEQ>$}$");str=str.replace(/\\begin\s*\{\s*array\s*\}/g,"\\begin{array}");str=str.replace(/\\end\s*\{\s*array\s*\}/g,"\\end{array}");str=str.replace(/\\begin\s*\{\s*eqnarray\s*\}/g," <DEQ>eqno$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*eqnarray\*\s*\}/g," <DEQ>$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\*\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*displaymath\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*displaymath\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\*\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\*\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\}/g," <DEQ>eqno$\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\}/g,"}$ <DEQ> ");str=str.split("<DEQ>");var newFrag=document.createDocumentFragment();for(var i=0;i<str.length;i++){if(i%2){var DEQtable=document.createElement("table");DEQtable.className='displayequation';var DEQtbody=document.createElement("tbody");var DEQtr=document.createElement("tr");var DEQtdeq=document.createElement("td");DEQtdeq.className='eq';str[i]=str[i].replace(/\$\}\$/g,"$\\displaystyle{");str[i]=str[i].replace(/\$\{\$/g,"}");var lbl=str[i].match(/\\label\s*\{\s*(\w+)\s*\}/);var ISeqno=str[i].match(/^eqno/);str[i]=str[i].replace(/^eqno/," ");str[i]=str[i].replace(/\\label\s*\{\s*\w+\s*\}/," ");DEQtdeq.appendChild(document.createTextNode(str[i]));DEQtr.appendChild(DEQtdeq);str[i]=str[i].replace(/\\nonumber/g,"");if(ISeqno!=null||lbl!=null){var DEQtdno=document.createElement("td");DEQtdno.className='eqno';LaTeXCounter["equation"]++;var eqnoString=makeNumberString(LaTeXCounter["equation"]);var DEQanchor=document.createElement("a");if(lbl!=null){DEQanchor.id=lbl[1]};DEQanchor.className="eqno";var anchorSpan=document.createElement("span");anchorSpan.className="eqno";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(eqnoString));DEQanchor.appendChild(anchorSpan);DEQtdno.appendChild(DEQanchor);var DEQspan=document.createElement("span");DEQspan.className="eqno";DEQspan.appendChild(document.createTextNode("("+eqnoString+")"));DEQtdno.appendChild(DEQspan);DEQtr.appendChild(DEQtdno);}
130+DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}
131+else{str[i]=str[i].replace(/\$\}\$/g,"");str[i]=str[i].replace(/\$\{\$/g,"");str[i]=str[i].replace(/\\maketitle/g,"");str[i]=str[i].replace(/\\begin\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\end\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\documentclass[^\}]*?\}/g,"");str[i]=str[i].replace(/\\usepackage[^\}]*?\}/g,"");str[i]=str[i].replace(/\\noindent/g,"");str[i]=str[i].replace(/\\notag/g,"");str[i]=str[i].replace(/\\ref\s*\{\s*(\w+)\}/g," \\[ref\\]$1\\[ ");str[i]=str[i].replace(/\\url\s*\{\s*([^\}\n]+)\}/g," \\[url\\]$1\\[ ");str[i]=str[i].replace(/\\href\s*\{\s*([^\}]+)\}\s*\{\s*([^\}]+)\}/g," \\[href\\]$1\\]$2\\[ ");str[i]=str[i].replace(/\\cite\s*\{\s*(\w+)\}/g," \\[cite\\]$1\\[ ");str[i]=str[i].replace(/\\qed/g,"\u220E");str[i]=str[i].replace(/\\endproof/g,"\u220E");str[i]=str[i].replace(/\\proof/g,"\\textbf{Proof: }");str[i]=str[i].replace(/\\n(?=\s)/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\newline/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\linebreak/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\smallskip/g," \\[logicalbreak\\]smallskip\\[ ");str[i]=str[i].replace(/\\medskip/g," \\[logicalbreak\\]medskip\\[ ");str[i]=str[i].replace(/\\bigskip/g," \\[logicalbreak\\]bigskip\\[ ");str[i]=str[i].replace(/[\n\r]+[ \f\n\r\t\v\u2028\u2029]*[\n\r]+/g," \\[logicalbreak\\]LaTeXMathML\\[ ");if(isIE){str[i]=str[i].replace(/\r/g," ");}
132+str[i]=str[i].replace(/\\bibitem\s*([^\{]*\{\s*\w*\s*\})/g," \\[bibitem\\]$1\\[ ");str[i]=str[i].replace(/\\bibitem\s*/g," \\[bibitem\\] \\[ ");str[i]=str[i].replace(/\\item\s*\[\s*(\w+)\s*\]/g," \\[alistitem\\]$1\\[ ");str[i]=str[i].replace(/\\item\s*/g," \\[alistitem\\] \\[ ");str[i]=str[i].replace(/\\appendix/g," \\[appendix\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*figure\s*\}([\s\S]+?)\\end\s*\{\s*figure\s*\}/g," \\[figure\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*table\s*\}([\s\S]+?)\\end\s*\{\s*table\s*\}/g," \\[table\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*theorem\s*\}/g," \\[theorem\\]Theorem \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*theorem\s*\}/g," \\[endtheorem\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*definition\s*\}/g," \\[definition\\]Definition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*definition\s*\}/g," \\[enddefinition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*lemma\s*\}/g," \\[lemma\\]Lemma \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*lemma\s*\}/g," \\[endlemma\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*corollary\s*\}/g," \\[corollary\\]Corollary \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*corollary\s*\}/g," \\[endcorollary\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proposition\s*\}/g," \\[proposition\\]Proposition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*proposition\s*\}/g," \\[endproposition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*example\s*\}/g," \\[example\\]Example \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*example\s*\}/g," \\[endexample\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*exercise\s*\}/g," \\[exercise\\]Exercise \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*exercise\s*\}/g," \\[endexercise\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}\s*\{\s*\w+\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*thebibliography\s*\}/g," \\[endthebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proof\s*\}/g," \\[proof\\]Proof: \\[ ");if(isIE){str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g,"\u220E \\[endproof\\] \\[ ");}else{str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g," \\[endproof\\] \\[ ");}
133+str[i]=str[i].replace(/\\title\s*\{\s*([^\}]+)\}/g," \\[title\\] \\[$1 \\[endtitle\\] \\[ ");str[i]=str[i].replace(/\\author\s*\{\s*([^\}]+)\}/g," \\[author\\] \\[$1 \\[endauthor\\] \\[ ");str[i]=str[i].replace(/\\address\s*\{\s*([^\}]+)\}/g," \\[address\\] \\[$1 \\[endaddress\\] \\[ ");str[i]=str[i].replace(/\\date\s*\{\s*([^\}]+)\}/g," \\[date\\] \\[$1 \\[enddate\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*keyword\s*\}/g," \\[keyword\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*keyword\s*\}/g," \\[endkeyword\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*abstract\s*\}/g," \\[abstract\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*abstract\s*\}/g," \\[endabstract\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[$1\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[end$1\\] \\[ ");var sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\section\s*\{/," \\[section\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);}
134+sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsection\s*\{/," \\[subsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);}
135+sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsubsection\s*\{/," \\[subsubsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);}
136+var CatToNextEven="";var strtmp=str[i].split("\\[");for(var j=0;j<strtmp.length;j++){if(j%2){var strtmparray=strtmp[j].split("\\]");switch(strtmparray[0]){case"section":var nodeTmp=document.createElement("H2");nodeTmp.className='section';sectionCntr++;for(var div in LaTeXCounter){LaTeXCounter[div]=0};var nodeAnchor=document.createElement("a");if(inAppendix){nodeAnchor.className='appendixsection';}else{nodeAnchor.className='section';}
137+var nodeNumString=makeNumberString("");var anchorSpan=document.createElement("span");anchorSpan.className="section";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='section';nodeSpan.appendChild(document.createTextNode(nodeNumString+" "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsection":var nodeTmp=document.createElement("H3");nodeTmp.className='subsection';LaTeXCounter["subsection"]++;LaTeXCounter["subsubsection"]=0;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsubsection":var nodeTmp=document.createElement("H4");nodeTmp.className='subsubsection';LaTeXCounter["subsubsection"]++;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsubsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]+"."+LaTeXCounter["subsubsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsubsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsubsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"href":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"url":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"figure":var nodeTmp=document.createElement("table");nodeTmp.className='figure';var FIGtbody=document.createElement("tbody");var FIGlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var FIGcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;FIGcap=tmp.substring(capstart,pos);break}}}
138+var FIGtr2=document.createElement("tr");var FIGtd2=document.createElement("td");FIGtd2.className="caption";var FIGanchor=document.createElement("a");FIGanchor.className="figure";if(FIGlbl!=null){FIGanchor.id=FIGlbl[1];}
139+LaTeXCounter["figure"]++;var fignmbr=makeNumberString(LaTeXCounter["figure"]);var anchorSpan=document.createElement("span");anchorSpan.className="figure";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(fignmbr));FIGanchor.appendChild(anchorSpan);FIGtd2.appendChild(FIGanchor);var FIGspan=document.createElement("span");FIGspan.className="figure";FIGspan.appendChild(document.createTextNode("Figure "+fignmbr+". "));FIGtd2.appendChild(FIGspan);FIGtd2.appendChild(document.createTextNode(""+FIGcap));FIGtr2.appendChild(FIGtd2);FIGtbody.appendChild(FIGtr2);var IsSpecial=false;var FIGinfo=strtmparray[1].match(/\\includegraphics\s*\{([^\}]+)\}/);if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\includegraphics\s*\[[^\]]*\]\s*\{\s*([^\}]+)\s*\}/);}
140+if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\special\s*\{\s*([^\}]+)\}/);IsSpecial=true};if(FIGinfo!=null){var FIGtr1=document.createElement("tr");var FIGtd1=document.createElement("td");FIGtd1.className="image";var FIGimg=document.createElement("img");var FIGsrc=FIGinfo[1];FIGimg.src=FIGsrc;FIGimg.alt="Figure "+FIGsrc+" did not load";FIGimg.title="Figure "+fignmbr+". "+FIGcap;FIGimg.id="figure"+fignmbr;FIGtd1.appendChild(FIGimg);FIGtr1.appendChild(FIGtd1);FIGtbody.appendChild(FIGtr1);}
141+nodeTmp.appendChild(FIGtbody);newFrag.appendChild(nodeTmp);break;case"table":var nodeTmp=document.createElement("table");if(strtmparray[1].search(/\\centering/)>=0){nodeTmp.className='LaTeXtable centered';nodeTmp.align="center";}else{nodeTmp.className='LaTeXtable';};tableid++;nodeTmp.id="LaTeXtable"+tableid;var TABlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var TABcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;TABcap=tmp.substring(capstart,pos);break}}}
142+if(TABcap!=""){var TABtbody=document.createElement("tbody");var TABcaption=document.createElement("caption");TABcaption.className="LaTeXtable centered";var TABanchor=document.createElement("a");TABanchor.className="LaTeXtable";if(TABlbl!=null){TABanchor.id=TABlbl[1];}
143+LaTeXCounter["table"]++;var tabnmbr=makeNumberString(LaTeXCounter["table"]);var anchorSpan=document.createElement("span");anchorSpan.className="LaTeXtable";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(tabnmbr));TABanchor.appendChild(anchorSpan);TABcaption.appendChild(TABanchor);var TABspan=document.createElement("span");TABspan.className="LaTeXtable";TABspan.appendChild(document.createTextNode("Table "+tabnmbr+". "));TABcaption.appendChild(TABspan);TABcaption.appendChild(document.createTextNode(""+TABcap));nodeTmp.appendChild(TABcaption);}
144+var TABinfo=strtmparray[1].match(/\\begin\s*\{\s*tabular\s*\}([\s\S]+)\\end\s*\{\s*tabular\s*\}/);if(TABinfo!=null){var TABtbody=document.createElement('tbody');var TABrow=null;var TABcell=null;var row=0;var col=0;var TABalign=TABinfo[1].match(/^\s*\{([^\}]+)\}/);TABinfo=TABinfo[1].replace(/^\s*\{[^\}]+\}/,"");TABinfo=TABinfo.replace(/\\hline/g,"");TABalign[1]=TABalign[1].replace(/\|/g,"");TABalign[1]=TABalign[1].replace(/\s/g,"");TABinfo=TABinfo.split("\\\\");for(row=0;row<TABinfo.length;row++){TABrow=document.createElement("tr");TABinfo[row]=TABinfo[row].split("&");for(col=0;col<TABinfo[row].length;col++){TABcell=document.createElement("td");switch(TABalign[1].charAt(col)){case"l":TABcell.align="left";break;case"c":TABcell.align="center";break;case"r":TABcell.align="right";break;default:TABcell.align="left";};TABcell.appendChild(document.createTextNode(TABinfo[row][col]));TABrow.appendChild(TABcell);}
145+TABtbody.appendChild(TABrow);}
146+nodeTmp.appendChild(TABtbody);}
147+newFrag.appendChild(nodeTmp);break;case"logicalbreak":var nodeTmp=document.createElement("p");nodeTmp.className=strtmparray[1];nodeTmp.appendChild(document.createTextNode("\u00A0"));newFrag.appendChild(nodeTmp);break;case"appendix":inAppendix=true;sectionCntr=0;break;case"alistitem":var EndDiv=document.createElement("div");EndDiv.className="endlistitem";newFrag.appendChild(EndDiv);var BegDiv=document.createElement("div");BegDiv.className="listitem";if(strtmparray[1]!=" "){var BegSpan=document.createElement("span");BegSpan.className="listitemmarker";var boldBegSpan=document.createElement("b");boldBegSpan.appendChild(document.createTextNode(strtmparray[1]+" "));BegSpan.appendChild(boldBegSpan);BegDiv.appendChild(BegSpan);}
148+newFrag.appendChild(BegDiv);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"bibitem":newFrag.appendChild(document.createElement("br"));var nodeTmp=document.createElement("a");nodeTmp.className='bibitem';var nodeSpan=document.createElement("span");nodeSpan.className='bibitem';bibcntr++;var lbl=strtmparray[1].match(/\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\s*\{\s*\w+\s*\}/g,"");strtmparray[1]=strtmparray[1].replace(/^\s*\[/,"");strtmparray[1]=strtmparray[1].replace(/\s*\]$/,"");strtmparray[1]=strtmparray[1].replace(/^\s+|\s+$/g,"");if(lbl==null){biblist[bibcntr]="bibitem"+bibcntr}else{biblist[bibcntr]=lbl[1];};nodeTmp.name=biblist[bibcntr];nodeTmp.id=biblist[bibcntr];if(strtmparray[1]!=""){nodeSpan.appendChild(document.createTextNode(strtmparray[1]));}else{nodeSpan.appendChild(document.createTextNode("["+bibcntr+"]"));}
149+nodeTmp.appendChild(nodeSpan);newFrag.appendChild(nodeTmp);break;case"cite":var nodeTmp=document.createElement("a");nodeTmp.className='cite';nodeTmp.name='cite';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;case"ref":var nodeTmp=document.createElement("a");nodeTmp.className='ref';nodeTmp.name='ref';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("div");nodeTmp.className=strtmparray[0];if(IsCounter.test(strtmparray[0])){LaTeXCounter[strtmparray[0]]++;var nodeAnchor=document.createElement("a");nodeAnchor.className=strtmparray[0];var divnum=makeNumberString(LaTeXCounter[strtmparray[0]]);var anchorSpan=document.createElement("span");anchorSpan.className=strtmparray[0];anchorSpan.appendChild(document.createTextNode(divnum));anchorSpan.style.display="none";nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]+" "+divnum+". "));nodeTmp.appendChild(nodeSpan);}
150+if(isIE){if(strtmparray[0]==("thebibliography"||"abstract"||"keyword"||"proof")){var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]));nodeTmp.appendChild(nodeSpan);}}
151+if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}
152+newFrag.appendChild(nodeTmp);if(strtmparray[0]=="enumerate"||strtmparray[0]=="itemize"||strtmparray[0]=="description"){var endDiv=document.createElement("div");endDiv.className="listitem";newFrag.appendChild(endDiv);}}}else{strtmp[j]=strtmp[j].replace(/\\\$/g,"<per>");strtmp[j]=strtmp[j].replace(/\$([^\$]+)\$/g," \\[$1\\[ ");strtmp[j]=strtmp[j].replace(/<per>/g,"\\$");strtmp[j]=strtmp[j].replace(/\\begin\s*\{\s*math\s*\}([\s\S]+?)\\end\s*\{\s*math\s*\}/g," \\[$1\\[ ");var strtmptmp=strtmp[j].split("\\[");for(var jjj=0;jjj<strtmptmp.length;jjj++){if(jjj%2){var nodeTmp=document.createElement("span");nodeTmp.className='inlinemath';nodeTmp.appendChild(document.createTextNode("$"+strtmptmp[jjj]+"$"));newFrag.appendChild(nodeTmp);}else{var TagIndex=strtmptmp[jjj].search(/\\\w+/);var tmpIndex=TagIndex;while(tmpIndex>-1){if(/^\\textcolor/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\textcolor\s*\{\s*(\w+)\s*\}\s*/," \\[textcolor\\]$1\\]|");}else{if(/^\\colorbox/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\colorbox\s*\{\s*(\w+)\s*\}\s*/," \\[colorbox\\]$1\\]|");}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).replace(/\\\s*(\w+)\s*/," \\[$1\\]|");}}
153+TagIndex+=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\|/);TagIndex++;strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\]\|/,"\\] ");if(strtmptmp[jjj].charAt(TagIndex)=="{"){strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);var delimcnt=1;for(var kk=TagIndex;kk<strtmptmp[jjj].length;kk++){if(strtmptmp[jjj].charAt(kk)=="{"){delimcnt++};if(strtmptmp[jjj].charAt(kk)=="}"){delimcnt--};if(delimcnt==0){break;}}
154+strtmptmp[jjj]=strtmptmp[jjj].substring(0,kk)+"\\[ "+strtmptmp[jjj].substring(kk+1,strtmptmp[jjj].length);TagIndex=kk+3;}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+"\\[ "+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);TagIndex=TagIndex+3;}
155+if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}
156+else{tmpIndex=-1};TagIndex+=tmpIndex;}
157+strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\\s*\\\\/g,"\\\\");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\/g," \\[br\\] \\[ ");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\label\s*\{\s*(\w+)\s*\}/g," \\[a\\]$1\\[ ");var strlbls=strtmptmp[jjj].split("\\[");for(var jj=0;jj<strlbls.length;jj++){if(jj%2){var strtmparray=strlbls[jj].split("\\]");switch(strtmparray[0]){case"textcolor":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.color=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.color=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"colorbox":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.background=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.background=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"a":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathMLlabel';nodeTmp.id=strtmparray[1];nodeTmp.style.display="none";newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("span");nodeTmp.className=strtmparray[0];nodeTmp.appendChild(document.createTextNode(strtmparray[1]))
158+newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}
159+return TheBody;}
160+function LaTeXDivsAndRefs(thebody){var TheBody=thebody;var EndDivClass=null;var AllDivs=TheBody.getElementsByTagName("div");var lbl2id="";var lblnode=null;for(var i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){EndDivClass=EndDivClass[0];var DivClass=EndDivClass.substring(3,EndDivClass.length);var EndDivNode=AllDivs[i];break;}}
161+while(EndDivClass!=null){var newFrag=document.createDocumentFragment();var RootNode=EndDivNode.parentNode;var ClassCount=1;while(EndDivNode.previousSibling!=null&&ClassCount>0){switch(EndDivNode.previousSibling.className){case EndDivClass:ClassCount++;newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);break;case DivClass:if(EndDivNode.previousSibling.nodeName=="DIV"){ClassCount--;if(lbl2id!=""){EndDivNode.previousSibling.id=lbl2id;lbl2id=""}
162+if(ClassCount==0){RootNode=EndDivNode.previousSibling;}else{newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}};break;case'LaTeXMathMLlabel':lbl2id=EndDivNode.previousSibling.id;EndDivNode.parentNode.removeChild(EndDivNode.previousSibling);break;default:newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}}
163+RootNode.appendChild(newFrag);EndDivNode.parentNode.removeChild(EndDivNode);AllDivs=TheBody.getElementsByTagName("DIV");for(i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){ClassCount=0;EndDivClass=EndDivClass[0];DivClass=EndDivClass.substring(3,EndDivClass.length);EndDivNode=AllDivs[i];RootNode=EndDivNode.parentNode;break;}}}
164+var AllDivs=TheBody.getElementsByTagName("div");var DIV2LI=null;for(var i=0;i<AllDivs.length;i++){if(AllDivs[i].className=="itemize"||AllDivs[i].className=="enumerate"||AllDivs[i].className=="description"){if(AllDivs[i].className=="itemize"){RootNode=document.createElement("UL");}else{RootNode=document.createElement("OL");}
165+RootNode.className='LaTeXMathML';if(AllDivs[i].hasChildNodes()){AllDivs[i].removeChild(AllDivs[i].firstChild)};while(AllDivs[i].hasChildNodes()){if(AllDivs[i].firstChild.hasChildNodes()){DIV2LI=document.createElement("LI");while(AllDivs[i].firstChild.hasChildNodes()){DIV2LI.appendChild(AllDivs[i].firstChild.firstChild);}
166+if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}
167+RootNode.appendChild(DIV2LI)}
168+AllDivs[i].removeChild(AllDivs[i].firstChild);}
169+AllDivs[i].appendChild(RootNode);}}
170+var AllAnchors=TheBody.getElementsByTagName("a");for(var i=0;i<AllAnchors.length;i++){if(AllAnchors[i].className=="ref"||AllAnchors[i].className=="cite"){var label=AllAnchors[i].href.match(/\#(\w+)/);if(label!=null){var labelNode=document.getElementById(label[1]);if(labelNode!=null){var TheSpans=labelNode.getElementsByTagName("SPAN");if(TheSpans!=null){var refNode=TheSpans[0].cloneNode(true);refNode.style.display="inline"
171+refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}
172+return TheBody;}
173+var AMbody;var AMnoMathML=false,AMtranslated=false;function translate(spanclassAM){if(!AMtranslated){AMtranslated=true;AMinitSymbols();var LaTeXContainers=[];var AllContainers=document.getElementsByTagName('*');var ExtendName="";for(var k=0,l=0;k<AllContainers.length;k++){ExtendName=" "+AllContainers[k].className+" ";if(ExtendName.match(/\sLaTeX\s/)!=null){LaTeXContainers[l]=AllContainers[k];l++;}};if(LaTeXContainers.length>0){for(var m=0;m<LaTeXContainers.length;m++){AMbody=LaTeXContainers[m];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}
174+if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}
175+PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}
176+AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}
177+AMprocessNode(AMbody,false,spanclassAM);}}}
178+if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}
179+function generic()
180+{translate();};if(typeof window.addEventListener!='undefined')
181+{window.addEventListener('load',generic,false);}
182+else if(typeof document.addEventListener!='undefined')
183+{document.addEventListener('load',generic,false);}
184+else if(typeof window.attachEvent!='undefined')
185+{window.attachEvent('onload',generic);}
186+else
187+{if(typeof window.onload=='function')
188+{var existing=onload;window.onload=function()
189+{existing();generic();};}
190+else
191+{window.onload=generic;}}
man/man1/pandoc.1.md+3−3
@@ -107,9 +107,9 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
107107 only when the input format is `markdown`. It is selected automatically
108108 when the output format is `latex` or `context`.)
109109
110−-m*URL*, \--asciimathml=*URL*
111−: Use ASCIIMathML to display embedded TeX math in HTML output.
112− To insert a link to a local copy of the `ASCIIMathML.js` script,
110+-m*URL*, \--latexmathml=*URL*
111+: Use LaTeXMathML to display embedded TeX math in HTML output.
112+ To insert a link to a local copy of the `LaTeXMathML.js` script,
113113 provide a *URL*. If no *URL* is provided, the contents of the
114114 script will be inserted directly into the HTML header.
115115
pandoc.cabal+4−4
@@ -51,9 +51,9 @@ Extra-Source-Files:
5151 data/headers/OpenDocument.header,
5252 data/headers/RTF.header,
5353 data/headers/S5.header,
54− -- data for ASCIIMathML writer
55− data/ASCIIMathML.js.comment,
56− data/ASCIIMathML.js.packed,
54+ -- data for LaTeXMathML writer
55+ data/LaTeXMathML.js.comment,
56+ data/LaTeXMathML.js.packed,
5757 -- data for S5 writer
5858 data/ui/default/slides.js.comment,
5959 data/ui/default/slides.js.packed,
@@ -168,7 +168,7 @@ Library
168168 Text.Pandoc.Shared,
169169 Text.Pandoc.ODT,
170170 Text.Pandoc.PDF,
171− Text.Pandoc.ASCIIMathML,
171+ Text.Pandoc.LaTeXMathML,
172172 Text.Pandoc.DefaultHeaders,
173173 Text.Pandoc.Highlighting,
174174 Text.Pandoc.Readers.HTML,
tests/latex-reader.native+7−7
@@ -274,13 +274,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
274274, BulletList
275275 [ [ Para [TeX "\\cite[22-23]{smith.1899}"] ]
276276 , [ Para [TeX "\\doublespacing"] ]
277− , [ Para [Math "2+2=4"] ]
278− , [ Para [Math "x \\in y"] ]
279− , [ Para [Math "\\alpha \\wedge \\omega"] ]
280− , [ Para [Math "223"] ]
281− , [ Para [Math "p",Str "-",Str "Tree"] ]
282− , [ Para [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
283− , [ 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 "."] ] ]
277+ , [ Para [Math InlineMath "2+2=4"] ]
278+ , [ Para [Math InlineMath "x \\in y"] ]
279+ , [ Para [Math InlineMath "\\alpha \\wedge \\omega"] ]
280+ , [ Para [Math InlineMath "223"] ]
281+ , [ Para [Math InlineMath "p",Str "-",Str "Tree"] ]
282+ , [ Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
283+ , [ 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 "."] ] ]
284284, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
285285, BulletList
286286 [ [ Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
tests/s5.fancy.html+155−325
@@ -9,151 +9,89 @@
99 /><meta name="author" content="Jen Jones"
1010 /><meta name="date" content="July 15, 2006"
1111 /><script type="text/javascript">
12−/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
13− See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
14−var mathcolor="";var mathfontsize="1em";var mathfontfamily="serif";var automathrecognize=false;var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var translateOnLoad=true;var translateLaTeX=true;var translateLaTeXformatting=true;var translateASCIIMath=true;var translateASCIIsvg=true;var avoidinnerHTML=false;var displaystyle=true;var showasciiformulaonhover=true;var decimalsign=".";var AMdelimiter1="`",AMescape1="\\\\`";var AMdocumentId="wikitext"
15−var checkforprocessasciimathinmoodle=false;var dsvglocation="";var isIE=document.createElementNS==null;var noMathML=false,translated=false;if(isIE){document.write("<object id=\"mathplayer\"\
16− classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}
17−function setStylesheet(s){var id="AMMLcustomStyleSheet";var n=document.getElementById(id);if(document.createStyleSheet){if(n)
18−n.parentNode.removeChild(n);document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd","&nbsp;<style id='"+id+"'>"+s+"</style>");}else{if(n){n.replaceChild(document.createTextNode(s),n.firstChild);}else{n=document.createElement("style");n.type="text/css";n.id=id;n.appendChild(document.createTextNode(s));document.getElementsByTagName("head")[0].appendChild(n);}}}
19−setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}");function init(){var msg,warnings=new Array();if(document.getElementById==null){alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer");return null;}
20−if(checkForMathML&&(msg=checkMathML()))warnings.push(msg);if(checkIfSVGavailable&&(msg=checkSVG()))warnings.push(msg);if(warnings.length>0)displayWarnings(warnings);if(!noMathML)initSymbols();return true;}
21−function checkMathML(){if(navigator.appName.slice(0,8)=="Netscape")
22−if(navigator.appVersion.slice(0,1)>="5")noMathML=null;else noMathML=true;else if(navigator.appName.slice(0,9)=="Microsoft")
23−try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");noMathML=null;}catch(e){noMathML=true;}
24−else noMathML=true;if(noMathML&&notifyIfNoMathML){var msg="To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.";if(alertIfNoMathML)
25−alert(msg);else return msg;}}
26−function hideWarning(){var body=document.getElementsByTagName("body")[0];body.removeChild(document.getElementById('AMMLwarningBox'));body.onclick=null;}
27−function displayWarnings(warnings){var i,frag,nd=createElementXHTML("div");var body=document.getElementsByTagName("body")[0];body.onclick=hideWarning;nd.id='AMMLwarningBox';for(i=0;i<warnings.length;i++){frag=createElementXHTML("div");frag.appendChild(document.createTextNode(warnings[i]));frag.style.paddingBottom="1.0em";nd.appendChild(frag);}
28−nd.appendChild(createElementXHTML("p"));nd.appendChild(document.createTextNode("For instructions see the "));var an=createElementXHTML("a");an.appendChild(document.createTextNode("ASCIIMathML"));an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" homepage"));an=createElementXHTML("div");an.id='AMMLcloseDiv';an.appendChild(document.createTextNode('(click anywhere to close this warning)'));nd.appendChild(an);var body=document.getElementsByTagName("body")[0];body.insertBefore(nd,body.childNodes[0]);}
29−function translate(spanclassAM){if(!translated){translated=true;var body=document.getElementsByTagName("body")[0];var processN=document.getElementById(AMdocumentId);if(translateLaTeX)LMprocessNode((processN!=null?processN:body));if(translateASCIIMath)AMprocessNode((processN!=null?processN:body),false,spanclassAM);}}
30−function createElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}
31−function createMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS("http://www.w3.org/1998/Math/MathML",t);if(frag)node.appendChild(frag);return node;}
32−var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,LEFTRIGHT=9,TEXT=10,BIG=11,LONG=12,STRETCHY=13,MATRIX=14;;var AMquote={input:"\"",tag:"mtext",output:"mbox",tex:null,ttype:TEXT};var AMsymbols=[{input:"alpha",tag:"mi",output:"\u03B1",tex:null,ttype:CONST},{input:"beta",tag:"mi",output:"\u03B2",tex:null,ttype:CONST},{input:"chi",tag:"mi",output:"\u03C7",tex:null,ttype:CONST},{input:"delta",tag:"mi",output:"\u03B4",tex:null,ttype:CONST},{input:"Delta",tag:"mo",output:"\u0394",tex:null,ttype:CONST},{input:"epsi",tag:"mi",output:"\u03B5",tex:"epsilon",ttype:CONST},{input:"varepsilon",tag:"mi",output:"\u025B",tex:null,ttype:CONST},{input:"eta",tag:"mi",output:"\u03B7",tex:null,ttype:CONST},{input:"gamma",tag:"mi",output:"\u03B3",tex:null,ttype:CONST},{input:"Gamma",tag:"mo",output:"\u0393",tex:null,ttype:CONST},{input:"iota",tag:"mi",output:"\u03B9",tex:null,ttype:CONST},{input:"kappa",tag:"mi",output:"\u03BA",tex:null,ttype:CONST},{input:"lambda",tag:"mi",output:"\u03BB",tex:null,ttype:CONST},{input:"Lambda",tag:"mo",output:"\u039B",tex:null,ttype:CONST},{input:"mu",tag:"mi",output:"\u03BC",tex:null,ttype:CONST},{input:"nu",tag:"mi",output:"\u03BD",tex:null,ttype:CONST},{input:"omega",tag:"mi",output:"\u03C9",tex:null,ttype:CONST},{input:"Omega",tag:"mo",output:"\u03A9",tex:null,ttype:CONST},{input:"phi",tag:"mi",output:"\u03C6",tex:null,ttype:CONST},{input:"varphi",tag:"mi",output:"\u03D5",tex:null,ttype:CONST},{input:"Phi",tag:"mo",output:"\u03A6",tex:null,ttype:CONST},{input:"pi",tag:"mi",output:"\u03C0",tex:null,ttype:CONST},{input:"Pi",tag:"mo",output:"\u03A0",tex:null,ttype:CONST},{input:"psi",tag:"mi",output:"\u03C8",tex:null,ttype:CONST},{input:"Psi",tag:"mi",output:"\u03A8",tex:null,ttype:CONST},{input:"rho",tag:"mi",output:"\u03C1",tex:null,ttype:CONST},{input:"sigma",tag:"mi",output:"\u03C3",tex:null,ttype:CONST},{input:"Sigma",tag:"mo",output:"\u03A3",tex:null,ttype:CONST},{input:"tau",tag:"mi",output:"\u03C4",tex:null,ttype:CONST},{input:"theta",tag:"mi",output:"\u03B8",tex:null,ttype:CONST},{input:"vartheta",tag:"mi",output:"\u03D1",tex:null,ttype:CONST},{input:"Theta",tag:"mo",output:"\u0398",tex:null,ttype:CONST},{input:"upsilon",tag:"mi",output:"\u03C5",tex:null,ttype:CONST},{input:"xi",tag:"mi",output:"\u03BE",tex:null,ttype:CONST},{input:"Xi",tag:"mo",output:"\u039E",tex:null,ttype:CONST},{input:"zeta",tag:"mi",output:"\u03B6",tex:null,ttype:CONST},{input:"*",tag:"mo",output:"\u22C5",tex:"cdot",ttype:CONST},{input:"**",tag:"mo",output:"\u22C6",tex:"star",ttype:CONST},{input:"//",tag:"mo",output:"/",tex:null,ttype:CONST},{input:"\\\\",tag:"mo",output:"\\",tex:"backslash",ttype:CONST},{input:"setminus",tag:"mo",output:"\\",tex:null,ttype:CONST},{input:"xx",tag:"mo",output:"\u00D7",tex:"times",ttype:CONST},{input:"-:",tag:"mo",output:"\u00F7",tex:"divide",ttype:CONST},{input:"@",tag:"mo",output:"\u2218",tex:"circ",ttype:CONST},{input:"o+",tag:"mo",output:"\u2295",tex:"oplus",ttype:CONST},{input:"ox",tag:"mo",output:"\u2297",tex:"otimes",ttype:CONST},{input:"o.",tag:"mo",output:"\u2299",tex:"odot",ttype:CONST},{input:"sum",tag:"mo",output:"\u2211",tex:null,ttype:UNDEROVER},{input:"prod",tag:"mo",output:"\u220F",tex:null,ttype:UNDEROVER},{input:"^^",tag:"mo",output:"\u2227",tex:"wedge",ttype:CONST},{input:"^^^",tag:"mo",output:"\u22C0",tex:"bigwedge",ttype:UNDEROVER},{input:"vv",tag:"mo",output:"\u2228",tex:"vee",ttype:CONST},{input:"vvv",tag:"mo",output:"\u22C1",tex:"bigvee",ttype:UNDEROVER},{input:"nn",tag:"mo",output:"\u2229",tex:"cap",ttype:CONST},{input:"nnn",tag:"mo",output:"\u22C2",tex:"bigcap",ttype:UNDEROVER},{input:"uu",tag:"mo",output:"\u222A",tex:"cup",ttype:CONST},{input:"uuu",tag:"mo",output:"\u22C3",tex:"bigcup",ttype:UNDEROVER},{input:"!=",tag:"mo",output:"\u2260",tex:"ne",ttype:CONST},{input:":=",tag:"mo",output:":=",tex:null,ttype:CONST},{input:"lt",tag:"mo",output:"<",tex:null,ttype:CONST},{input:"<=",tag:"mo",output:"\u2264",tex:"le",ttype:CONST},{input:"lt=",tag:"mo",output:"\u2264",tex:"leq",ttype:CONST},{input:">=",tag:"mo",output:"\u2265",tex:"ge",ttype:CONST},{input:"geq",tag:"mo",output:"\u2265",tex:null,ttype:CONST},{input:"-<",tag:"mo",output:"\u227A",tex:"prec",ttype:CONST},{input:"-lt",tag:"mo",output:"\u227A",tex:null,ttype:CONST},{input:">-",tag:"mo",output:"\u227B",tex:"succ",ttype:CONST},{input:"-<=",tag:"mo",output:"\u2AAF",tex:"preceq",ttype:CONST},{input:">-=",tag:"mo",output:"\u2AB0",tex:"succeq",ttype:CONST},{input:"in",tag:"mo",output:"\u2208",tex:null,ttype:CONST},{input:"!in",tag:"mo",output:"\u2209",tex:"notin",ttype:CONST},{input:"sub",tag:"mo",output:"\u2282",tex:"subset",ttype:CONST},{input:"sup",tag:"mo",output:"\u2283",tex:"supset",ttype:CONST},{input:"sube",tag:"mo",output:"\u2286",tex:"subseteq",ttype:CONST},{input:"supe",tag:"mo",output:"\u2287",tex:"supseteq",ttype:CONST},{input:"-=",tag:"mo",output:"\u2261",tex:"equiv",ttype:CONST},{input:"~=",tag:"mo",output:"\u2245",tex:"cong",ttype:CONST},{input:"~~",tag:"mo",output:"\u2248",tex:"approx",ttype:CONST},{input:"prop",tag:"mo",output:"\u221D",tex:"propto",ttype:CONST},{input:"and",tag:"mtext",output:"and",tex:null,ttype:SPACE},{input:"or",tag:"mtext",output:"or",tex:null,ttype:SPACE},{input:"not",tag:"mo",output:"\u00AC",tex:"neg",ttype:CONST},{input:"=>",tag:"mo",output:"\u21D2",tex:"implies",ttype:CONST},{input:"if",tag:"mo",output:"if",tex:null,ttype:SPACE},{input:"<=>",tag:"mo",output:"\u21D4",tex:"iff",ttype:CONST},{input:"AA",tag:"mo",output:"\u2200",tex:"forall",ttype:CONST},{input:"EE",tag:"mo",output:"\u2203",tex:"exists",ttype:CONST},{input:"_|_",tag:"mo",output:"\u22A5",tex:"bot",ttype:CONST},{input:"TT",tag:"mo",output:"\u22A4",tex:"top",ttype:CONST},{input:"|--",tag:"mo",output:"\u22A2",tex:"vdash",ttype:CONST},{input:"|==",tag:"mo",output:"\u22A8",tex:"models",ttype:CONST},{input:"(",tag:"mo",output:"(",tex:null,ttype:LEFTBRACKET},{input:")",tag:"mo",output:")",tex:null,ttype:RIGHTBRACKET},{input:"[",tag:"mo",output:"[",tex:null,ttype:LEFTBRACKET},{input:"]",tag:"mo",output:"]",tex:null,ttype:RIGHTBRACKET},{input:"{",tag:"mo",output:"{",tex:null,ttype:LEFTBRACKET},{input:"}",tag:"mo",output:"}",tex:null,ttype:RIGHTBRACKET},{input:"|",tag:"mo",output:"|",tex:null,ttype:LEFTRIGHT},{input:"(:",tag:"mo",output:"\u2329",tex:"langle",ttype:LEFTBRACKET},{input:":)",tag:"mo",output:"\u232A",tex:"rangle",ttype:RIGHTBRACKET},{input:"<<",tag:"mo",output:"\u2329",tex:null,ttype:LEFTBRACKET},{input:">>",tag:"mo",output:"\u232A",tex:null,ttype:RIGHTBRACKET},{input:"{:",tag:"mo",output:"{:",tex:null,ttype:LEFTBRACKET,invisible:true},{input:":}",tag:"mo",output:":}",tex:null,ttype:RIGHTBRACKET,invisible:true},{input:"int",tag:"mo",output:"\u222B",tex:null,ttype:CONST},{input:"dx",tag:"mi",output:"{:d x:}",tex:null,ttype:DEFINITION},{input:"dy",tag:"mi",output:"{:d y:}",tex:null,ttype:DEFINITION},{input:"dz",tag:"mi",output:"{:d z:}",tex:null,ttype:DEFINITION},{input:"dt",tag:"mi",output:"{:d t:}",tex:null,ttype:DEFINITION},{input:"oint",tag:"mo",output:"\u222E",tex:null,ttype:CONST},{input:"del",tag:"mo",output:"\u2202",tex:"partial",ttype:CONST},{input:"grad",tag:"mo",output:"\u2207",tex:"nabla",ttype:CONST},{input:"+-",tag:"mo",output:"\u00B1",tex:"pm",ttype:CONST},{input:"O/",tag:"mo",output:"\u2205",tex:"emptyset",ttype:CONST},{input:"oo",tag:"mo",output:"\u221E",tex:"infty",ttype:CONST},{input:"aleph",tag:"mo",output:"\u2135",tex:null,ttype:CONST},{input:"...",tag:"mo",output:"...",tex:"ldots",ttype:CONST},{input:":.",tag:"mo",output:"\u2234",tex:"therefore",ttype:CONST},{input:"/_",tag:"mo",output:"\u2220",tex:"angle",ttype:CONST},{input:"\\ ",tag:"mo",output:"\u00A0",tex:null,ttype:CONST},{input:"quad",tag:"mo",output:"\u00A0\u00A0",tex:null,ttype:CONST},{input:"qquad",tag:"mo",output:"\u00A0\u00A0\u00A0\u00A0",tex:null,ttype:CONST},{input:"cdots",tag:"mo",output:"\u22EF",tex:null,ttype:CONST},{input:"vdots",tag:"mo",output:"\u22EE",tex:null,ttype:CONST},{input:"ddots",tag:"mo",output:"\u22F1",tex:null,ttype:CONST},{input:"diamond",tag:"mo",output:"\u22C4",tex:null,ttype:CONST},{input:"square",tag:"mo",output:"\u25A1",tex:null,ttype:CONST},{input:"|__",tag:"mo",output:"\u230A",tex:"lfloor",ttype:CONST},{input:"__|",tag:"mo",output:"\u230B",tex:"rfloor",ttype:CONST},{input:"|~",tag:"mo",output:"\u2308",tex:"lceiling",ttype:CONST},{input:"~|",tag:"mo",output:"\u2309",tex:"rceiling",ttype:CONST},{input:"CC",tag:"mo",output:"\u2102",tex:null,ttype:CONST},{input:"NN",tag:"mo",output:"\u2115",tex:null,ttype:CONST},{input:"QQ",tag:"mo",output:"\u211A",tex:null,ttype:CONST},{input:"RR",tag:"mo",output:"\u211D",tex:null,ttype:CONST},{input:"ZZ",tag:"mo",output:"\u2124",tex:null,ttype:CONST},{input:"f",tag:"mi",output:"f",tex:null,ttype:UNARY,func:true},{input:"g",tag:"mi",output:"g",tex:null,ttype:UNARY,func:true},{input:"lim",tag:"mo",output:"lim",tex:null,ttype:UNDEROVER},{input:"Lim",tag:"mo",output:"Lim",tex:null,ttype:UNDEROVER},{input:"sin",tag:"mo",output:"sin",tex:null,ttype:UNARY,func:true},{input:"cos",tag:"mo",output:"cos",tex:null,ttype:UNARY,func:true},{input:"tan",tag:"mo",output:"tan",tex:null,ttype:UNARY,func:true},{input:"sinh",tag:"mo",output:"sinh",tex:null,ttype:UNARY,func:true},{input:"cosh",tag:"mo",output:"cosh",tex:null,ttype:UNARY,func:true},{input:"tanh",tag:"mo",output:"tanh",tex:null,ttype:UNARY,func:true},{input:"cot",tag:"mo",output:"cot",tex:null,ttype:UNARY,func:true},{input:"sec",tag:"mo",output:"sec",tex:null,ttype:UNARY,func:true},{input:"csc",tag:"mo",output:"csc",tex:null,ttype:UNARY,func:true},{input:"log",tag:"mo",output:"log",tex:null,ttype:UNARY,func:true},{input:"ln",tag:"mo",output:"ln",tex:null,ttype:UNARY,func:true},{input:"det",tag:"mo",output:"det",tex:null,ttype:UNARY,func:true},{input:"dim",tag:"mo",output:"dim",tex:null,ttype:CONST},{input:"mod",tag:"mo",output:"mod",tex:null,ttype:CONST},{input:"gcd",tag:"mo",output:"gcd",tex:null,ttype:UNARY,func:true},{input:"lcm",tag:"mo",output:"lcm",tex:null,ttype:UNARY,func:true},{input:"lub",tag:"mo",output:"lub",tex:null,ttype:CONST},{input:"glb",tag:"mo",output:"glb",tex:null,ttype:CONST},{input:"min",tag:"mo",output:"min",tex:null,ttype:UNDEROVER},{input:"max",tag:"mo",output:"max",tex:null,ttype:UNDEROVER},{input:"uarr",tag:"mo",output:"\u2191",tex:"uparrow",ttype:CONST},{input:"darr",tag:"mo",output:"\u2193",tex:"downarrow",ttype:CONST},{input:"rarr",tag:"mo",output:"\u2192",tex:"rightarrow",ttype:CONST},{input:"->",tag:"mo",output:"\u2192",tex:"to",ttype:CONST},{input:">->",tag:"mo",output:"\u21A3",tex:"rightarrowtail",ttype:CONST},{input:"->>",tag:"mo",output:"\u21A0",tex:"twoheadrightarrow",ttype:CONST},{input:">->>",tag:"mo",output:"\u2916",tex:"twoheadrightarrowtail",ttype:CONST},{input:"|->",tag:"mo",output:"\u21A6",tex:"mapsto",ttype:CONST},{input:"larr",tag:"mo",output:"\u2190",tex:"leftarrow",ttype:CONST},{input:"harr",tag:"mo",output:"\u2194",tex:"leftrightarrow",ttype:CONST},{input:"rArr",tag:"mo",output:"\u21D2",tex:"Rightarrow",ttype:CONST},{input:"lArr",tag:"mo",output:"\u21D0",tex:"Leftarrow",ttype:CONST},{input:"hArr",tag:"mo",output:"\u21D4",tex:"Leftrightarrow",ttype:CONST},{input:"sqrt",tag:"msqrt",output:"sqrt",tex:null,ttype:UNARY},{input:"root",tag:"mroot",output:"root",tex:null,ttype:BINARY},{input:"frac",tag:"mfrac",output:"/",tex:null,ttype:BINARY},{input:"/",tag:"mfrac",output:"/",tex:null,ttype:INFIX},{input:"stackrel",tag:"mover",output:"stackrel",tex:null,ttype:BINARY},{input:"_",tag:"msub",output:"_",tex:null,ttype:INFIX},{input:"^",tag:"msup",output:"^",tex:null,ttype:INFIX},{input:"hat",tag:"mover",output:"\u005E",tex:null,ttype:UNARY,acc:true},{input:"bar",tag:"mover",output:"\u00AF",tex:"overline",ttype:UNARY,acc:true},{input:"vec",tag:"mover",output:"\u2192",tex:null,ttype:UNARY,acc:true},{input:"dot",tag:"mover",output:".",tex:null,ttype:UNARY,acc:true},{input:"ddot",tag:"mover",output:"..",tex:null,ttype:UNARY,acc:true},{input:"ul",tag:"munder",output:"\u0332",tex:"underline",ttype:UNARY,acc:true},{input:"text",tag:"mtext",output:"text",tex:null,ttype:TEXT},{input:"mbox",tag:"mtext",output:"mbox",tex:null,ttype:TEXT},AMquote,{input:"bb",tag:"mstyle",atname:"fontweight",atval:"bold",output:"bb",tex:null,ttype:UNARY},{input:"mathbf",tag:"mstyle",atname:"fontweight",atval:"bold",output:"mathbf",tex:null,ttype:UNARY},{input:"sf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"sf",tex:null,ttype:UNARY},{input:"mathsf",tag:"mstyle",atname:"fontfamily",atval:"sans-serif",output:"mathsf",tex:null,ttype:UNARY},{input:"bbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"bbb",tex:null,ttype:UNARY,codes:AMbbb},{input:"mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",output:"mathbb",tex:null,ttype:UNARY,codes:AMbbb},{input:"cc",tag:"mstyle",atname:"mathvariant",atval:"script",output:"cc",tex:null,ttype:UNARY,codes:AMcal},{input:"mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",output:"mathcal",tex:null,ttype:UNARY,codes:AMcal},{input:"tt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"tt",tex:null,ttype:UNARY},{input:"mathtt",tag:"mstyle",atname:"fontfamily",atval:"monospace",output:"mathtt",tex:null,ttype:UNARY},{input:"fr",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"fr",tex:null,ttype:UNARY,codes:AMfrk},{input:"mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",output:"mathfrak",tex:null,ttype:UNARY,codes:AMfrk}];function compareNames(s1,s2){if(s1.input>s2.input)return 1
12+/*
13+LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/
14+Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,
15+(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.
16+
17+This program is free software; you can redistribute it and/or modify
18+it under the terms of the GNU General Public License as published by
19+the Free Software Foundation; either version 2 of the License, or (at
20+your option) any later version.
21+
22+This program is distributed in the hope that it will be useful,
23+but WITHOUT ANY WARRANTY; without even the implied warranty of
24+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25+General Public License (at http://www.gnu.org/copyleft/gpl.html)
26+for more details.
27+*/
28+
29+var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var mathcolor="";var mathfontfamily="";var showasciiformulaonhover=true;var isIE=document.createElementNS==null;if(document.getElementById==null)
30+alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
31+function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}
32+function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")
33+nd.appendChild(AMcreateElementXHTML("p"));nd.appendChild(document.createTextNode("To view the "));var an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("LaTeXMathML"));an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("MathPlayer"));an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");nd.appendChild(an);nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));nd.appendChild(AMcreateElementXHTML("p"));return nd;}
34+function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")
35+if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")
36+try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}
37+else return AMnoMathMLNote();}
38+var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,TEXT=9,BIG=10,LONG=11,STRETCHY=12,MATRIX=13;var AMsqrt={input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},AMroot={input:"\\root",tag:"mroot",output:"root",ttype:BINARY},AMfrac={input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},AMover={input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},AMatop={input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},AMchoose={input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},AMsub={input:"_",tag:"msub",output:"_",ttype:INFIX},AMsup={input:"^",tag:"msup",output:"^",ttype:INFIX},AMtext={input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},AMmbox={input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT};var AMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},AMsqrt,AMroot,AMfrac,AMover,AMsub,AMsup,AMtext,AMmbox,AMatop,AMchoose,{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\uFE37",ttype:UNARY,acc:true},{input:"\\overbracket",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\uFE38",ttype:UNARY,acc:true},{input:"\\underbracket",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk},{input:"\\textcolor",tag:"mstyle",atname:"mathvariant",atval:"mathcolor",ttype:BINARY},{input:"\\colorbox",tag:"mstyle",atname:"mathvariant",atval:"background",ttype:BINARY}];function compareNames(s1,s2){if(s1.input>s2.input)return 1
3339else return-1;}
34−var AMnames=[];function initSymbols(){var texsymbols=[],i;for(i=0;i<AMsymbols.length;i++)
35−if(AMsymbols[i].tex)
36−texsymbols[texsymbols.length]={input:AMsymbols[i].tex,tag:AMsymbols[i].tag,output:AMsymbols[i].output,ttype:AMsymbols[i].ttype};AMsymbols=AMsymbols.concat(texsymbols);refreshSymbols();}
37−function refreshSymbols(){var i;AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;LMsymbols.sort(compareNames);for(i=0;i<LMsymbols.length;i++)LMnames[i]=LMsymbols[i].input;}
38−function define(oldstr,newstr){if(oldstr.substr(0,1)=="\\")
39−LMsymbols=LMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);else
40−AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,tex:null,ttype:DEFINITION}]);refreshSymbols();}
41−function AMremoveCharsAndBlanks(str,n){var st;if(str.charAt(n)=="\\"&&str.charAt(n+1)!="\\"&&str.charAt(n+1)!=" ")
42−st=str.slice(n+1);else st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
43−function position(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}
40+var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}
41+var AMmathml="http://www.w3.org/1998/Math/MathML";function AMcreateElementMathML(t){if(isIE)return document.createElement("m:"+t);else return document.createElementNS(AMmathml,t);}
42+function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}
43+function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}
44+function AMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
45+function AMposition(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}
4446return h;}else
4547for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}
46−function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=position(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}
48+function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=AMposition(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}
4749more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}
4850AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}
49−AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);var integ=true;while("0"<=st&&st<="9"&&k<=str.length){st=str.slice(k,k+1);k++;}
50−if(st==decimalsign){st=str.slice(k,k+1);if("0"<=st&&st<="9"){integ=false;k++;while("0"<=st&&st<="9"&&k<=str.length){st=str.slice(k,k+1);k++;}}}
51−if((integ&&k>1)||k>2){st=str.slice(0,k-1);tagst="mn";}else{k=2;st=str.slice(0,1);tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");}
52−if(st=="-"&&AMpreviousSymbol==INFIX){AMcurrentSymbol=INFIX;return{input:st,tag:tagst,output:st,ttype:UNARY,func:true};}
53−return{input:st,tag:tagst,output:st,ttype:CONST};}
54−function AMremoveBrackets(node){var st;if(node.nodeName=="mrow"){st=node.firstChild.firstChild.nodeValue;if(st=="("||st=="["||st=="{")node.removeChild(node.firstChild);}
55−if(node.nodeName=="mrow"){st=node.lastChild.firstChild.nodeValue;if(st==")"||st=="]"||st=="}")node.removeChild(node.lastChild);}}
56−var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET&&AMnestingDepth>0){return[null,str];}
57−if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);}
58−switch(symbol.ttype){case UNDEROVER:case CONST:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];case LEFTBRACKET:AMnestingDepth++;str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseExpr(str,true);AMnestingDepth--;if(typeof symbol.invisible=="boolean"&&symbol.invisible)
59−node=createMmlNode("mrow",result[0]);else{node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);}
60−return[node,result[1]];case TEXT:if(symbol!=AMquote)str=AMremoveCharsAndBlanks(str,symbol.input.length);if(str.charAt(0)=="{")i=str.indexOf("}");else if(str.charAt(0)=="(")i=str.indexOf(")");else if(str.charAt(0)=="[")i=str.indexOf("]");else if(symbol==AMquote)i=str.slice(1).indexOf("\"")+1;else i=0;if(i==-1)i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);}
61−newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);}
62−str=AMremoveCharsAndBlanks(str,i+1);return[createMmlNode("mrow",newFrag),str];case UNARY:str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st=="/"||st=="|"||st==","){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];}else{node=createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node.appendChild(result[0]);return[node,result[1]];}}
63−AMremoveBrackets(result[0]);if(symbol.input=="sqrt"){return[createMmlNode(symbol.tag,result[0]),result[1]];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=createMmlNode(symbol.tag,result[0]);node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));return[node,result[1]];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)
64−if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)
65−if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+
66−String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")
67−result[0]=createMmlNode("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(createMmlNode("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
68−node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);return[node,result[1]];}
69−case BINARY:str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str];AMremoveBrackets(result[0]);var result2=AMparseSexpr(result[1]);if(result2[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str];AMremoveBrackets(result2[0]);if(symbol.input=="root"||symbol.input=="stackrel")
70−newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="frac")newFrag.appendChild(result2[0]);return[createMmlNode(symbol.tag,newFrag),result2[1]];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode("mo",document.createTextNode(symbol.output)),str];case SPACE:str=AMremoveCharsAndBlanks(str,symbol.input.length);node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(symbol.output)));node=createMmlNode("mspace");node.setAttribute("width","1ex");newFrag.appendChild(node);return[createMmlNode("mrow",newFrag),str];case LEFTRIGHT:AMnestingDepth++;str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseExpr(str,false);AMnestingDepth--;var st="";if(result[0].lastChild!=null)
71−st=result[0].lastChild.firstChild.nodeValue;if(st=="|"){node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);return[node,result[1]];}else{node=createMmlNode("mo",document.createTextNode("\u2223"));node=createMmlNode("mrow",node);return[node,str];}
72−default:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];}}
73−function AMparseIexpr(str){var symbol,sym1,sym2,node,result,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX&&symbol.input!="/"){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)
74−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));else AMremoveBrackets(result[0]);str=result[1];if(symbol.input=="_"){sym2=AMgetSymbol(str);underover=(sym1.ttype==UNDEROVER);if(sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);AMremoveBrackets(res2[0]);str=res2[1];node=createMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);node=createMmlNode("mrow",node);}else{node=createMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}}else{node=createMmlNode(symbol.tag,node);node.appendChild(result[0]);}}
75−return[node,str];}
76−function AMparseExpr(str,rightbracket){var symbol,node,result,i,nodeList=[],newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX&&symbol.input=="/"){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseIexpr(str);if(result[0]==null)
77−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));else AMremoveBrackets(result[0]);str=result[1];AMremoveBrackets(node);node=createMmlNode(symbol.tag,node);node.appendChild(result[0]);newFrag.appendChild(node);symbol=AMgetSymbol(str);}
78−else if(node!=undefined)newFrag.appendChild(node);}while((symbol.ttype!=RIGHTBRACKET&&(symbol.ttype!=LEFTRIGHT||rightbracket)||AMnestingDepth==0)&&symbol!=null&&symbol.output!="");if(symbol.ttype==RIGHTBRACKET||symbol.ttype==LEFTRIGHT){var len=newFrag.childNodes.length;if(len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue==","){var right=newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;if(right==")"||right=="]"){var left=newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;if(left=="("&&right==")"&&symbol.output!="}"||left=="["&&right=="]"){var pos=[];var matrix=true;var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];if(matrix)matrix=node.nodeName=="mrow"&&(i==m-1||node.nextSibling.nodeName=="mo"&&node.nextSibling.firstChild.nodeValue==",")&&node.firstChild.firstChild.nodeValue==left&&node.lastChild.firstChild.nodeValue==right;if(matrix)
79−for(var j=0;j<node.childNodes.length;j++)
80−if(node.childNodes[j].firstChild.nodeValue==",")
81−pos[i][pos[i].length]=j;if(matrix&&i>1)matrix=pos[i].length==pos[i-2].length;}
82−if(matrix){var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;node.removeChild(node.firstChild);for(j=1;j<n-1;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
83−row.appendChild(createMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
84−table.appendChild(createMmlNode("mtr",row));}
85−node=createMmlNode("mtable",table);if(typeof symbol.invisible=="boolean"&&symbol.invisible)node.setAttribute("columnalign","left");newFrag.replaceChild(node,newFrag.firstChild);}}}}
86−str=AMremoveCharsAndBlanks(str,symbol.input.length);if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=createMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
87−return[newFrag,str];}
88−function parseMath(str,latex){var frag,node;AMnestingDepth=0;frag=latex?LMparseExpr(str.replace(/^\s+/g,""),false,false)[0]:AMparseExpr(str.replace(/^\s+/g,""),false)[0];node=createMmlNode("mstyle",frag);node.setAttribute("mathcolor",mathcolor);node.setAttribute("fontfamily",mathfontfamily);node.setAttribute("mathsize",mathfontsize);if(displaystyle)node.setAttribute("displaystyle","true");node=createMmlNode("math",node);if(showasciiformulaonhover)
89−node.setAttribute("title",str.replace(/\s+/g," "));return node;}
90−function strarr2docFrag(arr,linebreaks,latex){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(parseMath(arr[i],latex));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(createElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(createElementXHTML("p"));newFrag.appendChild(createElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}
91−expr=!expr;}
92−return newFrag;}
93−function AMautomathrec(str){var texcommand="\\\\[a-zA-Z]+|\\\\\\s|";var ambigAMtoken="\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";var englishAMtoken="\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";var secondenglishAMtoken="|\\bI\\b|\\bin\\b|\\btext\\b";var simpleAMtoken="NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta";var letter="[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";var token=letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;var re=new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");str=str.replace(re," `$2`$7");var arr=str.split(AMdelimiter1);var re1=new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");var re2=new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g");for(i=0;i<arr.length;i++)
94−if(i%2==0){arr[i]=arr[i].replace(re1," `$2`$3");arr[i]=arr[i].replace(re2," `$2`$3");arr[i]=arr[i].replace(/([{}[\]])/,"`$1`");}
95−str=arr.join(AMdelimiter1);str=str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)");str=str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3");str=str.replace(/\sin`/g,"` in");str=str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");str=str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");str=str.replace(/`([0-9.]+:)`/g,"$1");return str;}
96−function processNodeR(n,linebreaks,latex){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");if(latex){mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)
97−arr[i]=arr[i].replace(/\\\$/g,"\$");}else{mtch=false;str=str.replace(new RegExp(AMescape1,"g"),function(){mtch=true;return"AMescape1"});str=str.replace(/\\?end{?a?math}?/i,function(){automathrecognize=false;mtch=true;return""});str=str.replace(/amath\b|\\begin{a?math}/i,function(){automathrecognize=true;mtch=true;return""});arr=str.split(AMdelimiter1);if(automathrecognize)
98−for(i=0;i<arr.length;i++)
99−if(i%2==0)arr[i]=AMautomathrec(arr[i]);str=arr.join(AMdelimiter1);arr=str.split(AMdelimiter1);for(i=0;i<arr.length;i++)
100−arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);}
101−if(arr.length>1||mtch){if(!noMathML){frg=strarr2docFrag(arr,n.nodeType==8,latex);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)
102−i+=processNodeR(n.childNodes[i],linebreaks,latex);}
103−return 0;}
104−function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")
105−for(var i=0;i<frag.length;i++)
106−if(frag[i].className=="AM")
107−processNodeR(frag[i],linebreaks,false);}else{try{st=n.innerHTML;}catch(err){}
108−if(st==null||/amath\b|\\begin{a?math}/i.test(st)||st.indexOf(AMdelimiter1+" ")!=-1||st.slice(-1)==AMdelimiter1||st.indexOf(AMdelimiter1+"<")!=-1||st.indexOf(AMdelimiter1+"\n")!=-1){processNodeR(n,linebreaks,false);}}}
109−var LMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\implies",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},{input:"\\root",tag:"mroot",output:"root",ttype:BINARY},{input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},{input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},{input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},{input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},{input:"_",tag:"msub",output:"_",ttype:INFIX},{input:"^",tag:"msup",output:"^",ttype:INFIX},{input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},{input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT},{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk}];var LMnames=[];function LMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}
110−function LMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=position(LMnames,st,j);if(k<LMnames.length&&str.slice(0,LMnames[k].length)==LMnames[k]){match=LMnames[k];mk=k;i=match.length;}
111−more=k<LMnames.length&&str.slice(0,LMnames[k].length)>=LMnames[k];}
112−LMpreviousSymbol=LMcurrentSymbol;if(match!=""){LMcurrentSymbol=LMsymbols[mk].ttype;return LMsymbols[mk];}
113−LMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}
114−var LMpreviousSymbol,LMcurrentSymbol;function LMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=LMremoveCharsAndBlanks(str,0);symbol=LMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
115−return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);symbol=LMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
51+AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}
52+var AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
53+return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)
11654return[null,str,null];}
117−str=LMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=createMmlNode(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=LMgetSymbol(str);symbol.ttype=UNDEROVER;str=LMremoveCharsAndBlanks(str,symbol.input.length);}}
118−return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")
55+str=AMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=AMcreateElementMathML(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=AMgetSymbol(str);symbol.ttype=UNDEROVER;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}
56+return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")
11957output="\u2032";else if(symbol.input=="''")
12058output="\u2033";else if(symbol.input=="'''")
12159output="\u2033\u2032";else if(symbol.input=="''''")
12260output="\u2033\u2033";else if(symbol.input=="\\square")
12361output="\u25A1";else if(symbol.input.substr(0,5)=="\\frac"){var denom=symbol.input.substr(6,1);if(denom=="5"||denom=="6"){str=symbol.input.replace(/\\frac/,"\\frac ")+str;return[node,str,symbol.tag];}}}
124−node=createMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=createMmlNode("mover",node);node.appendChild(createMmlNode("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")
125−symbol.output="\\";node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}
62+node=AMcreateMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=AMcreateMmlNode("mover",node);node.appendChild(AMcreateElementMathML("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")
63+symbol.output="\\";node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}
12664node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)
12765return[node,str,symbol.rtag];else
12866return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)
129−atval=symbol.ieval;symbol=LMgetSymbol(str);if(symbol==null)
130−return[null,str,null];str=LMremoveCharsAndBlanks(str,symbol.input.length);node=createMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=createMmlNode("mspace");space.setAttribute("height",atval+"ex");node=createMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}
131−return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=LMgetSymbol(str);if(symbol!=null){if(symbol.input==".")
132−symbol.invisible=true;str=LMremoveCharsAndBlanks(str,symbol.input.length);}}
133−result=LMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))
134−node=createMmlNode("mrow",result[0]);else{node=createMmlNode("mo",document.createTextNode(symbol.output));node=createMmlNode("mrow",node);node.appendChild(result[0]);}
135−return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=LMgetSymbol(str);str=LMremoveCharsAndBlanks(str,0);if(symbol==null)
136−mask="l";else{str=LMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")
137−mask="l";else do{symbol=LMgetSymbol(str);if(symbol!=null){str=LMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")
67+atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)
68+return[null,str,null];str=AMremoveCharsAndBlanks(str,symbol.input.length);node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height",atval+"ex");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}
69+return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")
70+symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}
71+result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))
72+node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}
73+return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=AMgetSymbol(str);str=AMremoveCharsAndBlanks(str,0);if(symbol==null)
74+mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")
75+mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")
13876mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}
139−result=LMparseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)
140−return[node,result[1],null];var lspace=createMmlNode("mspace");lspace.setAttribute("width","0.167em");var rspace=createMmlNode("mspace");rspace.setAttribute("width","0.167em");var node1=createMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=LMparseExpr("{"+str,true,true);node=createMmlNode("mtable",result[0]);if(isIE)
77+result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)
78+return[node,result[1],null];var lspace=AMcreateElementMathML("mspace");lspace.setAttribute("width","0.167em");var rspace=AMcreateElementMathML("mspace");rspace.setAttribute("width","0.167em");var node1=AMcreateMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);if(isIE)
14179node.setAttribute("columnspacing","0.25em");else
142−node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=createMmlNode("mrow",node);return[node,result[1],null];}
80+node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}
14381case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)
144−i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=createMmlNode("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
145−newFrag.appendChild(createMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=createMmlNode("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
146−str=LMremoveCharsAndBlanks(str,i+1);return[createMmlNode("mrow",newFrag),str,null];case UNARY:result=LMparseSexpr(str);if(result[0]==null)return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=createMmlNode("mrow",createMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=createMmlNode("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}
82+i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
83+newFrag.appendChild(AMcreateMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}
84+str=AMremoveCharsAndBlanks(str,i+1);return[AMcreateMmlNode("mrow",newFrag),str,null];case UNARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=AMcreateMmlNode("mrow",AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}
14785node.appendChild(result[0]);return[node,result[1],symbol.tag];}}
148−if(symbol.input=="\\sqrt"){if(isIE){var space=createMmlNode("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=createMmlNode(symbol.tag,result[0])
86+if(symbol.input=="\\sqrt"){if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=AMcreateMmlNode(symbol.tag,result[0])
14987node.appendChild(space);return[node,result[1],symbol.tag];}else
150−return[createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=createMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")
88+return[AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=AMcreateMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")
15189output="\u0302";else if(symbol.input=="\\widehat")
15290output="\u005E";else if(symbol.input=="\\bar")
15391output="\u00AF";else if(symbol.input=="\\grave")
15492output="\u0300";else if(symbol.input=="\\tilde")
15593output="\u0303";}
156−var node1=createMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")
94+var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")
15795node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")
15896node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")
15997node1.setAttribute("accentunder","true");else
@@ -162,218 +100,111 @@ node.ttype=UNDEROVER;return[node,result[1],symbol.tag];}else{if(!isIE&&typeof sy
162100if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)
163101if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+
164102String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")
165−result[0]=createMmlNode("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(createMmlNode("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
166−node=createMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")
103+result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}
104+node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")
167105node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}
168−case BINARY:result=LMparseSexpr(str);if(result[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=LMparseSexpr(result[1]);if(result2[0]==null)return[createMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\root"||symbol.input=="\\stackrel")
169−newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=LMremoveCharsAndBlanks(str,symbol.input.length);return[createMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[createMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}
170−function LMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=LMremoveCharsAndBlanks(str,0);sym1=LMgetSymbol(str);result=LMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=LMgetSymbol(str);if(symbol.ttype==INFIX){str=LMremoveCharsAndBlanks(str,symbol.input.length);result=LMparseSexpr(str);if(result[0]==null)
171−result[0]=createMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=LMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=LMremoveCharsAndBlanks(str,sym2.input.length);var res2=LMparseSexpr(str);str=res2[1];tag=res2[2];node=createMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=createMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=createMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}
172−node=createMmlNode("mrow",node);}else{node=createMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")
106+case BINARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=AMparseSexpr(result[1]);if(result2[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\textcolor"||symbol.input=="\\colorbox"){var tclr=str.match(/\{\s*([#\w]+)\s*\}/);str=str.replace(/\{\s*[#\w]+\s*\}/,"");if(tclr!=null){if(IsColorName.test(tclr[1].toLowerCase())){tclr=LaTeXColor[tclr[1].toLowerCase()];}else{tclr=tclr[1];}
107+node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}
108+if(symbol.input=="\\root"||symbol.input=="\\stackrel")newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}
109+function AMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)
110+result[0]=AMcreateMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=AMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);str=res2[1];tag=res2[2];node=AMcreateMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=AMcreateMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=AMcreateMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}
111+node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")
173112node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")
174−node=createMmlNode("mfenced",node);}}
113+node=AMcreateMmlNode("mfenced",node);}}
175114return[node,str,tag];}
176−function LMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=LMremoveCharsAndBlanks(str,0);result=LMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=LMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=createMmlNode("mspace");space.setAttribute("width","0.167em");node=createMmlNode("mrow",node);node.appendChild(space);}
177−newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=LMremoveCharsAndBlanks(str,symbol.input.length);symbol=LMgetSymbol(str);if(symbol!=null&&symbol.input==".")
115+function AMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}
116+newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol!=null&&symbol.input==".")
178117symbol.invisible=true;if(symbol!=null)
179118tag=symbol.rtag;}
180119if(symbol!=null)
181−str=LMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)
120+str=AMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)
182121if(node.childNodes[j].firstChild.nodeValue=="&")
183122pos[i][pos[i].length]=j;}
184−var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(createMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
185−row.appendChild(createMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
186−table.appendChild(createMmlNode("mtr",row));}
123+var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(AMcreateMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}
124+row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}
125+table.appendChild(AMcreateMmlNode("mtr",row));}
187126return[table,str];}
188−if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=createMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
127+if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}
189128return[newFrag,str,tag];}
190−var tcnt=0,dcnt=0;function simpleLaTeXformatting(st){st=st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>");st=st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++;return"<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});st=st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++;return"<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});st=st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return"<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" &#x25A1;"});st=st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");st=st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");st=st.replace(/\\cite{(.*?)}/g,"[$1]");st=st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");st=st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");st=st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");st=st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");st=st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>");st=st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>");st=st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");st=st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>");st=st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");st=st.replace(/\\begin{description}/g,"<dl>");st=st.replace(/\\end{description}/g,"</dl>");st=st.replace(/\\newline\b/g,"<br/>");st=st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");st=st.replace(/\\par\b/g,"<p>&nbsp;</p>");st=st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\">&nbsp;</p>");st=st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\">&nbsp;</p>");st=st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\">&nbsp;</p>");st=st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");return st}
191−function ASCIIandgraphformatting(st){st=st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3");st=st.replace(/(Proof:)/g,"<i>$1</i>");st=st.replace(/QED/g,"&nbsp; &nbsp; &#x25A1;");st=st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");st=st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");st=st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");st=st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\"");st=st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return"<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"});st=st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>");return st}
192−function LMprocessNode(n){var frag,st;try{st=n.innerHTML;}catch(err){}
193−var am=/amath\b|graph/i.test(st);if((st==null||st.indexOf("\$ ")!=-1||st.indexOf("\$<")!=-1||st.indexOf("\\begin")!=-1||am||st.slice(-1)=="$"||st.indexOf("\$\n")!=-1)&&!/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){if(!avoidinnerHTML&&translateLaTeXformatting)
194−st=simpleLaTeXformatting(st);if(st!=null&&am&&!avoidinnerHTML){st=ASCIIandgraphformatting(st);}
195−st=st.replace(/%7E/g,"~");if(!avoidinnerHTML)n.innerHTML=st;processNodeR(n,false,true);}}
196−var checkIfSVGavailable=true;var notifyIfNoSVG=true;var alertIfNoSVG=false;var noSVG=false;var defaultwidth=300;defaultheight=200;var defaultxmin=-5.5;defaultxmax=5.5;var defaultborder=0;border=defaultborder;var defaultstrokewidth="1";var defaultstroke="blue";var defaultstrokeopacity=1;var defaultstrokedasharray=null;var defaultfill="none";var defaultfillopacity=1;var defaultfontstyle="normal";var defaultfontfamily="times";var defaultfontsize="16";var defaultfontweight="normal";var defaultfontstroke="none";var defaultfontfill="none";var defaultmarker="none";var defaultendpoints="";var showcoordinates=true;var markerstrokewidth="1";var markerstroke="black";var markerfill="yellow";var markersize=4;var arrowfill=stroke;var dotradius=4;var ticklength=4;var axesstroke="black";var gridstroke="grey";var backgroundstyle="fill-opacity:0; fill:white";var singlelettersitalic=true;var picturepos=null;var xunitlength;var yunitlength;var origin=[0,0];var above="above";var below="below";var left="left";var right="right";var aboveleft="aboveleft";var aboveright="aboveright";var belowleft="belowleft";var belowright="belowright";var xmin,xmax,ymin,ymax,xscl,yscl,xgrid,ygrid,xtick,ytick,initialized;var strokewidth,strokedasharray,stroke,fill,strokeopacity,fillopacity;var fontstyle,fontfamily,fontsize,fontweight,fontstroke,fontfill;var marker,endpoints,dynamic={};var picture,svgpicture,doc,width,height;var isIE=document.createElementNS==null;var log=function(x){return ln(x)/ln(10)};var pi=Math.PI,e=Math.E,ln=Math.log,sqrt=Math.sqrt;var floor=Math.floor,ceil=Math.ceil,abs=Math.abs;var sin=Math.sin,cos=Math.cos,tan=Math.tan;var arcsin=Math.asin,arccos=Math.acos,arctan=Math.atan;var sec=function(x){return 1/Math.cos(x)};var csc=function(x){return 1/Math.sin(x)};var cot=function(x){return 1/Math.tan(x)};var arcsec=function(x){return arccos(1/x)};var arccsc=function(x){return arcsin(1/x)};var arccot=function(x){return arctan(1/x)};var sinh=function(x){return(Math.exp(x)-Math.exp(-x))/2};var cosh=function(x){return(Math.exp(x)+Math.exp(-x))/2};var tanh=function(x){return(Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x))};var sech=function(x){return 1/cosh(x)};var csch=function(x){return 1/sinh(x)};var coth=function(x){return 1/tanh(x)};var arcsinh=function(x){return ln(x+Math.sqrt(x*x+1))};var arccosh=function(x){return ln(x+Math.sqrt(x*x-1))};var arctanh=function(x){return ln((1+x)/(1-x))/2};var sech=function(x){return 1/cosh(x)};var csch=function(x){return 1/sinh(x)};var coth=function(x){return 1/tanh(x)};var arcsech=function(x){return arccosh(1/x)};var arccsch=function(x){return arcsinh(1/x)};var arccoth=function(x){return arctanh(1/x)};var sign=function(x){return(x==0?0:(x<0?-1:1))};function factorial(x,n){if(n==null)n=1;if(Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)
197−x=Math.round(x*1000000)/1000000;if(x-Math.floor(x)!=0)return NaN;for(var i=x-n;i>0;i-=n)x*=i;return(x<0?NaN:(x==0?1:x));}
198−function C(x,k){var res=1;for(var i=0;i<k;i++)res*=(x-i)/(k-i);return res;}
199−function chop(x,n){if(n==null)n=0;return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);}
200−function ran(a,b,n){if(n==null)n=0;return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);}
201−function myCreateElementSVG(t){if(isIE)return doc.createElement(t);else return doc.createElementNS("http://www.w3.org/2000/svg",t);}
202−function getElementsByClass(container,tagName,clsName){var list=new Array(0);var collection=container.getElementsByTagName(tagName);for(var i=0;i<collection.length;i++)
203−if(collection[i].className.slice(0,clsName.length)==clsName)
204−list[list.length]=collection[i];return list;}
205−function showobj(obj){var st="",i;for(i in obj)
206−st+=(obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i));return st;}
207−function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
208−curtop=obj.offsetTop
209−while(obj=obj.offsetParent){curleft+=obj.offsetLeft
210−curtop+=obj.offsetTop}}
211−return[curleft,curtop];}
212−function checkSVG(){if(navigator.appName.slice(0,8)=="Netscape")
213−if(window['SVGElement'])noSVG=null;else noSVG=true;else if(navigator.appName.slice(0,9)=="Microsoft")
214−try{var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");noSVG=null;}catch(e){noSVG=true;}
215−else if(navigator.appName.slice(0,5)=="Opera")
216−noSVG=null;else noSVG=true;if(noSVG&&notifyIfNoSVG){var msg="To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later."
217−if(alertIfNoSVG)
218−alert(msg);else return msg;}}
219−function setText(st,id){var node=document.getElementById(id);if(node!=null)
220−if(node.childNodes.length!=0)node.childNodes[0].nodeValue=st;else node.appendChild(document.createTextNode(st));}
221−function getX(evt){var svgroot=evt.target.parentNode;pos=findPos(svgroot.parentNode);return(evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength"));}
222−function getY(evt){var svgroot=evt.target.parentNode;pos=findPos(svgroot.parentNode);return(svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength"));}
223−function translateandeval(src){var errstr;src=src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\",");src=src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")");src=src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]");src=src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2");src=src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");try{with(Math)eval(src);}catch(err){if(err!="wait"){if(typeof err=="object")
224−errstr=err.name+" "+err.message+" "+err.number+" "+err.description;else errstr=err;alert(errstr+"\n"+src)}}}
225−var lastSlot=0;function drawPictures(){var src,id,dsvg,nd,node,ht,index,cols,arr,i,node2;var ASbody=document.getElementsByTagName("body")[0];pictures=getElementsByClass(ASbody,"embed","ASCIIsvg");var len=pictures.length;if(len==0)return;for(index=lastSlot;index<len+lastSlot;index++){width=null;height=null;xmin=null;xmax=null;ymin=null;ymax=null;xscl=null;xgrid=null;yscl=null;ygrid=null;initialized=false;picture=pictures[index-lastSlot];src=picture.getAttribute("script");if(src==null)src="";if(!/axes\b|initPicture/.test(src)){var i=0;while(/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i)))i++;src=(i==0?"axes(); "+src:src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();"));}
226−ht=picture.getAttribute("height");if(isIE){picture.setAttribute("wmode","transparent");}
227−if(document.getElementById("picture"+(index+1)+"mml")==null){picture.parentNode.style.position="relative";node=createElementXHTML("div");node.style.position="absolute";node.style.top="0px";node.style.left="0px";node.setAttribute("id","picture"+(index+1)+"mml");picture.parentNode.insertBefore(node,picture.nextSibling);}
228−if(ht==null)ht="";if(ht==""||src=="")
229−if(document.getElementById("picture"+(index+1)+"input")==null){node=createElementXHTML("textarea");arr=src.split("\n");cols=0;for(i=0;i<arr.length;i++)cols=Math.max(cols,arr[i].length);node.setAttribute("rows",Math.min(10,arr.length)+1);node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5);if(isIE)src=src.replace(/([^\r])\n/g,"$1\r");node.appendChild(document.createTextNode(src));if(src.indexOf("showcode()")==-1)node.style.display="none";node.setAttribute("id","picture"+(index+1)+"input");picture.parentNode.insertBefore(node,picture.nextSibling);picture.parentNode.insertBefore(createElementXHTML("br"),node);node2=createElementXHTML("button");node2.setAttribute("id","picture"+(index+1)+"button");if(isIE)node2.onclick=function(){updatePicture(this)};else node2.setAttribute("onclick","updatePicture(this)");node2.appendChild(document.createTextNode("Update"));if(src.indexOf("showcode()")==-1)node2.style.display="none";picture.parentNode.insertBefore(node2,node);picture.parentNode.insertBefore(createElementXHTML("br"),node);}else src=document.getElementById("picture"+(index+1)+"input").value;id=picture.getAttribute("id");dsvg=picture.getAttribute("src");if(id==null||id==""){id="picture"+(index+1);picture.setAttribute("id",id);}
230−translateandeval(src);}
231−lastSlot+=len;}
232−function setdefaults(){strokewidth=defaultstrokewidth;stroke=defaultstroke;strokeopacity=defaultstrokeopacity;strokedasharray=defaultstrokedasharray;fill=defaultfill;fillopacity=defaultfillopacity;fontstyle=defaultfontstyle;fontfamily=defaultfontfamily;fontsize=defaultfontsize;fontweight=defaultfontweight;fontstroke=defaultfontstroke;fontfill=defaultfontfill;marker=defaultmarker;endpoints=defaultendpoints;}
233−function switchTo(id){if(id==undefined)return;var name=id;if(typeof name!="string")name=id.target.parentNode.getAttribute("name");picture=document.getElementById(name);width=picture.getAttribute("width")-0;height=picture.getAttribute("height")-0;setdefaults();if((picture.nodeName=="EMBED"||picture.nodeName=="embed")&&isIE){svgpicture=picture.getSVGDocument().getElementById("root");doc=picture.getSVGDocument();}else{svgpicture=picture;doc=document;}
234−xunitlength=parseFloat(svgpicture.getAttribute("xunitlength"));yunitlength=parseFloat(svgpicture.getAttribute("yunitlength"));xmin=parseFloat(svgpicture.getAttribute("xmin"));xmax=parseFloat(svgpicture.getAttribute("xmax"));ymin=parseFloat(svgpicture.getAttribute("ymin"));ymax=parseFloat(svgpicture.getAttribute("ymax"));origin=[svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];}
235−function updatePicture(obj){var node,src,id,top,left;if(typeof obj=="object")id=obj.id.slice(0,-6);else id=(typeof obj=="string"?obj:"picture"+(obj+1));src=document.getElementById(id+"input").value;xmin=null;xmax=null;ymin=null;ymax=null;xscl=null;xgrid=null;yscl=null;ygrid=null;initialized=false;picture=document.getElementById(id);translateandeval(src)}
236−function changepicturesize(evt,factor){var obj=evt.target;var name=obj.parentNode.getAttribute("name");var pic=document.getElementById(name);var src=document.getElementById(name+"input").value;if(!/height/.test(src))src="height=0; "+src;if(!/width/.test(src))src="width=0; "+src;src=src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0)));src=src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0)));document.getElementById(name+"input").value=src;updatePicture(name);}
237−function zoom(evt,factor){switchTo(evt);var obj=evt.target;var name=obj.parentNode.getAttribute("name");var pic=document.getElementById(name);var src=document.getElementById(name+"input").value;var xlen=(xmax-xmin)/2;var ylen=(ymax-ymin)/2;var xcen=getX(evt),ycen=getY(evt);if(!/ymax/.test(src))src="ymax=0; "+src;if(!/ymin/.test(src))src="ymin=0; "+src;if(!/xmax/.test(src))src="xmax=0; "+src;if(!/xmin/.test(src))src="xmin=0; "+src;src=src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen));src=src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen));src=src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen));src=src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen));document.getElementById(name+"input").value=src;updatePicture(name);}
238−var sinceFirstClick=0;var dblClkTimer;function timer(){if(sinceFirstClick<60){sinceFirstClick++;setTimeout("timer()",10);}else{clearTimeout(dblClkTimer);dblClkTimer="";}}
239−function mClick(evt){if(sinceFirstClick!=0){if(sinceFirstClick<=40){if(evt.shiftKey){if(evt.altKey)changepicturesize(evt,2);else zoom(evt,.5);}else if(evt.altKey)zoom(evt,2);else showHideCode(evt);clearTimeout(dblClkTimer);dblClkTimer="";}else{clearTimeout(dblClkTimer);sinceFirstClick=0;dblClkTimer=setTimeout("timer()",10);}}else{sinceFirstClick=0;dblClkTimer=setTimeout("timer()",10);}}
240−function showHideCode(evt){var obj=evt.target;var name=obj.parentNode.getAttribute("name");var node=document.getElementById(name+"input");node.style.display=(node.style.display=="none"?"":"none");var node=document.getElementById(name+"button");node.style.display=(node.style.display=="none"?"":"none");}
241−function showcode(){}
242−function setBorder(x){border=x}
243−function initPicture(x_min,x_max,y_min,y_max){if(!initialized){setdefaults();initialized=true;if(x_min!=null)xmin=x_min;if(x_max!=null)xmax=x_max;if(y_min!=null)ymin=y_min;if(y_max!=null)ymax=y_max;if(xmin==null)xmin=defaultxmin;if(xmax==null)xmax=defaultxmax;if(typeof xmin!="number"||typeof xmax!="number"||xmin>=xmax)
244−alert("Picture requires at least two numbers: xmin < xmax");else if(y_max!=null&&(typeof y_min!="number"||typeof y_max!="number"||y_min>=y_max))
245−alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");else{if(width==null){width=picture.getAttribute("width");if(width==null||width=="")width=defaultwidth;}
246−picture.setAttribute("width",width);if(height==null){height=picture.getAttribute("height");if(height==null||height=="")height=defaultheight;}
247−picture.setAttribute("height",height);xunitlength=(width-2*border)/(xmax-xmin);yunitlength=xunitlength;if(ymin==null){origin=[-xmin*xunitlength+border,height/2];ymin=-(height-2*border)/(2*yunitlength);ymax=-ymin;}else{if(ymax!=null)yunitlength=(height-2*border)/(ymax-ymin);else ymax=(height-2*border)/yunitlength+ymin;origin=[-xmin*xunitlength+border,-ymin*yunitlength+border];}
248−if(isIE){if(picture.FULLSCREEN==undefined){setTimeout('drawPictures()',50);throw"wait";}
249−svgpicture=picture.getSVGDocument().getElementById("root");if(svgpicture==null){setTimeout('drawPictures()',50);throw"wait";}
250−svgpicture=picture.getSVGDocument().getElementById("root");while(svgpicture.childNodes.length>0)
251−svgpicture.removeChild(svgpicture.lastChild);svgpicture.setAttribute("width",width);svgpicture.setAttribute("height",height);svgpicture.setAttribute("name",picture.getAttribute("id"));doc=picture.getSVGDocument();}else{var qnode=document.createElementNS("http://www.w3.org/2000/svg","svg");qnode.setAttribute("id",picture.getAttribute("id"));qnode.setAttribute("name",picture.getAttribute("id"));qnode.setAttribute("width",picture.getAttribute("width"));qnode.setAttribute("height",picture.getAttribute("height"));picturepos=findPos(picture);if(picture.parentNode!=null){picture.parentNode.replaceChild(qnode,picture);}else{svgpicture.parentNode.replaceChild(qnode,svgpicture);}
252−svgpicture=qnode;doc=document;}
253−var nd=document.getElementById(picture.getAttribute("id")+"mml");if(nd!=null)
254−while(nd.childNodes.length>0)nd.removeChild(nd.lastChild);svgpicture.setAttribute("xunitlength",xunitlength);svgpicture.setAttribute("yunitlength",yunitlength);svgpicture.setAttribute("xmin",xmin);svgpicture.setAttribute("xmax",xmax);svgpicture.setAttribute("ymin",ymin);svgpicture.setAttribute("ymax",ymax);svgpicture.setAttribute("ox",origin[0]);svgpicture.setAttribute("oy",origin[1]);var node=myCreateElementSVG("rect");node.setAttribute("x","0");node.setAttribute("y","0");node.setAttribute("width",width);node.setAttribute("height",height);node.setAttribute("style",backgroundstyle);svgpicture.appendChild(node);svgpicture.setAttribute("onmousemove","displayCoord(evt)");svgpicture.setAttribute("onmouseout","removeCoord(evt)");svgpicture.setAttribute("onclick","mClick(evt)");node=myCreateElementSVG("text");node.appendChild(doc.createTextNode(" "));node.setAttribute("id","coords");svgpicture.appendChild(node);node=myCreateElementSVG("text");node.appendChild(doc.createTextNode(" "));node.setAttribute("id","coords");svgpicture.appendChild(node);border=defaultborder;}}}
255−function line(p,q,id,endpts){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
256−node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+
257−(height-p[1]*yunitlength-origin[1])+" "+
258−(q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));node.setAttribute("stroke-width",strokewidth);if(strokedasharray!=null)
259−node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="dot"||marker=="arrowdot"){ASdot(p,markersize,markerstroke,markerfill);if(marker=="arrowdot")arrowhead(p,q);ASdot(q,markersize,markerstroke,markerfill);}else if(marker=="arrow")arrowhead(p,q);if(endpts==null&&endpoints!="")endpts=endpoints;if(endpts!=null){if(endpts.indexOf("<-")!=-1)arrowhead(q,p);if(endpts.indexOf("o-")!=-1)dot(p,"open");if(endpts.indexOf("*-")!=-1)dot(p,"closed");if(endpts.indexOf("->")!=-1)arrowhead(p,q);if(endpts.indexOf("-o")!=-1)dot(q,"open");if(endpts.indexOf("-*")!=-1)dot(q,"closed");}}
260−function path(plist,id,c,endpts){if(c==null)c="";var node,st,i;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
261−if(typeof plist=="string")st=plist;else{st="M";st+=(plist[0][0]*xunitlength+origin[0])+","+
262−(height-plist[0][1]*yunitlength-origin[1])+" "+c;for(i=1;i<plist.length;i++)
263−st+=(plist[i][0]*xunitlength+origin[0])+","+
264−(height-plist[i][1]*yunitlength-origin[1])+" ";}
265−node.setAttribute("d",st);node.setAttribute("stroke-width",strokewidth);if(strokedasharray!=null)
266−node.setAttribute("stroke-dasharray",strokedasharray);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="dot"||marker=="arrowdot")
267−for(i=0;i<plist.length;i++)
268−if(c!="C"&&c!="T"||i!=1&&i!=2)
269−ASdot(plist[i],markersize,markerstroke,markerfill);if(endpts==null&&endpoints!="")endpts=endpoints;if(endpts!=null){if(endpts.indexOf("<-")!=-1)arrowhead(plist[1],plist[0]);if(endpts.indexOf("o-")!=-1)dot(plist[0],"open");if(endpts.indexOf("*-")!=-1)dot(plist[0],"closed");if(endpts.indexOf("->")!=-1)arrowhead(plist[plist.length-2],plist[plist.length-1]);if(endpts.indexOf("-o")!=-1)dot(plist[plist.length-1],"open");if(endpts.indexOf("-*")!=-1)dot(plist[plist.length-1],"closed");}}
270−function curve(plist,id,endpts){path(plist,id,"T",endpts);}
271−function vector(p,q,id){line(p,q,id,"","->");}
272−function circle(center,radius,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("circle");node.setAttribute("id",id);svgpicture.appendChild(node);}
273−node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("r",radius*xunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
274−function loop(p,d,id){if(d==null)d=[1,0];path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");if(marker=="arrow"||marker=="arrowdot")
275−arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);}
276−function arc(start,end,radius,id,largearc){var node,v;if(id!=null)node=doc.getElementById(id);if(largearc==null)largearc=0;if(radius==null){v=[end[0]-start[0],end[1]-start[1]];radius=Math.sqrt(v[0]*v[0]+v[1]*v[1]);}
277−if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
278−node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+
279−(height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+
280−radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+
281−(height-end[1]*yunitlength-origin[1]));node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);if(marker=="arrow"||marker=="arrowdot"){u=[(end[1]-start[1])/4,(start[0]-end[0])/4];v=[(end[0]-start[0])/2,(end[1]-start[1])/2];v=[start[0]+v[0]+u[0],start[1]+v[1]+u[1]];}else v=[start[0],start[1]];if(marker=="dot"||marker=="arrowdot"){ASdot(start,markersize,markerstroke,markerfill);if(marker=="arrowdot")arrowhead(v,end);ASdot(end,markersize,markerstroke,markerfill);}else if(marker=="arrow")arrowhead(v,end);}
282−function sector(center,start,end,id){var rx=start[0]-center[0],ry=start[1]-center[1];arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc");path([end,center,start],id+"path");}
283−function ellipse(center,rx,ry,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("ellipse");node.setAttribute("id",id);svgpicture.appendChild(node);}
284−node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("rx",rx*xunitlength);node.setAttribute("ry",ry*yunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
285−function triangle(p,q,r,id){path([p,q,r,p],id)}
286−function rect(p,q,id,rx,ry){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("rect");node.setAttribute("id",id);svgpicture.appendChild(node);}
287−node.setAttribute("x",p[0]*xunitlength+origin[0]);node.setAttribute("y",height-q[1]*yunitlength-origin[1]);node.setAttribute("width",(q[0]-p[0])*xunitlength);node.setAttribute("height",(q[1]-p[1])*yunitlength);if(rx!=null)node.setAttribute("rx",rx*xunitlength);if(ry!=null)node.setAttribute("ry",ry*yunitlength);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",fill);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);}
288−function text(p,st,pos,id,fontsty){var dnode,node,dx=0,dy=fontsize/3,str=st.toString();if(/(`|\$)/.test(str)){dnode=document.getElementById(svgpicture.getAttribute("name")+"mml");if(dnode!=null){if(id!=null)node=document.getElementById(id);if(node==null){node=createElementXHTML("div");node.setAttribute("id",id);node.style.position="absolute";dnode.appendChild(node);}
289−while(node.childNodes.length>0)node.removeChild(node.lastChild);node.appendChild(document.createTextNode(str));if(/`/.test(str))AMprocessNode(node);else LMprocessNode(node);dx=-node.offsetWidth/2;dy=-node.offsetHeight/2;if(pos!=null){if(/above/.test(pos))dy=-node.offsetHeight;if(/below/.test(pos))dy=0;if(/right/.test(pos))dx=0;if(/left/.test(pos))dx=-node.offsetWidth;}
290−node.style.left=""+(p[0]*xunitlength+origin[0]+dx)+"px";node.style.top=""+(height-p[1]*yunitlength-origin[1]+dy)+"px";}
291−return p;}
292−var textanchor="middle";if(pos!=null){if(/above/.test(pos))dy=-fontsize/2;if(/below/.test(pos))dy=fontsize-0;if(/right/.test(pos)){textanchor="start";dx=fontsize/4;}
293−if(/left/.test(pos)){textanchor="end";dx=-fontsize/4;}}
294−if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("text");node.setAttribute("id",id);svgpicture.appendChild(node);node.appendChild(doc.createTextNode(str));}
295−while(node.childNodes.length>1)node.removeChild(node.lastChild);node.lastChild.nodeValue="\xA0"+str+"\xA0";node.setAttribute("x",p[0]*xunitlength+origin[0]+dx);node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy);node.setAttribute("font-style",(fontsty!=null?fontsty:(str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle)));node.setAttribute("font-family",fontfamily);node.setAttribute("font-size",fontsize);node.setAttribute("font-weight",fontweight);node.setAttribute("text-anchor",textanchor);if(fontstroke!="none")node.setAttribute("stroke",fontstroke);if(fontfill!="none")node.setAttribute("fill",fontfill);return p;}
296−function mtext(p,st,pos,fontsty,fontsz){var textanchor="middle";var dx=0;var dy=fontsize/3;if(pos!=null){if(pos.slice(0,5)=="above")dy=-fontsize/2;if(pos.slice(0,5)=="below")dy=fontsize-0;if(pos.slice(0,5)=="right"||pos.slice(5,10)=="right"){textanchor="start";dx=fontsize/2;}
297−if(pos.slice(0,4)=="left"||pos.slice(5,9)=="left"){textanchor="end";dx=-fontsize/2;}}
298−var node=this;if(this.nodeName=="svg"){node=myCreateElementSVG("text");this.appendChild(node);node.appendChild(doc.createTextNode(st));}
299−node.lastChild.nodeValue=st;node.setAttribute("x",p[0]+dx);node.setAttribute("y",p[1]+dy);node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));node.setAttribute("font-family",fontfamily);node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize));node.setAttribute("font-weight",fontweight);node.setAttribute("text-anchor",textanchor);if(fontstroke!="none")node.setAttribute("stroke",fontstroke);if(fontfill!="none")node.setAttribute("fill",fontfill);}
300−function image(imgurl,p,w,h,id){var node;if(id!=null)node=doc.getElementById(id);if(node==null){node=myCreateElementSVG("image");node.setAttribute("id",id);svgpicture.appendChild(node);}
301−node.setAttribute("x",p[0]*xunitlength+origin[0]);node.setAttribute("y",height-p[1]*yunitlength-origin[1]);node.setAttribute("width",w);node.setAttribute("height",h);node.setAttribute("xlink:href",imgurl);}
302−function ASdot(center,radius,s,f){if(s==null)s=stroke;if(f==null)f=fill;var node=myCreateElementSVG("circle");node.setAttribute("cx",center[0]*xunitlength+origin[0]);node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);node.setAttribute("r",radius);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",s);node.setAttribute("fill",f);svgpicture.appendChild(node);}
303−function dot(center,typ,label,pos,id){var node;var cx=center[0]*xunitlength+origin[0];var cy=height-center[1]*yunitlength-origin[1];if(id!=null)node=doc.getElementById(id);if(typ=="+"||typ=="-"||typ=="|"){if(node==null){node=myCreateElementSVG("path");node.setAttribute("id",id);svgpicture.appendChild(node);}
304−if(typ=="+"){node.setAttribute("d"," M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+" M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));node.setAttribute("stroke-width",.5);node.setAttribute("stroke",axesstroke);}else{if(typ=="-")node.setAttribute("d"," M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);else node.setAttribute("d"," M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);}}else{if(node==null){node=myCreateElementSVG("circle");node.setAttribute("id",id);svgpicture.appendChild(node);}
305−node.setAttribute("cx",cx);node.setAttribute("cy",cy);node.setAttribute("r",dotradius);node.setAttribute("stroke-width",strokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",(typ=="open"?"white":(typ=="closed"?stroke:markerfill)));}
306−if(label!=null)
307−text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))}
308−point=dot;function arrowhead(p,q){var up;var v=[p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];var w=[q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];var u=[w[0]-v[0],w[1]-v[1]];var d=Math.sqrt(u[0]*u[0]+u[1]*u[1]);if(d>0.00000001){u=[u[0]/d,u[1]/d];up=[-u[1],u[0]];var node=myCreateElementSVG("path");node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+
309−(w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+
310−(w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");node.setAttribute("stroke-width",markerstrokewidth);node.setAttribute("stroke",stroke);node.setAttribute("fill",stroke);node.setAttribute("stroke-opacity",strokeopacity);node.setAttribute("fill-opacity",fillopacity);svgpicture.appendChild(node);}}
311−function chopZ(st){var k=st.indexOf(".");if(k==-1)return st;for(var i=st.length-1;i>k&&st.charAt(i)=="0";i--);if(i==k)i--;return st.slice(0,i+1);}
312−function grid(dx,dy){axes(dx,dy,null,dx,dy)}
313−function noaxes(){if(!initialized)initPicture();}
314−function axes(dx,dy,labels,gdx,gdy){var x,y,ldx,ldy,lx,ly,lxp,lyp,pnode,st;if(!initialized)initPicture();if(typeof dx=="string"){labels=dx;dx=null;}
315−if(typeof dy=="string"){gdx=dy;dy=null;}
316−if(xscl!=null){dx=xscl;gdx=xscl;labels=dx}
317−if(yscl!=null){dy=yscl;gdy=yscl}
318−if(xtick!=null){dx=xtick}
319−if(ytick!=null){dy=ytick}
320−dx=(dx==null?xunitlength:dx*xunitlength);dy=(dy==null?dx:dy*yunitlength);fontsize=Math.min(dx/2,dy/2,16);ticklength=fontsize/4;if(xgrid!=null)gdx=xgrid;if(ygrid!=null)gdy=ygrid;if(gdx!=null){gdx=(typeof gdx=="string"?dx:gdx*xunitlength);gdy=(gdy==null?dy:gdy*yunitlength);pnode=myCreateElementSVG("path");st="";for(x=origin[0];x<width;x=x+gdx)
321−st+=" M"+x+",0"+" "+x+","+height;for(x=origin[0]-gdx;x>0;x=x-gdx)
322−st+=" M"+x+",0"+" "+x+","+height;for(y=height-origin[1];y<height;y=y+gdy)
323−st+=" M0,"+y+" "+width+","+y;for(y=height-origin[1]-gdy;y>0;y=y-gdy)
324−st+=" M0,"+y+" "+width+","+y;pnode.setAttribute("d",st);pnode.setAttribute("stroke-width",.5);pnode.setAttribute("stroke",gridstroke);pnode.setAttribute("fill",fill);svgpicture.appendChild(pnode);}
325−pnode=myCreateElementSVG("path");st="M0,"+(height-origin[1])+" "+width+","+
326−(height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height;for(x=origin[0]+dx;x<width;x=x+dx)
327−st+=" M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
328−(height-origin[1]-ticklength);for(x=origin[0]-dx;x>0;x=x-dx)
329−st+=" M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
330−(height-origin[1]-ticklength);for(y=height-origin[1]+dy;y<height;y=y+dy)
331−st+=" M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;for(y=height-origin[1]-dy;y>0;y=y-dy)
332−st+=" M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;if(labels!=null)with(Math){ldx=dx/xunitlength;ldy=dy/yunitlength;lx=(xmin>0||xmax<0?xmin:0);ly=(ymin>0||ymax<0?ymin:0);lxp=(ly==0?"below":"above");lyp=(lx==0?"left":"right");var ddx=floor(1.1-log(ldx)/log(10))+1;var ddy=floor(1.1-log(ldy)/log(10))+1;for(x=ldx;x<=xmax;x=x+ldx)
333−text([x,ly],chopZ(x.toFixed(ddx)),lxp);for(x=-ldx;xmin<=x;x=x-ldx)
334−text([x,ly],chopZ(x.toFixed(ddx)),lxp);for(y=ldy;y<=ymax;y=y+ldy)
335−text([lx,y],chopZ(y.toFixed(ddy)),lyp);for(y=-ldy;ymin<=y;y=y-ldy)
336−text([lx,y],chopZ(y.toFixed(ddy)),lyp);}
337−fontsize=defaultfontsize;pnode.setAttribute("d",st);pnode.setAttribute("stroke-width",.5);pnode.setAttribute("stroke",axesstroke);pnode.setAttribute("fill",fill);pnode.setAttribute("stroke-opacity",strokeopacity);pnode.setAttribute("fill-opacity",fillopacity);svgpicture.appendChild(pnode);}
338−function mathjs(st){st=st.replace(/\s/g,"");if(st.indexOf("^-1")!=-1){st=st.replace(/sin\^-1/g,"arcsin");st=st.replace(/cos\^-1/g,"arccos");st=st.replace(/tan\^-1/g,"arctan");st=st.replace(/sec\^-1/g,"arcsec");st=st.replace(/csc\^-1/g,"arccsc");st=st.replace(/cot\^-1/g,"arccot");st=st.replace(/sinh\^-1/g,"arcsinh");st=st.replace(/cosh\^-1/g,"arccosh");st=st.replace(/tanh\^-1/g,"arctanh");st=st.replace(/sech\^-1/g,"arcsech");st=st.replace(/csch\^-1/g,"arccsch");st=st.replace(/coth\^-1/g,"arccoth");}
339−st=st.replace(/^e$/g,"(Math.E)");st=st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1");st=st.replace(/([^a-zA-Z])e/g,"$1(Math.E)");st=st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");st=st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");var i,j,k,ch,nested;while((i=st.indexOf("^"))!=-1){if(i==0)return"Error: missing argument";j=i-1;ch=st.charAt(j);if(ch>="0"&&ch<="9"){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;if(ch=="."){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;}}else if(ch==")"){nested=1;j--;while(j>=0&&nested>0){ch=st.charAt(j);if(ch=="(")nested--;else if(ch==")")nested++;j--;}
340−while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
341−j--;}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){j--;while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
342−j--;}else{return"Error: incorrect syntax in "+st+" at position "+j;}
343−if(i==st.length-1)return"Error: missing argument";k=i+1;ch=st.charAt(k);if(ch>="0"&&ch<="9"||ch=="-"){k++;while(k<st.length&&(ch=st.charAt(k))>="0"&&ch<="9")k++;if(ch=="."){k++;while(k<st.length&&(ch=st.charAt(k))>="0"&&ch<="9")k++;}}else if(ch=="("){nested=1;k++;while(k<st.length&&nested>0){ch=st.charAt(k);if(ch=="(")nested++;else if(ch==")")nested--;k++;}}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){k++;while(k<st.length&&(ch=st.charAt(k))>="a"&&ch<="z"||ch>="A"&&ch<="Z")k++;}else{return"Error: incorrect syntax in "+st+" at position "+k;}
344−st=st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+
345−st.slice(k);}
346−while((i=st.indexOf("!"))!=-1){if(i==0)return"Error: missing argument";j=i-1;ch=st.charAt(j);if(ch>="0"&&ch<="9"){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;if(ch=="."){j--;while(j>=0&&(ch=st.charAt(j))>="0"&&ch<="9")j--;}}else if(ch==")"){nested=1;j--;while(j>=0&&nested>0){ch=st.charAt(j);if(ch=="(")nested--;else if(ch==")")nested++;j--;}
347−while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
348−j--;}else if(ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"){j--;while(j>=0&&(ch=st.charAt(j))>="a"&&ch<="z"||ch>="A"&&ch<="Z")
349−j--;}else{return"Error: incorrect syntax in "+st+" at position "+j;}
350−st=st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);}
351−return st;}
352−function plot(fun,x_min,x_max,points,id,endpts){var pth=[];var f=function(x){return x},g=fun;var name=null;if(typeof fun=="string")
353−eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");else if(typeof fun=="object"){eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");}
354−if(typeof x_min=="string"){name=x_min;x_min=xmin}
355−else name=id;var min=(x_min==null?xmin:x_min);var max=(x_max==null?xmax:x_max);var inc=max-min-0.000001*(max-min);inc=(points==null?inc/200:inc/points);var gt;for(var t=min;t<=max;t+=inc){gt=g(t);if(!(isNaN(gt)||Math.abs(gt)=="Infinity"))pth[pth.length]=[f(t),gt];}
356−path(pth,name,null,endpts);return pth;}
357−function slopefield(fun,dx,dy){var g=fun;if(typeof fun=="string")
358−eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");var gxy,x,y,u,v,dz;if(dx==null)dx=1;if(dy==null)dy=1;dz=Math.sqrt(dx*dx+dy*dy)/6;var x_min=Math.ceil(xmin/dx);var y_min=Math.ceil(ymin/dy);for(x=x_min;x<=xmax;x+=dx)
359−for(y=y_min;y<=ymax;y+=dy){gxy=g(x,y);if(!isNaN(gxy)){if(Math.abs(gxy)=="Infinity"){u=0;v=dz;}
360−else{u=dz/Math.sqrt(1+gxy*gxy);v=gxy*u;}
361−line([x-u,y-v],[x+u,y+v]);}}}
362−function show_props(obj){var result="";for(var i=0;i<obj.childNodes.length;i++)
363−result+=obj.childNodes.item(i)+"\n";return result;}
364−function displayCoord(evt){if(showcoordinates){var svgroot=evt.target.parentNode;var nl=svgroot.childNodes;for(var i=0;i<nl.length&&nl.item(i).nodeName!="text";i++);var cnode=nl.item(i);cnode.mtext=mtext;cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")","left","","11");}}
365−function removeCoord(evt){var svgroot=evt.target.parentNode;var nl=svgroot.childNodes;for(var i=0;i<nl.length&&nl.item(i).nodeName!="text";i++);var cnode=nl.item(i);cnode.mtext=mtext;cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"","aboveleft","");}
366−function initASCIIMathCalculators(li){var i;for(i=0;i<li.length;i++){li[i].innerHTML=calcstr;AMprocessNode(li[i]);}
367−li=document.getElementsByTagName("textarea");var st;for(i=0;i<li.length;i++){st=li[i].getAttribute("onkeyup");if(st!=null)eval(String(st).replace(/function anonymous\(\)/,""));}}
368−function calculate(inputId,outputId){var str=document.getElementById(inputId).value;var err="";var ind=str.lastIndexOf("\n");if(ind==str.length-1)str=str.slice(0,ind);str=str.slice(str.lastIndexOf("\n")+1);try{var res=eval(mathjs(str));}catch(e){err="syntax incomplete";}
369−if(!isNaN(res)&&res!="Infinity")
370−str="`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err;else if(str!="")str="`"+str+"` = undefined";var outnode=document.getElementById(outputId);var n=outnode.childNodes.length;for(var i=0;i<n;i++)
371−outnode.removeChild(outnode.firstChild);outnode.appendChild(document.createTextNode(str));AMprocessNode(outnode);}
372−function append(st){document.getElementById('in').value+=st;calculate('in','out');document.getElementById('in').scrollTop=1000;document.getElementById('in').focus();}
373−function clearTextArea(){document.getElementById('in').value="";calculate('in','out');document.getElementById('in').focus();}
374−var calcstr="<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: &nbsp; &nbsp; <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\">&nbsp;`C`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button></td>\n<td><button onclick=\"append('sin(')\">&nbsp;`sin`</button></td>\n<td><button onclick=\"append('cos(')\">&nbsp;`cos`</button></td>\n<td><button onclick=\"append('tan(')\">&nbsp;`tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\">&nbsp; `!` &nbsp;</button></td>\n\n<td><button onclick=\"append('(')\"><font size=2>&nbsp;&nbsp;`(`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append(')')\"><font size=2>&nbsp;&nbsp;`)`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\">&nbsp;`-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\">&nbsp; `7` &nbsp;</button></td>\n<td><button onclick=\"append('8')\">&nbsp; `8` &nbsp;</button></td>\n\n<td><button onclick=\"append('9')\">&nbsp; `9` &nbsp;</button></td>\n<td><button onclick=\"append('*')\">&nbsp;`times`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\">&nbsp;`ln`&nbsp;</button></td>\n<td><button onclick=\"append('4')\">&nbsp; `4` &nbsp;</button></td>\n<td><button onclick=\"append('5')\">&nbsp; `5` &nbsp;</button></td>\n<td><button onclick=\"append('6')\">&nbsp; `6` &nbsp;</button></td>\n\n<td><button onclick=\"append('-')\">&nbsp;`-{::}`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\">&nbsp; `e` &nbsp;</button></td>\n<td><button onclick=\"append('1')\">&nbsp;&nbsp;`1` &nbsp;</button></td>\n<td><button onclick=\"append('2')\">&nbsp; `2` &nbsp;</button></td>\n<td><button onclick=\"append('3')\">&nbsp; `3` &nbsp;</button></td>\n<td><button onclick=\"append('+')\">&nbsp;`+{::}`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button--></td>\n<td><button onclick=\"append('0')\">&nbsp; `0` &nbsp;</button></td>\n<td><button onclick=\"append('.')\">&nbsp; `.` &nbsp;</button></td>\n<td><button onclick=\"append('\\n')\">&nbsp;`\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>";function generic()
375−{if(!init())return;if(translateOnLoad){var nd=document.getElementById("processasciimathinmoodle");if(nd!=null)dsvglocation=nd.className;if(nd!=null||!checkforprocessasciimathinmoodle){translate();if(!noSVG&&translateASCIIsvg)drawPictures();}
376−var li=getElementsByClass(document,"div","ASCIIMathCalculator");if(!noMathML&&li.length>0)initASCIIMathCalculators(li);}};if(typeof window.addEventListener!='undefined')
129+function AMparseMath(str){var result,node=AMcreateElementMathML("mstyle");var cclr=str.match(/\\color\s*\{\s*([#\w]+)\s*\}/);str=str.replace(/\\color\s*\{\s*[#\w]+\s*\}/g,"");if(cclr!=null){if(IsColorName.test(cclr[1].toLowerCase())){cclr=LaTeXColor[cclr[1].toLowerCase()];}else{cclr=cclr[1];}
130+node.setAttribute("mathcolor",cclr);}else{if(mathcolor!="")node.setAttribute("mathcolor",mathcolor);};if(mathfontfamily!="")node.setAttribute("fontfamily",mathfontfamily);node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);node=AMcreateMmlNode("math",node);if(showasciiformulaonhover)
131+node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}
132+return node;}
133+function AMstrarr2docFrag(arr,linebreaks){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(AMparseMath(arr[i]));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(AMcreateElementXHTML("p"));newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}
134+expr=!expr;}
135+return newFrag;}
136+function AMprocessNodeR(n,linebreaks){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"&&n.parentNode.nodeName!="pre"&&n.parentNode.nodeName!="PRE"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)
137+arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)
138+if(alertIfNoMathML)
139+alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\nor Firefox/Mozilla/Netscape");else AMbody.insertBefore(nd,AMbody.childNodes[0]);}
140+if(!AMnoMathML){frg=AMstrarr2docFrag(arr,n.nodeType==8);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)
141+i+=AMprocessNodeR(n.childNodes[i],linebreaks);}
142+return 0;}
143+function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")
144+for(var i=0;i<frag.length;i++)
145+if(frag[i].className=="AM")
146+AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}
147+if(st==null||st.indexOf("\$")!=-1)
148+AMprocessNodeR(n,linebreaks);}
149+if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}
150+var inAppendix=false;var sectionCntr=0;var IEcommentWarning=true;var biblist=[];var bibcntr=0;var LaTeXCounter=[];LaTeXCounter["definition"]=0;LaTeXCounter["proposition"]=0;LaTeXCounter["lemma"]=0;LaTeXCounter["theorem"]=0;LaTeXCounter["corollary"]=0;LaTeXCounter["example"]=0;LaTeXCounter["exercise"]=0;LaTeXCounter["subsection"]=0;LaTeXCounter["subsubsection"]=0;LaTeXCounter["figure"]=0;LaTeXCounter["equation"]=0;LaTeXCounter["table"]=0;var LaTeXColor=[];LaTeXColor["greenyellow"]="#D9FF4F";LaTeXColor["yellow"]="#FFFF00";LaTeXColor["goldenrod"]="#FFE529";LaTeXColor["dandelion"]="#FFB529";LaTeXColor["apricot"]="#FFAD7A";LaTeXColor["peach"]="#FF804D";LaTeXColor["melon"]="#FF8A80";LaTeXColor["yelloworange"]="#FF9400";LaTeXColor["orange"]="#FF6321";LaTeXColor["burntorange"]="#FF7D00";LaTeXColor["bittersweet"]="#C20300";LaTeXColor["redorange"]="#FF3B21";LaTeXColor["mahogany"]="#A60000";LaTeXColor["maroon"]="#AD0000";LaTeXColor["brickred"]="#B80000";LaTeXColor["red"]="#FF0000";LaTeXColor["orangered"]="#FF0080";LaTeXColor["rubinered"]="#FF00DE";LaTeXColor["wildstrawberry"]="#FF0A9C";LaTeXColor["salmon"]="#FF789E";LaTeXColor["carnationpink"]="#FF5EFF";LaTeXColor["magenta"]="#FF00FF";LaTeXColor["violetred"]="#FF30FF";LaTeXColor["rhodamine"]="#FF2EFF";LaTeXColor["mulberry"]="#A314FA";LaTeXColor["redviolet"]="#9600A8";LaTeXColor["fuchsia"]="#7303EB";LaTeXColor["lavender"]="#FF85FF";LaTeXColor["thistle"]="#E069FF";LaTeXColor["orchid"]="#AD5CFF";LaTeXColor["darkorchid"]="#9933CC";LaTeXColor["purple"]="#8C24FF";LaTeXColor["plum"]="#8000FF";LaTeXColor["violet"]="#361FFF";LaTeXColor["royalpurple"]="#401AFF";LaTeXColor["blueviolet"]="#1A0DF5";LaTeXColor["periwinkle"]="#6E73FF";LaTeXColor["cadetblue"]="#616EC4";LaTeXColor["cornflowerblue"]="#59DEFF";LaTeXColor["midnightblue"]="#007091";LaTeXColor["navyblue"]="#0F75FF";LaTeXColor["royalblue"]="#0080FF";LaTeXColor["blue"]="#0000FF";LaTeXColor["cerulean"]="#0FE3FF";LaTeXColor["cyan"]="#00FFFF";LaTeXColor["processblue"]="#0AFFFF";LaTeXColor["skyblue"]="#61FFE0";LaTeXColor["turquoise"]="#26FFCC";LaTeXColor["tealblue"]="#1FFAA3";LaTeXColor["aquamarine"]="#2EFFB2";LaTeXColor["bluegreen"]="#26FFAB";LaTeXColor["emerald"]="#00FF80";LaTeXColor["junglegreen"]="#03FF7A";LaTeXColor["seagreen"]="#4FFF80";LaTeXColor["green"]="#00FF00";LaTeXColor["forestgreen"]="#00E000";LaTeXColor["pinegreen"]="#00BF29";LaTeXColor["limegreen"]="#80FF00";LaTeXColor["yellowgreen"]="#8FFF42";LaTeXColor["springgreen"]="#BDFF3D";LaTeXColor["olivegreen"]="#009900";LaTeXColor["rawsienna"]="#8C0000";LaTeXColor["sepia"]="#4D0000";LaTeXColor["brown"]="#660000";LaTeXColor["tan"]="#DB9470";LaTeXColor["gray"]="#808080";LaTeXColor["grey"]="#808080";LaTeXColor["black"]="#000000";LaTeXColor["white"]="#FFFFFF";var IsColorName=/^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;var IsCounter=/^(?:definition|proposition|lemma|theorem|corollary|example|exercise|subsection|subsubsection|figure|equation|table)$/;var IsLaTeXElement=/^(?:displayequation|title|author|address|date|abstract|keyword|section|subsection|subsubsection|ref|cite|thebibliography|definition|proposition|lemma|theorem|corollary|example|exercise|itemize|enumerate|enddefinition|endproposition|endlemma|endtheorem|endcorollary|endexample|endexercise|enditemize|endenumerate|LaTeXMathMLlabel|LaTeXMathML|smallskip|medskip|bigskip|quote|quotation|endquote|endquotation|center|endcenter|description|enddescription|inlinemath)$/;var IsTextOnlyArea=/^(?:form|textarea|pre)$/i;var tableid=0;function makeNumberString(cntr){if(sectionCntr>0){if(inAppendix){return"A"+sectionCntr+"."+cntr;}else{return sectionCntr+"."+cntr;}}else{return""+cntr;}};function LaTeXpreProcess(thebody){var TheBody=thebody;if(TheBody.hasChildNodes()){if(!(IsLaTeXElement.test(TheBody.className)))
151+{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}
152+else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))
153+{var str=TheBody.nodeValue;if(!(str==null)){str=str.replace(/\\%/g,"<per>");str=str.replace(/%[^\n]*(?=\n)/g,"");str=str.replace(/%[^\r]*(?=\r)/g,"");str=str.replace(/%[^\n]*$/,"")
154+if(isIE&&str.match(/%/g)!=null&&IEcommentWarning){alert("Comments may not have parsed properly. Try putting in <pre class='LaTeX><div>..</div></pre> structure.");IEcommentWarning=false;}
155+str=str.replace(/<per>/g,"%");if(str.match(/XXX[\s\S]*/)!=null){var tmp=str.match(/XXX[\s\S]*/)[0];var tmpstr=tmp.charCodeAt(7)+"::"+tmp.charCodeAt(8)+"::"+tmp.charCodeAt(9)+"::"+tmp.charCodeAt(10)+"::"+tmp.charCodeAt(11)+"::"+tmp.charCodeAt(12)+"::"+tmp.charCodeAt(13);alert(tmpstr);}
156+str=str.replace(/([^\\])\\(\s)/g,"$1\u00A0$2");str=str.replace(/\\quad/g,"\u2001");str=str.replace(/\\qquad/g,"\u2001\u2001");str=str.replace(/\\enspace/g,"\u2002");str=str.replace(/\\;/g,"\u2004");str=str.replace(/\\:/g,"\u2005");str=str.replace(/\\,/g,"\u2006");str=str.replace(/\\thinspace/g,"\u200A");str=str.replace(/([^\\])~/g,"$1\u00A0");str=str.replace(/\\~/g,"~");str=str.replace(/\\\[/g," <DEQ> $\\displaystyle{");str=str.replace(/\\\]/g,"}$ <DEQ> ");str=str.replace(/\$\$/g,"${$<DEQ>$}$");str=str.replace(/\\begin\s*\{\s*array\s*\}/g,"\\begin{array}");str=str.replace(/\\end\s*\{\s*array\s*\}/g,"\\end{array}");str=str.replace(/\\begin\s*\{\s*eqnarray\s*\}/g," <DEQ>eqno$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*eqnarray\*\s*\}/g," <DEQ>$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\*\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*displaymath\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*displaymath\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\*\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\*\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\}/g," <DEQ>eqno$\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\}/g,"}$ <DEQ> ");str=str.split("<DEQ>");var newFrag=document.createDocumentFragment();for(var i=0;i<str.length;i++){if(i%2){var DEQtable=document.createElement("table");DEQtable.className='displayequation';var DEQtbody=document.createElement("tbody");var DEQtr=document.createElement("tr");var DEQtdeq=document.createElement("td");DEQtdeq.className='eq';str[i]=str[i].replace(/\$\}\$/g,"$\\displaystyle{");str[i]=str[i].replace(/\$\{\$/g,"}");var lbl=str[i].match(/\\label\s*\{\s*(\w+)\s*\}/);var ISeqno=str[i].match(/^eqno/);str[i]=str[i].replace(/^eqno/," ");str[i]=str[i].replace(/\\label\s*\{\s*\w+\s*\}/," ");DEQtdeq.appendChild(document.createTextNode(str[i]));DEQtr.appendChild(DEQtdeq);str[i]=str[i].replace(/\\nonumber/g,"");if(ISeqno!=null||lbl!=null){var DEQtdno=document.createElement("td");DEQtdno.className='eqno';LaTeXCounter["equation"]++;var eqnoString=makeNumberString(LaTeXCounter["equation"]);var DEQanchor=document.createElement("a");if(lbl!=null){DEQanchor.id=lbl[1]};DEQanchor.className="eqno";var anchorSpan=document.createElement("span");anchorSpan.className="eqno";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(eqnoString));DEQanchor.appendChild(anchorSpan);DEQtdno.appendChild(DEQanchor);var DEQspan=document.createElement("span");DEQspan.className="eqno";DEQspan.appendChild(document.createTextNode("("+eqnoString+")"));DEQtdno.appendChild(DEQspan);DEQtr.appendChild(DEQtdno);}
157+DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}
158+else{str[i]=str[i].replace(/\$\}\$/g,"");str[i]=str[i].replace(/\$\{\$/g,"");str[i]=str[i].replace(/\\maketitle/g,"");str[i]=str[i].replace(/\\begin\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\end\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\documentclass[^\}]*?\}/g,"");str[i]=str[i].replace(/\\usepackage[^\}]*?\}/g,"");str[i]=str[i].replace(/\\noindent/g,"");str[i]=str[i].replace(/\\notag/g,"");str[i]=str[i].replace(/\\ref\s*\{\s*(\w+)\}/g," \\[ref\\]$1\\[ ");str[i]=str[i].replace(/\\url\s*\{\s*([^\}\n]+)\}/g," \\[url\\]$1\\[ ");str[i]=str[i].replace(/\\href\s*\{\s*([^\}]+)\}\s*\{\s*([^\}]+)\}/g," \\[href\\]$1\\]$2\\[ ");str[i]=str[i].replace(/\\cite\s*\{\s*(\w+)\}/g," \\[cite\\]$1\\[ ");str[i]=str[i].replace(/\\qed/g,"\u220E");str[i]=str[i].replace(/\\endproof/g,"\u220E");str[i]=str[i].replace(/\\proof/g,"\\textbf{Proof: }");str[i]=str[i].replace(/\\n(?=\s)/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\newline/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\linebreak/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\smallskip/g," \\[logicalbreak\\]smallskip\\[ ");str[i]=str[i].replace(/\\medskip/g," \\[logicalbreak\\]medskip\\[ ");str[i]=str[i].replace(/\\bigskip/g," \\[logicalbreak\\]bigskip\\[ ");str[i]=str[i].replace(/[\n\r]+[ \f\n\r\t\v\u2028\u2029]*[\n\r]+/g," \\[logicalbreak\\]LaTeXMathML\\[ ");if(isIE){str[i]=str[i].replace(/\r/g," ");}
159+str[i]=str[i].replace(/\\bibitem\s*([^\{]*\{\s*\w*\s*\})/g," \\[bibitem\\]$1\\[ ");str[i]=str[i].replace(/\\bibitem\s*/g," \\[bibitem\\] \\[ ");str[i]=str[i].replace(/\\item\s*\[\s*(\w+)\s*\]/g," \\[alistitem\\]$1\\[ ");str[i]=str[i].replace(/\\item\s*/g," \\[alistitem\\] \\[ ");str[i]=str[i].replace(/\\appendix/g," \\[appendix\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*figure\s*\}([\s\S]+?)\\end\s*\{\s*figure\s*\}/g," \\[figure\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*table\s*\}([\s\S]+?)\\end\s*\{\s*table\s*\}/g," \\[table\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*theorem\s*\}/g," \\[theorem\\]Theorem \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*theorem\s*\}/g," \\[endtheorem\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*definition\s*\}/g," \\[definition\\]Definition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*definition\s*\}/g," \\[enddefinition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*lemma\s*\}/g," \\[lemma\\]Lemma \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*lemma\s*\}/g," \\[endlemma\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*corollary\s*\}/g," \\[corollary\\]Corollary \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*corollary\s*\}/g," \\[endcorollary\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proposition\s*\}/g," \\[proposition\\]Proposition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*proposition\s*\}/g," \\[endproposition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*example\s*\}/g," \\[example\\]Example \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*example\s*\}/g," \\[endexample\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*exercise\s*\}/g," \\[exercise\\]Exercise \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*exercise\s*\}/g," \\[endexercise\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}\s*\{\s*\w+\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*thebibliography\s*\}/g," \\[endthebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proof\s*\}/g," \\[proof\\]Proof: \\[ ");if(isIE){str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g,"\u220E \\[endproof\\] \\[ ");}else{str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g," \\[endproof\\] \\[ ");}
160+str[i]=str[i].replace(/\\title\s*\{\s*([^\}]+)\}/g," \\[title\\] \\[$1 \\[endtitle\\] \\[ ");str[i]=str[i].replace(/\\author\s*\{\s*([^\}]+)\}/g," \\[author\\] \\[$1 \\[endauthor\\] \\[ ");str[i]=str[i].replace(/\\address\s*\{\s*([^\}]+)\}/g," \\[address\\] \\[$1 \\[endaddress\\] \\[ ");str[i]=str[i].replace(/\\date\s*\{\s*([^\}]+)\}/g," \\[date\\] \\[$1 \\[enddate\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*keyword\s*\}/g," \\[keyword\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*keyword\s*\}/g," \\[endkeyword\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*abstract\s*\}/g," \\[abstract\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*abstract\s*\}/g," \\[endabstract\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[$1\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[end$1\\] \\[ ");var sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\section\s*\{/," \\[section\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);}
161+sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsection\s*\{/," \\[subsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);}
162+sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsubsection\s*\{/," \\[subsubsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);}
163+var CatToNextEven="";var strtmp=str[i].split("\\[");for(var j=0;j<strtmp.length;j++){if(j%2){var strtmparray=strtmp[j].split("\\]");switch(strtmparray[0]){case"section":var nodeTmp=document.createElement("H2");nodeTmp.className='section';sectionCntr++;for(var div in LaTeXCounter){LaTeXCounter[div]=0};var nodeAnchor=document.createElement("a");if(inAppendix){nodeAnchor.className='appendixsection';}else{nodeAnchor.className='section';}
164+var nodeNumString=makeNumberString("");var anchorSpan=document.createElement("span");anchorSpan.className="section";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='section';nodeSpan.appendChild(document.createTextNode(nodeNumString+" "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsection":var nodeTmp=document.createElement("H3");nodeTmp.className='subsection';LaTeXCounter["subsection"]++;LaTeXCounter["subsubsection"]=0;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsubsection":var nodeTmp=document.createElement("H4");nodeTmp.className='subsubsection';LaTeXCounter["subsubsection"]++;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsubsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]+"."+LaTeXCounter["subsubsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsubsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsubsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"href":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"url":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"figure":var nodeTmp=document.createElement("table");nodeTmp.className='figure';var FIGtbody=document.createElement("tbody");var FIGlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var FIGcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;FIGcap=tmp.substring(capstart,pos);break}}}
165+var FIGtr2=document.createElement("tr");var FIGtd2=document.createElement("td");FIGtd2.className="caption";var FIGanchor=document.createElement("a");FIGanchor.className="figure";if(FIGlbl!=null){FIGanchor.id=FIGlbl[1];}
166+LaTeXCounter["figure"]++;var fignmbr=makeNumberString(LaTeXCounter["figure"]);var anchorSpan=document.createElement("span");anchorSpan.className="figure";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(fignmbr));FIGanchor.appendChild(anchorSpan);FIGtd2.appendChild(FIGanchor);var FIGspan=document.createElement("span");FIGspan.className="figure";FIGspan.appendChild(document.createTextNode("Figure "+fignmbr+". "));FIGtd2.appendChild(FIGspan);FIGtd2.appendChild(document.createTextNode(""+FIGcap));FIGtr2.appendChild(FIGtd2);FIGtbody.appendChild(FIGtr2);var IsSpecial=false;var FIGinfo=strtmparray[1].match(/\\includegraphics\s*\{([^\}]+)\}/);if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\includegraphics\s*\[[^\]]*\]\s*\{\s*([^\}]+)\s*\}/);}
167+if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\special\s*\{\s*([^\}]+)\}/);IsSpecial=true};if(FIGinfo!=null){var FIGtr1=document.createElement("tr");var FIGtd1=document.createElement("td");FIGtd1.className="image";var FIGimg=document.createElement("img");var FIGsrc=FIGinfo[1];FIGimg.src=FIGsrc;FIGimg.alt="Figure "+FIGsrc+" did not load";FIGimg.title="Figure "+fignmbr+". "+FIGcap;FIGimg.id="figure"+fignmbr;FIGtd1.appendChild(FIGimg);FIGtr1.appendChild(FIGtd1);FIGtbody.appendChild(FIGtr1);}
168+nodeTmp.appendChild(FIGtbody);newFrag.appendChild(nodeTmp);break;case"table":var nodeTmp=document.createElement("table");if(strtmparray[1].search(/\\centering/)>=0){nodeTmp.className='LaTeXtable centered';nodeTmp.align="center";}else{nodeTmp.className='LaTeXtable';};tableid++;nodeTmp.id="LaTeXtable"+tableid;var TABlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var TABcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;TABcap=tmp.substring(capstart,pos);break}}}
169+if(TABcap!=""){var TABtbody=document.createElement("tbody");var TABcaption=document.createElement("caption");TABcaption.className="LaTeXtable centered";var TABanchor=document.createElement("a");TABanchor.className="LaTeXtable";if(TABlbl!=null){TABanchor.id=TABlbl[1];}
170+LaTeXCounter["table"]++;var tabnmbr=makeNumberString(LaTeXCounter["table"]);var anchorSpan=document.createElement("span");anchorSpan.className="LaTeXtable";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(tabnmbr));TABanchor.appendChild(anchorSpan);TABcaption.appendChild(TABanchor);var TABspan=document.createElement("span");TABspan.className="LaTeXtable";TABspan.appendChild(document.createTextNode("Table "+tabnmbr+". "));TABcaption.appendChild(TABspan);TABcaption.appendChild(document.createTextNode(""+TABcap));nodeTmp.appendChild(TABcaption);}
171+var TABinfo=strtmparray[1].match(/\\begin\s*\{\s*tabular\s*\}([\s\S]+)\\end\s*\{\s*tabular\s*\}/);if(TABinfo!=null){var TABtbody=document.createElement('tbody');var TABrow=null;var TABcell=null;var row=0;var col=0;var TABalign=TABinfo[1].match(/^\s*\{([^\}]+)\}/);TABinfo=TABinfo[1].replace(/^\s*\{[^\}]+\}/,"");TABinfo=TABinfo.replace(/\\hline/g,"");TABalign[1]=TABalign[1].replace(/\|/g,"");TABalign[1]=TABalign[1].replace(/\s/g,"");TABinfo=TABinfo.split("\\\\");for(row=0;row<TABinfo.length;row++){TABrow=document.createElement("tr");TABinfo[row]=TABinfo[row].split("&");for(col=0;col<TABinfo[row].length;col++){TABcell=document.createElement("td");switch(TABalign[1].charAt(col)){case"l":TABcell.align="left";break;case"c":TABcell.align="center";break;case"r":TABcell.align="right";break;default:TABcell.align="left";};TABcell.appendChild(document.createTextNode(TABinfo[row][col]));TABrow.appendChild(TABcell);}
172+TABtbody.appendChild(TABrow);}
173+nodeTmp.appendChild(TABtbody);}
174+newFrag.appendChild(nodeTmp);break;case"logicalbreak":var nodeTmp=document.createElement("p");nodeTmp.className=strtmparray[1];nodeTmp.appendChild(document.createTextNode("\u00A0"));newFrag.appendChild(nodeTmp);break;case"appendix":inAppendix=true;sectionCntr=0;break;case"alistitem":var EndDiv=document.createElement("div");EndDiv.className="endlistitem";newFrag.appendChild(EndDiv);var BegDiv=document.createElement("div");BegDiv.className="listitem";if(strtmparray[1]!=" "){var BegSpan=document.createElement("span");BegSpan.className="listitemmarker";var boldBegSpan=document.createElement("b");boldBegSpan.appendChild(document.createTextNode(strtmparray[1]+" "));BegSpan.appendChild(boldBegSpan);BegDiv.appendChild(BegSpan);}
175+newFrag.appendChild(BegDiv);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"bibitem":newFrag.appendChild(document.createElement("br"));var nodeTmp=document.createElement("a");nodeTmp.className='bibitem';var nodeSpan=document.createElement("span");nodeSpan.className='bibitem';bibcntr++;var lbl=strtmparray[1].match(/\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\s*\{\s*\w+\s*\}/g,"");strtmparray[1]=strtmparray[1].replace(/^\s*\[/,"");strtmparray[1]=strtmparray[1].replace(/\s*\]$/,"");strtmparray[1]=strtmparray[1].replace(/^\s+|\s+$/g,"");if(lbl==null){biblist[bibcntr]="bibitem"+bibcntr}else{biblist[bibcntr]=lbl[1];};nodeTmp.name=biblist[bibcntr];nodeTmp.id=biblist[bibcntr];if(strtmparray[1]!=""){nodeSpan.appendChild(document.createTextNode(strtmparray[1]));}else{nodeSpan.appendChild(document.createTextNode("["+bibcntr+"]"));}
176+nodeTmp.appendChild(nodeSpan);newFrag.appendChild(nodeTmp);break;case"cite":var nodeTmp=document.createElement("a");nodeTmp.className='cite';nodeTmp.name='cite';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;case"ref":var nodeTmp=document.createElement("a");nodeTmp.className='ref';nodeTmp.name='ref';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("div");nodeTmp.className=strtmparray[0];if(IsCounter.test(strtmparray[0])){LaTeXCounter[strtmparray[0]]++;var nodeAnchor=document.createElement("a");nodeAnchor.className=strtmparray[0];var divnum=makeNumberString(LaTeXCounter[strtmparray[0]]);var anchorSpan=document.createElement("span");anchorSpan.className=strtmparray[0];anchorSpan.appendChild(document.createTextNode(divnum));anchorSpan.style.display="none";nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]+" "+divnum+". "));nodeTmp.appendChild(nodeSpan);}
177+if(isIE){if(strtmparray[0]==("thebibliography"||"abstract"||"keyword"||"proof")){var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]));nodeTmp.appendChild(nodeSpan);}}
178+if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}
179+newFrag.appendChild(nodeTmp);if(strtmparray[0]=="enumerate"||strtmparray[0]=="itemize"||strtmparray[0]=="description"){var endDiv=document.createElement("div");endDiv.className="listitem";newFrag.appendChild(endDiv);}}}else{strtmp[j]=strtmp[j].replace(/\\\$/g,"<per>");strtmp[j]=strtmp[j].replace(/\$([^\$]+)\$/g," \\[$1\\[ ");strtmp[j]=strtmp[j].replace(/<per>/g,"\\$");strtmp[j]=strtmp[j].replace(/\\begin\s*\{\s*math\s*\}([\s\S]+?)\\end\s*\{\s*math\s*\}/g," \\[$1\\[ ");var strtmptmp=strtmp[j].split("\\[");for(var jjj=0;jjj<strtmptmp.length;jjj++){if(jjj%2){var nodeTmp=document.createElement("span");nodeTmp.className='inlinemath';nodeTmp.appendChild(document.createTextNode("$"+strtmptmp[jjj]+"$"));newFrag.appendChild(nodeTmp);}else{var TagIndex=strtmptmp[jjj].search(/\\\w+/);var tmpIndex=TagIndex;while(tmpIndex>-1){if(/^\\textcolor/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\textcolor\s*\{\s*(\w+)\s*\}\s*/," \\[textcolor\\]$1\\]|");}else{if(/^\\colorbox/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\colorbox\s*\{\s*(\w+)\s*\}\s*/," \\[colorbox\\]$1\\]|");}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).replace(/\\\s*(\w+)\s*/," \\[$1\\]|");}}
180+TagIndex+=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\|/);TagIndex++;strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\]\|/,"\\] ");if(strtmptmp[jjj].charAt(TagIndex)=="{"){strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);var delimcnt=1;for(var kk=TagIndex;kk<strtmptmp[jjj].length;kk++){if(strtmptmp[jjj].charAt(kk)=="{"){delimcnt++};if(strtmptmp[jjj].charAt(kk)=="}"){delimcnt--};if(delimcnt==0){break;}}
181+strtmptmp[jjj]=strtmptmp[jjj].substring(0,kk)+"\\[ "+strtmptmp[jjj].substring(kk+1,strtmptmp[jjj].length);TagIndex=kk+3;}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+"\\[ "+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);TagIndex=TagIndex+3;}
182+if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}
183+else{tmpIndex=-1};TagIndex+=tmpIndex;}
184+strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\\s*\\\\/g,"\\\\");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\/g," \\[br\\] \\[ ");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\label\s*\{\s*(\w+)\s*\}/g," \\[a\\]$1\\[ ");var strlbls=strtmptmp[jjj].split("\\[");for(var jj=0;jj<strlbls.length;jj++){if(jj%2){var strtmparray=strlbls[jj].split("\\]");switch(strtmparray[0]){case"textcolor":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.color=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.color=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"colorbox":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.background=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.background=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"a":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathMLlabel';nodeTmp.id=strtmparray[1];nodeTmp.style.display="none";newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("span");nodeTmp.className=strtmparray[0];nodeTmp.appendChild(document.createTextNode(strtmparray[1]))
185+newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}
186+return TheBody;}
187+function LaTeXDivsAndRefs(thebody){var TheBody=thebody;var EndDivClass=null;var AllDivs=TheBody.getElementsByTagName("div");var lbl2id="";var lblnode=null;for(var i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){EndDivClass=EndDivClass[0];var DivClass=EndDivClass.substring(3,EndDivClass.length);var EndDivNode=AllDivs[i];break;}}
188+while(EndDivClass!=null){var newFrag=document.createDocumentFragment();var RootNode=EndDivNode.parentNode;var ClassCount=1;while(EndDivNode.previousSibling!=null&&ClassCount>0){switch(EndDivNode.previousSibling.className){case EndDivClass:ClassCount++;newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);break;case DivClass:if(EndDivNode.previousSibling.nodeName=="DIV"){ClassCount--;if(lbl2id!=""){EndDivNode.previousSibling.id=lbl2id;lbl2id=""}
189+if(ClassCount==0){RootNode=EndDivNode.previousSibling;}else{newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}};break;case'LaTeXMathMLlabel':lbl2id=EndDivNode.previousSibling.id;EndDivNode.parentNode.removeChild(EndDivNode.previousSibling);break;default:newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}}
190+RootNode.appendChild(newFrag);EndDivNode.parentNode.removeChild(EndDivNode);AllDivs=TheBody.getElementsByTagName("DIV");for(i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){ClassCount=0;EndDivClass=EndDivClass[0];DivClass=EndDivClass.substring(3,EndDivClass.length);EndDivNode=AllDivs[i];RootNode=EndDivNode.parentNode;break;}}}
191+var AllDivs=TheBody.getElementsByTagName("div");var DIV2LI=null;for(var i=0;i<AllDivs.length;i++){if(AllDivs[i].className=="itemize"||AllDivs[i].className=="enumerate"||AllDivs[i].className=="description"){if(AllDivs[i].className=="itemize"){RootNode=document.createElement("UL");}else{RootNode=document.createElement("OL");}
192+RootNode.className='LaTeXMathML';if(AllDivs[i].hasChildNodes()){AllDivs[i].removeChild(AllDivs[i].firstChild)};while(AllDivs[i].hasChildNodes()){if(AllDivs[i].firstChild.hasChildNodes()){DIV2LI=document.createElement("LI");while(AllDivs[i].firstChild.hasChildNodes()){DIV2LI.appendChild(AllDivs[i].firstChild.firstChild);}
193+if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}
194+RootNode.appendChild(DIV2LI)}
195+AllDivs[i].removeChild(AllDivs[i].firstChild);}
196+AllDivs[i].appendChild(RootNode);}}
197+var AllAnchors=TheBody.getElementsByTagName("a");for(var i=0;i<AllAnchors.length;i++){if(AllAnchors[i].className=="ref"||AllAnchors[i].className=="cite"){var label=AllAnchors[i].href.match(/\#(\w+)/);if(label!=null){var labelNode=document.getElementById(label[1]);if(labelNode!=null){var TheSpans=labelNode.getElementsByTagName("SPAN");if(TheSpans!=null){var refNode=TheSpans[0].cloneNode(true);refNode.style.display="inline"
198+refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}
199+return TheBody;}
200+var AMbody;var AMnoMathML=false,AMtranslated=false;function translate(spanclassAM){if(!AMtranslated){AMtranslated=true;AMinitSymbols();var LaTeXContainers=[];var AllContainers=document.getElementsByTagName('*');var ExtendName="";for(var k=0,l=0;k<AllContainers.length;k++){ExtendName=" "+AllContainers[k].className+" ";if(ExtendName.match(/\sLaTeX\s/)!=null){LaTeXContainers[l]=AllContainers[k];l++;}};if(LaTeXContainers.length>0){for(var m=0;m<LaTeXContainers.length;m++){AMbody=LaTeXContainers[m];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}
201+if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}
202+PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}
203+AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}
204+AMprocessNode(AMbody,false,spanclassAM);}}}
205+if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}
206+function generic()
207+{translate();};if(typeof window.addEventListener!='undefined')
377208{window.addEventListener('load',generic,false);}
378209else if(typeof document.addEventListener!='undefined')
379210{document.addEventListener('load',generic,false);}
@@ -384,8 +215,7 @@ else
384215{var existing=onload;window.onload=function()
385216{existing();generic();};}
386217else
387−{window.onload=generic;}}
388−</script>
218+{window.onload=generic;}}</script>
389219<!-- configuration parameters -->
390220<meta name="defaultView" content="slideshow" />
391221<meta name="controlVis" content="hidden" />
tests/s5.native+1−1
@@ -5,5 +5,5 @@ Pandoc (Meta [Str "My",Space,Str "S5",Space,Str "Document"] ["Sam Smith","Jen Jo
55 , [ Plain [Str "second",Space,Str "bullet"] ] ]
66, Header 1 [Str "Math"]
77, BulletList
8− [ [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
8+ [ [ Plain [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
99 ] ]
tests/testsuite.native+7−8
@@ -282,14 +282,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
282282, Header 1 [Str "LaTeX"]
283283, BulletList
284284 [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
285− , [ Plain [TeX "\\doublespacing"] ]
286− , [ Plain [Math "2+2=4"] ]
287− , [ Plain [Math "x \\in y"] ]
288− , [ Plain [Math "\\alpha \\wedge \\omega"] ]
289− , [ Plain [Math "223"] ]
290− , [ Plain [Math "p",Str "-",Str "Tree"] ]
291− , [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
292− , [ 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 "."] ] ]
285+ , [ Plain [Math InlineMath "2+2=4"] ]
286+ , [ Plain [Math InlineMath "x \\in y"] ]
287+ , [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]
288+ , [ Plain [Math InlineMath "223"] ]
289+ , [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]
290+ , [ 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}"] ]
291+ , [ 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 "."] ] ]
293292, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
294293, BulletList
295294 [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
tests/testsuite.txt+2−2
@@ -467,13 +467,13 @@ Ellipses...and. . .and . . . .
467467# LaTeX
468468
469469- \cite[22-23]{smith.1899}
470−- \doublespacing
471470- $2+2=4$
472471- $x \in y$
473472- $\alpha \wedge \omega$
474473- $223$
475474- $p$-Tree
476−- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
475+- Here's some display math:
476+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
477477- Here's one that has a line break in it: $\alpha + \omega \times
478478x^2$.
479479
tests/writer.context+2−3
@@ -629,8 +629,6 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
629629\startitemize
630630\item
631631 \cite[22-23]{smith.1899}
632−\item
633− \doublespacing
634632\item
635633 $2+2=4$
636634\item
@@ -642,7 +640,8 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
642640\item
643641 $p$-Tree
644642\item
645− $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
643+ Here's some display math:
644+ \startformula \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h} \stopformula
646645\item
647646 Here's one that has a line break in it:
648647 $\alpha + \omega \times x^2$.
tests/writer.docbook+1−4
@@ -975,10 +975,6 @@ Blah
975975 <para>
976976 </para>
977977 </listitem>
978− <listitem>
979− <para>
980− </para>
981− </listitem>
982978 <listitem>
983979 <para>
984980 2+2=4
@@ -1006,6 +1002,7 @@ Blah
10061002 </listitem>
10071003 <listitem>
10081004 <para>
1005+ Here's some display math:
10091006 \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>}
10101007 </para>
10111008 </listitem>
tests/writer.html+1−3
@@ -718,8 +718,6 @@ Blah
718718 >LaTeX</h1
719719 ><ul
720720 ><li
721− ></li
722− ><li
723721 ></li
724722 ><li
725723 ><span class="math"
@@ -748,7 +746,7 @@ Blah
748746 ></span
749747 >-Tree</li
750748 ><li
751− ><span class="math"
749+ >Here&rsquo;s some display math: <span class="math"
752750 >\frac{<em
753751 >d</em
754752 >}{<em
tests/writer.latex+2−3
@@ -564,8 +564,6 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
564564\begin{itemize}
565565\item
566566 \cite[22-23]{smith.1899}
567−\item
568− \doublespacing
569567\item
570568 $2+2=4$
571569\item
@@ -577,7 +575,8 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
577575\item
578576 $p$-Tree
579577\item
580− $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
578+ Here's some display math:
579+ \[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]
581580\item
582581 Here's one that has a line break in it:
583582 $\alpha + \omega \times x^2$.
tests/writer.man+3−1
@@ -547,7 +547,6 @@ Ellipses\&...and\&...and\&...\.
547547.SH LaTeX
548548.IP \[bu] 2
549549.IP \[bu] 2
550−.IP \[bu] 2
551550\f[B]2+2=4\f[]
552551.IP \[bu] 2
553552\f[B]x\ \\in\ y\f[]
@@ -558,7 +557,10 @@ Ellipses\&...and\&...and\&...\.
558557.IP \[bu] 2
559558\f[B]p\f[]-Tree
560559.IP \[bu] 2
560+Here's some display math:
561+.RS
561562\f[B]\\frac{d}{dx}f(x)=\\lim_{h\\to\ 0}\\frac{f(x+h)-f(x)}{h}\f[]
563+.RE
562564.IP \[bu] 2
563565Here's one that has a line break in it:
564566\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]\.
tests/writer.markdown+2−2
@@ -492,13 +492,13 @@ Ellipses...and...and....
492492# LaTeX
493493
494494- \cite[22-23]{smith.1899}
495−- \doublespacing
496495- $2+2=4$
497496- $x \in y$
498497- $\alpha \wedge \omega$
499498- $223$
500499- $p$-Tree
501−- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
500+- Here's some display math:
501+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
502502- Here's one that has a line break in it:
503503 $\alpha + \omega \times x^2$.
504504
tests/writer.mediawiki+1−2
@@ -422,14 +422,13 @@ Ellipses&hellip;and&hellip;and&hellip;.
422422
423423== LaTeX ==
424424
425−*
426425*
427426* <math>2+2=4</math>
428427* <math>x \in y</math>
429428* <math>\alpha \wedge \omega</math>
430429* <math>223</math>
431430* <math>p</math>-Tree
432−* <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
431+* Here&rsquo;s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
433432* Here&rsquo;s one that has a line break in it: <math>\alpha + \omega \times x^2</math>.
434433These shouldn&rsquo;t be math:
435434
tests/writer.native+7−8
@@ -282,14 +282,13 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane
282282, Header 1 [Str "LaTeX"]
283283, BulletList
284284 [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
285− , [ Plain [TeX "\\doublespacing"] ]
286− , [ Plain [Math "2+2=4"] ]
287− , [ Plain [Math "x \\in y"] ]
288− , [ Plain [Math "\\alpha \\wedge \\omega"] ]
289− , [ Plain [Math "223"] ]
290− , [ Plain [Math "p",Str "-",Str "Tree"] ]
291− , [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]
292− , [ 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 "."] ] ]
285+ , [ Plain [Math InlineMath "2+2=4"] ]
286+ , [ Plain [Math InlineMath "x \\in y"] ]
287+ , [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]
288+ , [ Plain [Math InlineMath "223"] ]
289+ , [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]
290+ , [ 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}"] ]
291+ , [ 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 "."] ] ]
293292, Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"]
294293, BulletList
295294 [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
tests/writer.opendocument+1−4
@@ -1366,9 +1366,6 @@
13661366 <text:list-item>
13671367 <text:p text:style-name="P50"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>
13681368 </text:list-item>
1369− <text:list-item>
1370− <text:p text:style-name="P50"><text:span text:style-name="Teletype">\doublespacing</text:span></text:p>
1371− </text:list-item>
13721369 <text:list-item>
13731370 <text:p text:style-name="P50">2+2=4</text:p>
13741371 </text:list-item>
@@ -1385,7 +1382,7 @@
13851382 <text:p text:style-name="P50"><text:span text:style-name="T60">p</text:span>-Tree</text:p>
13861383 </text:list-item>
13871384 <text:list-item>
1388− <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>
1385+ <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>
13891386 </text:list-item>
13901387 <text:list-item>
13911388 <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>
tests/writer.rst+2−2
@@ -621,14 +621,14 @@ LaTeX
621621=====
622622
623623
624−-
625624-
626625- :math:`$2+2=4$`
627626- :math:`$x \in y$`
628627- :math:`$\alpha \wedge \omega$`
629628- :math:`$223$`
630629- :math:`$p$`-Tree
631−- :math:`$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$`
630+- Here's some display math:
631+ :math:`$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$`
632632- Here's one that has a line break in it:
633633 :math:`$\alpha + \omega \times x^2$`.
634634
tests/writer.rtf+1−2
@@ -241,13 +241,12 @@ quoted link
241241{\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}
242242{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par}
243243{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
244−{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}
245244{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par}
246245{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par}
247246{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par}
248247{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}
249248{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}
250−{\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}
249+{\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}
251250{\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}
252251{\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}
253252{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}
tests/writer.texinfo+1−5
@@ -709,10 +709,6 @@ Ellipses@dots{}and@dots{}and@dots{}.
709709\cite[22-23]{smith.1899}
710710@end tex
711711@item
712−@tex
713−\doublespacing
714−@end tex
715−@item
716712@math{2+2=4}
717713@item
718714@math{x \in y}
@@ -723,7 +719,7 @@ Ellipses@dots{}and@dots{}and@dots{}.
723719@item
724720@math{p}-Tree
725721@item
726−@math{\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}}
722+Here's some display math: @math{\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}}
727723@item
728724Here's one that has a line break in it: @math{\alpha + \omega \times x^2}.
729725@end itemize
web/index.txt.in−1
@@ -155,7 +155,6 @@ kind.
155155
156156[More accurate]: http://code.google.com/p/pandoc/wiki/PandocVsMarkdownPl
157157[much faster]: http://code.google.com/p/pandoc/wiki/Benchmarks
158−[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
159158
160159[John MacFarlane]: http://johnmacfarlane.net/
161160[markdown]: http://daringfireball.net/projects/markdown/