packages feed

pandoc 1.4 → 1.5

raw patch · 95 files changed

+4488/−2741 lines, 95 filesdep +HTTPdep +extensible-exceptionsdep +texmathdep −template-haskellsetup-changedPVP ok

version bump matches the API change (PVP)

Dependencies added: HTTP, extensible-exceptions, texmath, xml

Dependencies removed: template-haskell

API changes (from Hackage documentation)

- Text.Pandoc.LaTeXMathML: latexMathMLScript :: IO String
+ Text.Pandoc: MathML :: (Maybe String) -> HTMLMathMethod
+ Text.Pandoc: writePlain :: WriterOptions -> Pandoc -> String
+ Text.Pandoc.Definition: docAuthors :: Meta -> [[Inline]]
+ Text.Pandoc.Definition: docDate :: Meta -> [Inline]
+ Text.Pandoc.Definition: docTitle :: Meta -> [Inline]
+ Text.Pandoc.Shared: MathML :: (Maybe String) -> HTMLMathMethod
+ Text.Pandoc.Shared: uniqueIdent :: [Inline] -> [String] -> String
+ Text.Pandoc.Writers.Markdown: writePlain :: WriterOptions -> Pandoc -> String
- Text.Pandoc.ODT: saveOpenDocumentAsODT :: FilePath -> FilePath -> Maybe FilePath -> String -> IO ()
+ Text.Pandoc.ODT: saveOpenDocumentAsODT :: Maybe FilePath -> FilePath -> FilePath -> Maybe FilePath -> String -> IO ()
- Text.Pandoc.Readers.HTML: htmlEndTag :: [Char] -> GenParser Char st [Char]
+ Text.Pandoc.Readers.HTML: htmlEndTag :: [Char] -> GenParser Char ParserState [Char]
- Text.Pandoc.Shared: readDataFile :: FilePath -> IO String
+ Text.Pandoc.Shared: readDataFile :: Maybe FilePath -> FilePath -> IO String
- Text.Pandoc.Templates: getDefaultTemplate :: String -> IO (Either IOException String)
+ Text.Pandoc.Templates: getDefaultTemplate :: (Maybe FilePath) -> String -> IO (Either IOException String)
- Text.Pandoc.Writers.S5: s5HeaderIncludes :: IO String
+ Text.Pandoc.Writers.S5: s5HeaderIncludes :: Maybe FilePath -> IO String

Files

INSTALL view
@@ -1,189 +1,113 @@ % Installing pandoc -Installing pandoc from Source-=============================--This method will work on all architectures for which the GHC compiler-is available.--Installing GHC-----------------To compile Pandoc, you'll need [GHC] version 6.8 or greater. If you-don't have GHC already, you can get it from the [GHC Download] page.-If you're compiling GHC from source, be sure to get the `extralibs`-in addition to the base tarball. Pandoc requires Cabal version 1.2 or-greater. If your GHC comes with an older version of Cabal, you'll need-to to [install Cabal] separately. You can check your Cabal version using-`ghc-pkg list`.--If you're running MacOS X, you can also install GHC using [MacPorts] or [Fink].--If you're on a [debian]-based linux system (such as [Ubuntu]), you can get-GHC and some required libraries using `apt-get`:-    -    sudo apt-get install ghc6 libghc6-xhtml-dev libghc6-mtl-dev libghc6-network-dev--[GHC]: http://www.haskell.org/ghc/-[GHC Download]: http://www.haskell.org/ghc/download.html-[Cabal]: http://www.haskell.org/cabal/-[install Cabal]: http://www.haskell.org/cabal/download.html-[MacPorts]: http://macports.org-[Fink]: http://finkproject.org-[Ubuntu]: http://www.ubuntu.com-[debian]: http://www.debian.org/--Installing prerequisites---------------------------Pandoc needs the `utf8-string` and `zip-archive` to compile.-Check your packaging system to see if they are included.-If not, you will need to compile them from source.--On \*nix systems, the easiest way to do this is to install-the [cabal-install] tool.  See the section [Quick Installation-on Unix] for instructions.  If you use [MacPorts], you can-just install the `hs-cabal` port.--[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall-[Quick Installation on Unix]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall#QuickInstallationonUnix--Once you've got `cabal-install` installed, you can install the-needed libraries by doing--    cabal install utf8-string-    cabal install zip-archive--Alternatively, you can install these libraries using the [standard-Cabal method], but you will have to install their dependencies manually.--[standard Cabal method]: http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package--Getting the source---------------------Download the source tarball from [pandoc's google code site].-Extract the contents into a subdirectory:+These instructions explain how to install pandoc from source.+Binary packages or ports of pandoc are available for freebsd+and several linux distributions, so check your package manager.+There is also a Windows installer. -    tar xvzf pandoc-x.y.tar.gz+Quick install+------------- -[pandoc's google code site]: http://pandoc.googlecode.com+1.  Install the [Haskell platform].  This will give you [GHC] and+the [cabal-install] build tool. -Now choose one of the following methods for compiling and installing-pandoc. If you are on a linux or unix-based system, you can [install-pandoc using Make]. If not, you should [install pandoc using Cabal].+2.  Use `cabal` to install pandoc and its dependencies: -[install pandoc using Make]: #installing-pandoc-using-make-[install pandoc using Cabal]: #installing-pandoc-using-cabal-[build options]: #build-options+        cabal install pandoc -Installing Pandoc using Make-----------------------------+    If you want support for source code syntax highlighting, set+    the `highlighting` flag: -1.  Change to the directory containing the Pandoc distribution.+        cabal install -fhighlighting pandoc -2.  Compile:+    This procedure will install the released version of pandoc,+    which will be downloaded automatically from HackageDB.+    If you want to install a modified or development version+    of pandoc instead, switch to the source directory and do+    as above, but without the 'pandoc': -        make+        cabal install -    If you get "Unknown modifier" errors, it is probably because `make`-    on your system is not [GNU `make`].  Try using `gmake` instead.+3.  Make sure the `$CABALDIR/bin` directory is in your path.  You should+now be able to run `pandoc`: -    If you get a message saying that the `zip-archive` or `utf8-string`-    libraries cannot be found, and you have installed these using-    `cabal-install`, it is probably because by default `cabal-install`-    installs libraries to the user's directory rather than globally.-    Try again with+        pandoc --help -        CABALOPTS=--user make+4.  Make sure the `$CABALDIR/share/man/man1` directory is in your `MANPATH`.+You should now be able to access the `pandoc` man page: -3.  See if it worked (optional, but recommended): +        man pandoc -        make test+[GHC]: http://www.haskell.org/ghc/+[Haskell platform]: http://hackage.haskell.org/platform/+[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall -4.  Install:+Custom install+-------------- -        sudo make install+This is a step-by-step procedure that offers maximal control+over the build and installation.  Most users should use the+quick install, but this information may be of use to packagers.+For more details, see the [Cabal User's Guide]. -    Note:  This installs `pandoc`, together with its wrappers and-    documentation, into the `/usr/local` directory.  If you'd rather-    install `pandoc` somewhere else--say, in `/opt/local`--you can-    set the `PREFIX` environment variable:+1.  Install dependencies:  in addition to the [Haskell platform],+you will need [zip-archive] and (if you want syntax highlighting)+[highlighting-kate]. -        PREFIX=/opt/local sudo make install+2.  Configure: -    If you don't have root privileges or would prefer to install-    `pandoc` and the associated wrappers into your `~/bin` directory,-    type this instead:+        runghc Setup.hs configure --prefix=DIR --bindir=DIR --libdir=DIR \+          --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \+          --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \+          --mandir=DIR --flags=FLAGSPEC -        PREFIX=~ make install-exec+    All of the options have sensible defaults that can be overridden+    as needed. -5.  Build and install the Haskell libraries and library-    documentation (optional--for Haskell programmers only):+    `FLAGSPEC` is a list of Cabal configuration flags, optionally+    preceded by a `-` (to force the flag to `false`), and separated+    by spaces.  Pandoc's flags include: -        make build-all-        sudo make install-all+    - `library`:  build the library (default yes)+    - `executable`: build the pandoc executable (default yes)+    - `wrappers`: build the wrappers `markdown2pdf` and `hsmarkdown`+      (default yes)+    - `highlighting`: compile with syntax highlighting support (increases+      the size of the executable) (default no) -    Note that building the library documentation requires [haddock].+    So, for example, -6.  If you decide you don't want pandoc on your system, each of the-    installation steps described above can be reversed:+        --flags="-library highlighting" -        sudo make uninstall+    tells Cabal to build the executable but not the library, and to+    compile with syntax highlighting support. -        PREFIX=~ make uninstall-exec+3.  Build: -        sudo make uninstall-all+        runghc Setup.hs build -[haddock]: http://www.haskell.org/haddock/ +4.  Build API documentation: -Installing pandoc using Cabal------------------------------+        runghc Setup.hs haddock --html-location=URL --hyperlink-source -Change to the directory containing the pandoc source, and type:+5.  Copy the files: -    runhaskell Setup configure   # add --user if you have installed prerequisites-                                 # locally using cabal-install-    runhaskell Setup build-    runhaskell Setup haddock     # optional, to build library documentation-    runhaskell Setup test        # optional, to run test suite-    runhaskell Setup install     # this one as root or sudo, or add --user+        runghc Setup.hs copy --destdir=PATH -This will install the pandoc executable and the Haskell libraries,-but not the shell scripts, man pages, or other documentation.+    The default destdir is `/`. -You may just want the executable, or just the libraries.  This-can be controlled with configuration flags (the `-` negates the-flag):+6.  Register pandoc as a GHC package: -    runhaskell Setup configure -f-library      # just the executable-    runhaskell Setup configure -f-executable   # just the libraries+        runghc Setup.hs register -You can also specify the directory tree into which pandoc will be-installed using the `--prefix=` option to `configure`.  For more details,-see the [Cabal User's Guide].+    Package managers may want to use the `--gen-script` option to+    generate a script that can be run to register the package at+    install time. +[zip-archive]: http://hackage.haskell.org/package/zip-archive+[highlighting-kate]: http://hackage.haskell.org/package/highlighting-kate [Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths -Optional syntax highlighting support---------------------------------------Pandoc can optionally be compiled with support for syntax highlighting of-delimited code blocks.  This feature requires the [`highlighting-kate` library].-If you are using Cabal to compile pandoc, specify the `highlighting` flag in-the configure step:--    runhaskell Setup configure -fhighlighting--If you are using the Makefile:--    CABALOPTS=-fhighlighting make--If you have already built pandoc, you may need to do a `make clean` or-`runhaskell Setup clean` first.--[`highlighting-kate` library]: http://johnmacfarlane.net/highlighting-kate- Optional citeproc support ------------------------- @@ -199,133 +123,7 @@ If you are using Cabal to compile pandoc, specify the `citeproc` flag in the configure step: -    runhaskell Setup configure -fciteproc--If you are using the Makefile:--    CABALOPTS=-fciteproc make--If you have already built pandoc, you may need to do a `make clean` or-`runhaskell Setup clean` first.+    runhaskell Setup configure --flags="citeproc"  [`citeproc-hs` library]: http://code.haskell.org/citeproc-hs/--Other targets----------------The following 'make' targets should not be needed by the average user,-but are documented here for packagers and developers:--### Building and installing--* `configure`:-    - Stores values of relevant environment variables in `vars` for-      persistence.-    - Runs Cabal's "configure" command.-* `build-exec`:  Builds `pandoc` executable (using Cabal's "build"-  command).-* `build-doc`:  Builds program documentation (e.g. `README.html`).-* `build-lib-doc`:  Builds Haddock documentation for Pandoc libraries.-* `install-doc`, `uninstall-doc`:  Installs/uninstalls user documentation-   and man pages.-* `install-lib-doc`, `uninstall-lib-doc`:  Installs/uninstalls library-  documentation and man pages.-* `install-exec`, `uninstall-exec`:  Installs/uninstalls programs-  (`pandoc` and wrappers).--### Testing--* `test`:  Runs Pandoc's test suite.  (All tests should pass.)-* `test-markdown`:  Runs the Markdown regression test suite, using-  `pandoc --strict`.  (One test will fail.)--### Cleaning--* `clean`:  Restores directory to pre-build state, removing generated files.-* `distclean`:  Like clean, but also cleans up files created by `make deb`.--### Packaging--* `tarball`:  Creates a source tarball for distribution.-* `macport`: Creates MacPorts Portfile in `macports` directory.-* `freebsd`: Creates freebsd Makefile and distinfo in `freebsd` directory.-* `win-pkg`:  Creates a Windows binary package (presupposes `pandoc.exe`,-  which must be created by building Pandoc on a Windows machine).-* `website`:  Creates Pandoc's website in `web/pandoc` directory.--Installing pandoc using MacPorts-================================--This is an alternative to compiling from source on MacOS X.-[MacPorts] is a system for building and maintaining \*nix software-on MacOS X computers.  If you don't already have MacPorts, follow-[these instructions for installing -it](http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts).  --Once you've installed MacPorts, you can install pandoc by typing:--    sudo port sync                 # to get the most recent ports-    sudo port install pandoc--Since pandoc depends on GHC, the process may take a long time.--Note that the version of pandoc in MacPorts may not be the most recent.-To get the most recent version, you can use `cabal-install`:--    sudo port install hs-cabal-    cabal install pandoc --user  # optionally: -fciteproc -fhighlighting--This will install the `pandoc` executable into `~/.cabal/bin`.  This method-will not install the wrapper scripts or man pages; if you want those, follow-the instructions above for compiling from source.--Installing the Windows binary-=============================--Simply download the Windows installer [pandoc's google code site]-and run it.  It will install `pandoc.exe` and ensure that it is-in your system PATH.--Note that the Windows binary distribution does not include the shell-scripts `markdown2pdf`, `html2markdown`, or `hsmarkdown`.--Installing pandoc on Debian-===========================--Pandoc is now in the debian archives, and can be installed using `apt-get` (as root):--    apt-get install pandoc               # the program, shell scripts, and docs-    apt-get install libghc6-pandoc-dev   # the libraries-    apt-get install pandoc-doc           # library documentation--Thanks to Recai Oktaş for setting up the debian packages.--Note that the version of pandoc in Debian may not be the most recent.--Installing pandoc on FreeBSD-============================--Pandoc is in the FreeBSD ports repository (`textproc/pandoc`) and can be-installed in the normal way:--    cd /usr/ports/textproc/pandoc-    make install clean   # as root--Alternatively, you can use `pkg_add`:--    pkg_add -r pandoc--Note that the version of pandoc in FreeBSD's official repository may be-somewhat older than the most recent version.--Installing pandoc on Arch linux-===============================--There are two `pandoc` packages in the Arch AUR repositories,-`pandoc` (contributed by Abhishek Dasgupta) and `haskell-pandoc`-(contributed by Dons Stewart).  `haskell-pandoc` is more up-to-date,-but does not install the man pages or wrapper scripts.--    pacman -Sy pandoc-    pacman -Sy haskell-pandoc 
− Makefile
@@ -1,300 +0,0 @@-# Makefile for Pandoc.--#--------------------------------------------------------------------------------# Constant names and commands in source tree-#--------------------------------------------------------------------------------CABAL     := pandoc.cabal-SRCDIR    := src-MANDIR    := man-TESTDIR   := tests-BUILDDIR  := dist-BUILDCONF := $(BUILDDIR)/setup-config-BUILDVARS := vars-CONFIGURE := configure--#--------------------------------------------------------------------------------# Cabal constants-#--------------------------------------------------------------------------------PKG       := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL) | tr A-Z a-z)-VERSION   := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL))-PKGID     := $(PKG)-$(VERSION)-EXECSBASE := pandoc--#--------------------------------------------------------------------------------# Install targets-#--------------------------------------------------------------------------------WRAPPERS  := html2markdown hsmarkdown markdown2pdf-# Add .exe extensions if we're running Windows/Cygwin.-EXTENSION := $(shell uname | tr '[:upper:]' '[:lower:]' | \-               sed -ne 's/^cygwin.*$$/\.exe/p')-BUILDCMD  := $(addsuffix $(EXTENSION), ./setup)-EXECS     := $(addsuffix $(EXTENSION),$(EXECSBASE))-PROGS     := $(EXECS) $(WRAPPERS)-MAIN      := $(firstword $(EXECS))-DOCS      := README.html README BUGS-MANPAGES  := $(patsubst %.md,%,$(wildcard $(MANDIR)/man?/*.?.md))--#--------------------------------------------------------------------------------# Variables to setup through environment-#---------------------------------------------------------------------------------# Specify default values.-prefix    := /usr/local-destdir   :=-# Attempt to set variables from a previous make session.--include $(BUILDVARS)-# Fallback to defaults but allow to get the values from environment.-PREFIX    ?= $(prefix)-DESTDIR   ?= $(destdir)-DATADIR   ?= $(PKGID)-DOCDIR    ?= $(PKGID)/doc--#--------------------------------------------------------------------------------# Installation paths-#--------------------------------------------------------------------------------DESTPATH    := $(DESTDIR)$(PREFIX)-BINPATH     := $(DESTPATH)/bin-DATAPATH    := $(DESTPATH)/share-MANPATH     := $(DATAPATH)/man-PKGDATAPATH := $(DATAPATH)/$(DATADIR)-PKGDOCPATH  := $(DATAPATH)/$(DOCDIR)--#--------------------------------------------------------------------------------# Generic Makefile variables-#--------------------------------------------------------------------------------INSTALL         := install -c-INSTALL_PROGRAM := $(INSTALL) -m 755-INSTALL_DATA    := $(INSTALL) -m 644-STRIP           := strip-GHC             ?= ghc-GHC_VERSION     := $(shell $(GHC) --version | sed -e 's/[^0-9]*//')--#--------------------------------------------------------------------------------# Recipes-#---------------------------------------------------------------------------------# Default target.-.PHONY: all-all: build-program--# Document process rules.-%.html: % $(MAIN)-	./$(MAIN) -s -S --toc $< >$@ || rm -f $@-%.tex: % $(MAIN)-	./$(MAIN) -s -w latex $< >$@ || rm -f $@-%.rtf: % $(MAIN)-	./$(MAIN) -s -w rtf $< >$@ || rm -f $@-%.pdf: % $(MAIN) markdown2pdf-	sh ./markdown2pdf $< || rm -f $@-%.txt: %-	perl -p -e 's/\n/\r\n/' $< > $@ || rm -f $@ # convert to DOS line endings--.PHONY: configure-cleanup_files+=Setup.hi Setup.o $(BUILDCMD) $(BUILDVARS)-ifdef GHC_PKG-  hc_pkg = --with-hc-pkg=$(GHC_PKG)-else-  hc_pkg =-endif-templates=$(wildcard templates/*.* templates/headers/*.* templates/ui/default/*.*)-configure: $(BUILDCONF)-$(BUILDCMD): Setup.hs-	$(GHC) -package Cabal Setup.hs -o $(BUILDCMD)-$(BUILDCONF): $(CABAL) $(CABAL_BACKUP) $(BUILDCMD) $(templates)-	$(BUILDCMD) configure --prefix=$(PREFIX) --with-compiler=$(GHC) $(hc_pkg) $(CABALOPTS) -f-wrappers-	@# Make configuration time settings persistent (definitely a hack).-	@echo "PREFIX?=$(PREFIX)" >$(BUILDVARS)-	@echo "DESTDIR?=$(DESTDIR)" >>$(BUILDVARS)--.PHONY: build-build: configure-	$(BUILDCMD) build--.PHONY: build-exec-build-exec: $(PROGS)-cleanup_files+=$(EXECS)-$(EXECS): build-	for f in $@; do \-		find $(BUILDDIR) -type f -name "$$f" -perm +a=x \-		                 -exec ln -s -f {} . \; ; \-	done--.PHONY: build-doc-cleanup_files+=README.html-build-doc: $(DOCS)--.PHONY: build-program-build-program: build-exec build-doc--.PHONY: build-lib-doc haddock-build-lib-doc: html-haddock: build-lib-doc-cleanup_files+=html-html/: configure-	-rm -rf html-	$(BUILDCMD) haddock && cp -r $(BUILDDIR)/doc/html .--.PHONY: build-all-build-all: build-program build-lib-doc--# User documents installation.-.PHONY: install-doc uninstall-doc-man_all:=$(patsubst $(MANDIR)/%,%,$(MANPAGES))-install-doc: build-doc-	$(INSTALL) -d $(PKGDOCPATH) && $(INSTALL_DATA) $(DOCS) $(PKGDOCPATH)/-	for f in $(man_all); do \-		$(INSTALL) -d $(MANPATH)/$$(dirname $$f); \-		$(INSTALL_DATA) $(MANDIR)/$$f $(MANPATH)/$$f; \-	done-uninstall-doc:-	-for f in $(DOCS); do rm -f $(PKGDOCPATH)/$$f; done-	-for f in $(man_all); do rm -f $(MANPATH)/$$f; done-	rmdir $(PKGDOCPATH) 2>/dev/null ||:--# Program only installation.-.PHONY: install-exec uninstall-exec-install-exec: build-exec-	$(STRIP) $(EXECS)-	$(INSTALL) -d $(BINPATH); \-	for f in $(PROGS); do \-		if [ -L $$f ]; then \-			f=$$(readlink $$f); \-		fi; \-		$(INSTALL_PROGRAM) $$f $(BINPATH)/; \-	done-uninstall-exec:-	-for f in $(notdir $(PROGS)); do rm -f $(BINPATH)/$$f; done--# Program + user documents installation.-.PHONY: install-program uninstall-program-install-program: install-exec install-doc-uninstall-program: uninstall-exec uninstall-doc--.PHONY: install-all uninstall-all-# Full installation through Cabal: main + wrappers + user docs + lib + lib docs-install-all: build-all install-program-	destdir=$(DESTDIR); \-	# Older Cabal versions have no '--destdir' option.-	if $(BUILDCMD) copy --help | grep -q '\-\-destdir'; then \-		opt="--destdir=$${destdir-/}"; \-	else \-		opt="--copy-prefix=$${destdir}$(PREFIX)"; \-	fi; \-	$(BUILDCMD) copy $$opt; $(BUILDCMD) register-# Cabal lacks an 'uninstall' command.  We have to remove some cruft manually.-uninstall-all: uninstall-program configure-	@libdir=$$($(GHC_PKG) field $(PKGID) library-dirs 2>/dev/null | \-		  sed 's/^library-dirs: *//'); \-	htmldir=$$($(GHC_PKG) field $(PKGID) haddock-html 2>/dev/null | \-		  sed 's/^haddock-html: *//'); \-	if [ -d $$libdir ]; then \-		$(BUILDCMD) unregister ||:; \-	else \-		echo >&2 "*** Couldn't locate library for pkgid: $(PKGID). ***"; \-	fi; \-	for d in $$libdir $$htmldir; do \-		[ -d $$d ] && { \-			rm -rf $$d; rmdir $$(dirname $$d) 2>/dev/null ||:; \-		} \-	done; \-	rmdir $(PKGDOCPATH) $(PKGDATAPATH) 2>/dev/null ||:--# Default installation recipe for a common deployment scenario.-.PHONY: install uninstall-install: install-program-uninstall: uninstall-program--# FreeBSD port-.PHONY: freebsd-freebsd_dest:=freebsd-freebsd_makefile:=$(freebsd_dest)/Makefile-freebsd_template:=$(freebsd_makefile).in-cleanup_files+=$(freebsd_makefile)-freebsd : $(freebsd_makefile)-$(freebsd_makefile) : $(freebsd_template)-	sed -e 's/@VERSION@/$(VERSION)/' $< > $@--# MacPort-.PHONY: macport-macport_dest:=macports-portfile:=$(macport_dest)/Portfile-portfile_template:=$(portfile).in-cleanup_files+=$(portfile)-macport : $(portfile)-$(portfile) : $(portfile_template) tarball-	sed -e 's/@VERSION@/$(VERSION)/' $(portfile_template) | \-	sed -e 's/@TARBALLMD5SUM@/$(word 2, $(shell openssl md5 $(tarball)))/' > \-	$(portfile)--.PHONY: win-pkg-win_pkg_name:=$(PKGID).zip-win_docs:=COPYING.txt COPYRIGHT.txt BUGS.txt README.txt README.html-cleanup_files+=$(win_pkg_name) $(win_docs)-win-pkg: $(win_pkg_name)-$(win_pkg_name): $(PKG).exe $(win_docs)-	zip -r $(win_pkg_name) $(PKG).exe $(win_docs)--.PHONY: test test-markdown-test: $(MAIN)-	$(BUILDCMD) test-compat:=$(PWD)/hsmarkdown-markdown_test_dirs:=$(wildcard $(TESTDIR)/MarkdownTest_*)-test-markdown: $(MAIN) $(compat)-	@for suite in $(markdown_test_dirs); do \-		( \-			suite_version=$$(echo $$suite | sed -e 's/.*_//');\-			echo >&2 "-----------------------------------------";\-			echo >&2 "Running Markdown test suite version $${suite_version}.";\-			PATH=$(PWD):$$PATH; export PATH; cd $$suite && \-			perl MarkdownTest.pl -s $(compat) -tidy ; \-		) \-	done--# Stolen and slightly improved from a GPLed Makefile.  Credits to John Meacham.-src_all:=$(shell find $(SRCDIR) -type f -name '*hs' | egrep -v '^\./(_darcs|lib|test)/')-cleanup_files+=$(patsubst %,$(SRCDIR)/%,tags tags.sorted)-tags: $(src_all)-	cd $(SRCDIR) && hasktags -c $(src_all:$(SRCDIR)/%=%); \-	LC_ALL=C sort tags >tags.sorted; mv tags.sorted tags--.PHONY: tarball-tarball:=$(PKGID).tar.gz-cleanup_files+=$(tarball)-tarball: $(tarball)-$(tarball):-	$(BUILDCMD) sdist-	cp $(BUILDDIR)/$(tarball) .--.PHONY: website-web_src:=web-web_dest:=pandoc-website-make_page:=./$(MAIN) -s -S -B $(web_src)/header.html \-                        -A $(web_src)/footer.html \-	                -H $(web_src)/css-cleanup_files+=$(web_dest)-$(web_dest) : html $(wildcard $(web_src)/*) changelog \-    INSTALL $(MANPAGES) $(MANDIR)/man1/pandoc.1.md README-	rm -rf $(web_dest) && { \-		mkdir $(web_dest); \-		cp -r html $(web_dest)/doc; \-		cp $(web_src)/* $(web_dest)/; \-		sed -e 's#@VERSION@#$(VERSION)#g' $(web_src)/index.txt.in > \-			$(web_dest)/index.txt; \-		cp changelog $(web_dest)/changelog.txt ; \-		cp README $(web_dest)/ ; \-		cp INSTALL $(web_dest)/ ; \-		cp $(MANDIR)/man1/pandoc.1.md $(web_dest)/ ; \-		cp $(MANPAGES) $(web_dest)/ ; \-	} || { rm -rf $(web_dest); exit 1; }-website: $(MAIN) $(web_dest)-	PANDOC_PATH=$(shell pwd) make -C $(web_dest)--.PHONY: distclean clean-distclean: clean-	if [ -d debian ]; then \-		chmod +x debian/rules; fakeroot debian/rules clean; \-	fi--clean:-	-if [ -f $(BUILDCONF) ]; then $(BUILDCMD) clean; fi-	-rm -rf $(cleanup_files)
README view
@@ -1,12 +1,12 @@ % Pandoc User's Guide % John MacFarlane-% December 7, 2009+% March 20, 2010  Pandoc is a [Haskell] library for converting from one markup format to another, and a command-line tool that uses this library. It can read [markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX]; and-it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],-[RTF], [DocBook XML], [OpenDocument XML], [ODT], [GNU Texinfo],+it can write plain text, [markdown], [reStructuredText], [HTML], [LaTeX],+[ConTeXt], [RTF], [DocBook XML], [OpenDocument XML], [ODT], [GNU Texinfo], [MediaWiki markup], [groff man] pages, and [S5] HTML slide shows. Pandoc's enhanced version of markdown includes syntax for footnotes, tables, flexible ordered lists, definition lists, delimited code blocks,@@ -37,11 +37,12 @@ [Haskell]:  http://www.haskell.org/ [GNU Texinfo]: http://www.gnu.org/software/texinfo/ -© 2006-9 John MacFarlane (jgm at berkeley dot edu). Released under the+© 2006-2010 John MacFarlane (jgm at berkeley dot edu). Released under the [GPL], version 2 or greater.  This software carries no warranty of any kind.  (See COPYRIGHT for full copyright and warranty notices.)-Contributors:  Recai Oktaş (build system, debian package, wrapper-scripts), Peter Wang (Texinfo writer), Andrea Rossato (OpenDocument writer).+Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,+Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,+rodja.trappe, Bradley Kuhn, thsutton.  [GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License" @@ -62,23 +63,28 @@ `pandoc` will concatenate them all (with blank lines between them) before parsing: -	pandoc -s ch1.txt ch2.txt refs.txt > book.html+    pandoc -s ch1.txt ch2.txt refs.txt > book.html  (The `-s` option here tells `pandoc` to produce a standalone HTML file, with a proper header, rather than a fragment.  For more details on this and many other command-line options, see below.) +Instead of a filename, you can specify an absolute URI. In this+case pandoc will attempt to download the content via HTTP:++    pandoc -f html -t markdown http://www.fsf.org+ The format of the input and output can be specified explicitly using command-line options.  The input format can be specified using the `-r/--read` or `-f/--from` options, the output format using the `-w/--write` or `-t/--to` options.  Thus, to convert `hello.txt` from markdown to LaTeX, you could type: -	pandoc -f markdown -t latex hello.txt+    pandoc -f markdown -t latex hello.txt  To convert `hello.html` from html to markdown: -	pandoc -f html -t markdown hello.html+    pandoc -f html -t markdown hello.html  Supported output formats include `markdown`, `latex`, `context` (ConTeXt), `html`, `rtf` (rich text format), `rst`@@ -91,16 +97,13 @@ Note that the `rst` reader only parses a subset of reStructuredText syntax. For example, it doesn't handle tables, option lists, or footnotes. But for simple documents it should be adequate. The `latex`-and `html` readers are also limited in what they can do. Because the-`html` reader is picky about the HTML it parses, it is recommended that-you pipe HTML through [HTML Tidy] before sending it to `pandoc`, or use-the `html2markdown` script described below.+and `html` readers are also limited in what they can do.  If you don't specify a reader or writer explicitly, `pandoc` will try to determine the input and output format from the extensions of-the input and output filenames.  Thus, for example, +the input and output filenames.  Thus, for example, -	pandoc -o hello.tex hello.txt+    pandoc -o hello.tex hello.txt  will convert `hello.txt` from markdown to LaTeX.  If no output file is specified (so that output goes to stdout), or if the output file's@@ -113,102 +116,61 @@ -------------------  All input is assumed to be in the UTF-8 encoding, and all output-is in UTF-8. If your local character encoding is not UTF-8 and you use+is in UTF-8 (unless your version of pandoc was compiled using+GHC 6.12 or higher, in which case the local encoding will be used).+If your local character encoding is not UTF-8 and you use accented or foreign characters, you should pipe the input and output through [`iconv`]. For example, -	iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html+    iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html  will convert `source.txt` from the local encoding to UTF-8, then convert it to HTML, then convert back to the local encoding, putting the output in `output.html`. -The wrapper scripts (described below) automatically convert the input-from the local encoding to UTF-8 before running them through `pandoc`,-then convert the output back to the local encoding.- Wrappers ======== -Three wrapper scripts, `markdown2pdf`, `html2markdown`, and-`hsmarkdown`, are included in the standard Pandoc installation. (The-Windows binary package does not include `html2markdown`, which is-a POSIX shell script. It does include portable Haskell versions of-`markdown2pdf` and `hsmarkdown`.)--1.  `markdown2pdf` produces a PDF file from markdown-formatted-    text, using `pandoc` and `pdflatex`.  The default-    behavior of `markdown2pdf` is to create a file with the same-    base name as the first argument and the extension `pdf`; thus,-    for example,--           markdown2pdf sample.txt endnotes.txt--    will produce `sample.pdf`.  (If `sample.pdf` exists already,-    it will be backed up before being overwritten.)  An output file-    name can be specified explicitly using the `-o` option:--           markdown2pdf -o book.pdf chap1 chap2--    If no input file is specified, input will be taken from stdin.-    All of `pandoc`'s options will work with `markdown2pdf` as well.--    `markdown2pdf` assumes that `pdflatex` is in the path.  It also-    assumes that the following LaTeX packages are available:-    `unicode`, `fancyhdr` (if you have verbatim text in footnotes),-    `graphicx` (if you use images), `array` (if you use tables),-    and `ulem` (if you use strikeout text).  If they are not already-    included in your LaTeX distribution, you can get them from-    [CTAN]. A full [TeX Live] or [MacTeX] distribution will have all of-    these packages.--2.  `html2markdown` grabs a web page from a file or URL and converts-    it to markdown-formatted text, using `tidy` and `pandoc`.--    All of `pandoc`'s options will work with `html2markdown` as well.-    In addition, the following special options may be used.-    The special options must be separated from the `html2markdown`-    command and any regular Pandoc options by the delimiter `--`:+`markdown2pdf`+-------------- -        html2markdown -o out.txt -- -e latin1 -g curl google.com +The standard Pandoc installation includes `markdown2pdf`, a wrapper+around `pandoc` and `pdflatex` that produces PDFs directly from markdown+sources. The default behavior of `markdown2pdf` is to create a file with+the same base name as the first argument and the extension `pdf`; thus,+for example, -    The `-e` or `--encoding` option specifies the character encoding-    of the HTML input.  If this option is not specified, and input-    is not from stdin, `html2markdown` will attempt to determine the-    page's character encoding from the "Content-type" meta tag.-    If this is not present, UTF-8 is assumed.+    markdown2pdf sample.txt endnotes.txt -    The `-g` or `--grabber` option specifies the command to be used to-    fetch the contents of a URL:+will produce `sample.pdf`.  (If `sample.pdf` exists already,+it will be backed up before being overwritten.)  An output file+name can be specified explicitly using the `-o` option: -        html2markdown -g 'curl --user foo:bar' www.mysite.com+    markdown2pdf -o book.pdf chap1 chap2 -    If this option is not specified, `html2markdown` searches for an-    available program (`wget`, `curl`, or a text-mode browser) to fetch-    the contents of a URL.+If no input file is specified, input will be taken from stdin.+All of `pandoc`'s options will work with `markdown2pdf` as well. -    `html2markdown` requires [HTML Tidy], which must be in the path.-    It uses [`iconv`] for character encoding conversions; if `iconv`-    is absent, it will still work, but it will treat everything as UTF-8.+`markdown2pdf` assumes that `pdflatex` is in the path.  It also+assumes that the following LaTeX packages are available:+`unicode`, `fancyhdr` (if you have verbatim text in footnotes),+`graphicx` (if you use images), `array` (if you use tables),+and `ulem` (if you use strikeout text).  If they are not already+included in your LaTeX distribution, you can get them from+[CTAN]. A full [TeX Live] or [MacTeX] distribution will have all of+these packages. -3.  `hsmarkdown` is designed to be used as a drop-in replacement for-    `Markdown.pl`.  It forces `pandoc` to convert from markdown to-    HTML, and to use the `--strict` flag for maximal compliance with-    official markdown syntax.  (All of Pandoc's syntax extensions and-    variants, described below, are disabled.)  No other command-line-    options are allowed.  (In fact, options will be interpreted as-    filenames.)+`hsmarkdown`+------------ -    As an alternative to using the `hsmarkdown` script, the-    user may create a symbolic link to `pandoc` called `hsmarkdown`.-    When invoked under the name `hsmarkdown`, `pandoc` will behave-    as if the `--strict` flag had been selected, and no command-line-    options will be recognized.  However, this approach does not work-    under Cygwin, due to problems with its simulation of symbolic-    links.+A user who wants a drop-in replacement for `Markdown.pl` may create+a symbolic link to the `pandoc` executable called `hsmarkdown`. When+invoked under the name `hsmarkdown`, `pandoc` will behave as if the+`--strict` flag had been selected, and no command-line options will be+recognized. However, this approach does not work under Cygwin, due to+problems with its simulation of symbolic links.  [Cygwin]:  http://www.cygwin.com/ -[HTML Tidy]:  http://tidy.sourceforge.net/ [`iconv`]: http://www.gnu.org/software/libiconv/ [CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network" [TeX Live]: http://www.tug.org/texlive/@@ -231,8 +193,8 @@ :   specifies the output format -- the format Pandoc will     be converting *to*. *format* can be `native`, `html`, `s5`,     `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,-    `rst`, and `rtf`. (`+lhs` can be appended to indicate that the-    output should be treated as literate Haskell source. See+    `plain`, `rst`, and `rtf`. (`+lhs` can be appended to indicate that+    the output should be treated as literate Haskell source. See     [Literate Haskell support](#literate-haskell-support), below.)  `-s` or `--standalone`@@ -273,9 +235,8 @@     LaTeX *commands*, even if `-R` is not specified.)  `-C` or `--custom-header` *filename*-:   can be used to specify a custom document header. To see the headers-    used by default, use the `-D` option: for example, `pandoc -D html`-    prints the default HTML header.  Implies `--standalone`.+:   can be used to specify a custom document header. Implies `--standalone`.+    *Note: this option is deprecated. Use of `--template` is preferred.*  `--toc` or `--table-of-contents` :   includes an automatically generated table of contents (or, in the@@ -283,6 +244,9 @@     one) in the output document. This option has no effect with `man`,     `docbook`, or `s5` output formats. +`--base-header-level` *level*+:   specifies the base level for headers (defaults to 1).+ `--template=`*file* :   uses *file* as a custom template for the generated document. Implies     `-s`. See [Templates](#templates) below for a description@@ -316,14 +280,14 @@     `\begin{document}` command in LaTeX). This can be used to include     navigation bars or banners in HTML documents. This option can be     used repeatedly to include multiple files. They will be included in-    the order specified.+    the order specified.  Implies `--standalone`.  `-A` or `--include-after-body` *filename* :   includes the contents of *filename* (verbatim) at the end of     the document body (before the `</body>` tag in HTML, or the     `\end{document}` command in LaTeX). This option can be be used     repeatedly to include multiple files. They will be included in the-    order specified.+    order specified.  Implies `--standalone`.  `--reference-odt` *filename* :   uses the specified file as a style reference in producing an ODT.@@ -331,16 +295,9 @@     of an ODT produced using pandoc.  The contents of the reference ODT     are ignored, but its stylesheets are used in the new ODT. If no     reference ODT is specified on the command line, pandoc will look-    for a file `reference.odt` in--        $HOME/.pandoc--    (on unix) or--        C:\Documents And Settings\USERNAME\Application Data\pandoc--    (on Windows). If this is not found either, sensible defaults will be-    used.+    for a file `reference.odt` in the user data directory (see+    `--data-dir`, below). If it is not found there, sensible defaults+    will be used.  `-D` or `--print-default-template` *format* :   prints the default template for an output *format*. (See `-t`@@ -373,6 +330,11 @@     `--gladtex`, and `--mimetex` for alternative ways of dealing with     math in HTML.) +`--mathml`+:   causes `pandoc` to convert all TeX math to MathML.+    In standalone mode, a small javascript will be inserted that allows+    the MathML to be viewed on some browsers.+ `--jsmath`*=[url]* :   causes `pandoc` to use the [jsMath] script to display     TeX math in HTML or S5. The *url* should point to the jsMath load@@ -433,6 +395,20 @@     `perl,numberLines` or `haskell`. Multiple classes may be separated     by spaces or commas. +`--data-dir`*=directory*+:   specifies the user data directory to search for pandoc data files.+    If this option is not specified, the default user data directory+    will be used:++        $HOME/.pandoc++    in unix and++        C:\Documents And Settings\USERNAME\Application Data\pandoc++    in Windows. A reference ODT, `templates` directory, `s5` directory+    placed in this directory will override pandoc's normal defaults.+ `--dump-args` :   is intended to make it easier to create wrapper scripts that use     Pandoc. It causes Pandoc to dump information about the arguments@@ -443,22 +419,22 @@     include the names of input files and any special options passed     after ` -- ` on the command line. So, for example, -:       pandoc --dump-args -o foo.html -s foo.txt \+        pandoc --dump-args -o foo.html -s foo.txt \           appendix.txt -- -e latin1 -:   will cause the following to be printed to stdout:+    will cause the following to be printed to stdout: -:       foo.html foo.txt appendix.txt -e latin1+        foo.html foo.txt appendix.txt -e latin1  `--ignore-args` :   causes Pandoc to ignore all command-line arguments.     Regular Pandoc options are not ignored.  Thus, for example, -:       pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1+        pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1 -:   is equivalent to+    is equivalent to -:       pandoc -o foo.html -s   +        pandoc -o foo.html -s  `-v` or `--version` :   prints the version number to STDERR.@@ -479,20 +455,13 @@ add header and footer material that is needed for a self-standing document.  To see the default template that is used, just type -    pandoc --print-default-template=FORMAT+    pandoc -D FORMAT  where `FORMAT` is the name of the output format. A custom template can be specified using the `--template` option.  You can also override the system default templates for a given output format `FORMAT`-by putting a file `FORMAT.template` in--    $HOME/.pandoc/templates--(on unix) or--    C:\Documents And Settings\USERNAME\Application Data\pandoc\templates--(on Windows).+by putting a file `templates/FORMAT.template` in the user data+directory (see `--data-dir`, above).  Templates may contain *variables*.  Variable names are sequences of alphanumerics, `-`, and `_`, starting with a letter.  A variable name@@ -515,6 +484,12 @@     values) `toc` :   non-null value if `--toc/--table-of-contents` was specified+`include-before`+:   contents specified by `-B/--include-before-body` (may have+    multiple values)+`include-after`+:   contents specified by `-A/--include-after-body` (may have+    multiple values) `body` :   body of document `title`@@ -532,7 +507,7 @@ Templates may contain conditionals.  The syntax is as follows:      $if(variable)$-    X +    X     $else$     Y     $endif$@@ -558,10 +533,8 @@ =======================================  In parsing markdown, Pandoc departs from and extends [standard markdown]-in a few respects.  (To run Pandoc on the official markdown test suite,-type `make test-markdown`.)  Except where noted, these differences can-be suppressed by specifying the `--strict` command-line option or by-using the `hsmarkdown` wrapper.+in a few respects.  Except where noted, these differences can+be suppressed by specifying the `--strict` command-line option.  [standard markdown]:  http://daringfireball.net/projects/markdown/syntax   "Markdown syntax description"@@ -627,13 +600,13 @@ Pandoc behaves differently from standard markdown on some "edge cases" involving lists.  Consider this source:  -	1.  First-	2.  Second:-		-   Fee-		-   Fie-		-   Foe+    1.  First+    2.  Second:+    	-   Fee+    	-   Fie+    	-   Foe -	3.  Third+    3.  Third  Pandoc transforms this into a "compact list" (with no `<p>` tags around "First", "Second", or "Third"), while markdown puts `<p>` tags around@@ -747,10 +720,10 @@ Pandoc allows implicit reference links with just a single set of brackets.  So, the following links are equivalent: -	1. Here's my [link]-	2. Here's my [link][]+    1. Here's my [link]+    2. Here's my [link][] -	[link]: linky.com+    [link]: linky.com  (Note:  Pandoc works this way even if `--strict` is specified, because `Markdown.pl` 1.0.2b7 allows single-bracket links.)@@ -760,20 +733,20 @@  Pandoc's markdown allows footnotes, using the following syntax: -	Here is a footnote reference,[^1] and another.[^longnote]+    Here is a footnote reference,[^1] and another.[^longnote] -	[^1]: Here is the footnote.+    [^1]: Here is the footnote. -	[^longnote]: Here's one with multiple blocks.+    [^longnote]: Here's one with multiple blocks.          Subsequent paragraphs are indented to show that they      belong to the previous footnote.              { some.code } -	    The whole paragraph can be indented, or just the first+        The whole paragraph can be indented, or just the first         line.  In this way, multi-paragraph footnotes work like-	    multi-paragraph list items.+        multi-paragraph list items.      This paragraph won't be part of the note, because it isn't indented. @@ -942,38 +915,83 @@       </code>     </pre> +Images with captions+--------------------++An image occurring by itself in a paragraph will be rendered as+a figure with a caption.[^5] (In LaTeX, a figure environment will be+used; in HTML, the image will be placed in a `div` with class+`figure`, together with a caption in a `p` with class `caption`.)+The image's alt text will be used as the caption.++    ![This is the caption](/url/of/image.png)++[^5]: This feature is not yet implemented for RTF, OpenDocument, or+    ODT. In those formats, you'll just get an image in a paragraph by+    itself, with no caption.++If you just want a regular inline image, just make sure it is not+the only thing in the paragraph. One way to do this is to insert a+nonbreaking space after the image:++    ![This image won't be a figure](/url/of/image.png)\ + Title blocks ------------  If the file begins with a title block -	% title-	% author(s) (separated by commas)-	% date+    % title+    % author(s) (separated by semicolons)+    % date  it will be parsed as bibliographic information, not regular text.  (It will be used, for example, in the title of standalone LaTeX or HTML output.)  The block may contain just a title, a title and an author,-or all three lines.  Each must begin with a % and fit on one line.-The title may contain standard inline formatting.  If you want to-include an author but no title, or a title and a date but no author,-you need a blank line:+or all three elements. If you want to include an author but no+title, or a title and a date but no author, you need a blank line: -	% My title-	% -	% June 15, 2006+    %+    % Author -Titles will be written only when the `--standalone` (`-s`) option is-chosen.  In HTML output, titles will appear twice: once in the-document head -- this is the title that will appear at the top of the-window in a browser -- and once at the beginning of the document body.-The title in the document head can have an optional prefix attached-(`--title-prefix` or `-T` option).  The title in the body appears as-an H1 element with class "title", so it can be suppressed or-reformatted with CSS. If a title prefix is specified with `-T` and no-title block appears in the document, the title prefix will be used by-itself as the HTML title.+    % My title+    %+    % June 15, 2006 +The title may occupy multiple lines, but continuation lines must+begin with leading space, thus:++    % My title+      on multiple lines++If a document has multiple authors, the authors may be put on+separate lines with leading space, or separated by semicolons, or+both.  So, all of the following are equivalent:++    % Author One+      Author Two++    % Author One; Author Two++    % Author One;+      Author Two++The date must fit on one line.++All three metadata fields may contain standard inline formatting+(italics, links, footnotes, etc.).++Title blocks will always be parsed, but they will affect the output only+when the `--standalone` (`-s`) option is chosen. In HTML output, titles+will appear twice: once in the document head -- this is the title that+will appear at the top of the window in a browser -- and once at the+beginning of the document body. The title in the document head can have+an optional prefix attached (`--title-prefix` or `-T` option). The title+in the body appears as an H1 element with class "title", so it can be+suppressed or reformatted with CSS. If a title prefix is specified with+`-T` and no title block appears in the document, the title prefix will+be used by itself as the HTML title.+ The man page writer extracts a title, man page section number, and other header and footer information from the title line. The title is assumed to be the first word on the title line, which may optionally@@ -1002,21 +1020,21 @@ treats text between HTML tags as markdown. Thus, for example, Pandoc will turn -	<table>-		<tr>-			<td>*one*</td>-			<td>[a link](http://google.com)</td>-		</tr>-	</table>+    <table>+    	<tr>+    		<td>*one*</td>+    		<td>[a link](http://google.com)</td>+    	</tr>+    </table>  into -	<table>-		<tr>-			<td><em>one</em></td>-			<td><a href="http://google.com">a link</a></td>-		</tr>-	</table>+    <table>+    	<tr>+    		<td><em>one</em></td>+    		<td><a href="http://google.com">a link</a></td>+    	</tr>+    </table>  whereas `Markdown.pl` will preserve it as is. @@ -1036,8 +1054,7 @@ derive the identifier from the header text,    - Remove all formatting, links, etc.-  - Remove all punctuation, except underscores, hyphens, periods,-    and tildes.+  - Remove all punctuation, except underscores, hyphens, and periods.   - Replace all spaces and newlines with hyphens.   - Convert all alphabetic characters to lowercase.   - Remove everything up to the first letter (identifiers may@@ -1146,8 +1163,8 @@     procedure is:          pandoc -s --gladtex myfile.txt -o myfile.htex-        gladtex -d myfile-images myfile.htex  # produces myfile.html-                                              # and images in myfile-images+        gladtex -d myfile-images myfile.htex+        # produces myfile.html and images in myfile-images  Inline TeX ----------@@ -1156,16 +1173,16 @@ LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to include BibTeX citations: -	This result was proved in \cite{jones.1967}.+    This result was proved in \cite{jones.1967}.  Note that in LaTeX environments, like -	\begin{tabular}{|l|l|}\hline-	Age & Frequency \\ \hline-	18--25  & 15 \\-	26--35  & 33 \\ -	36--45  & 22 \\ \hline-	\end{tabular}+    \begin{tabular}{|l|l|}\hline+    Age & Frequency \\ \hline+    18--25  & 15 \\+    26--35  & 33 \\ +    36--45  & 22 \\ \hline+    \end{tabular}  the material between the begin and end tags will be interpreted as raw LaTeX, not as markdown.@@ -1173,22 +1190,6 @@ Inline LaTeX is ignored in output formats other than Markdown, LaTeX, and ConTeXt. -Custom headers-==============--When run with the "standalone" option (`-s`), `pandoc` creates a-standalone file, complete with an appropriate header.  To see the-default headers used for html and latex, use the following commands:--	pandoc -D html--	pandoc -D latex --If you want to use a different header, just create a file containing-it and specify it on the command line as follows:--	pandoc --custom-header=MyHeaderFile- Producing S5 with Pandoc ======================== @@ -1200,23 +1201,23 @@  Here's the markdown source for a simple slide show, `eating.txt`: -	% Eating Habits-	% John Doe-	% March 22, 2005+    % Eating Habits+    % John Doe+    % March 22, 2005 -	# In the morning+    # In the morning -	- Eat eggs-	- Drink coffee+    - Eat eggs+    - Drink coffee -	# In the evening+    # In the evening -	- Eat spaghetti-	- Drink wine+    - Eat spaghetti+    - Drink wine  To produce the slide show, simply type -	pandoc -w s5 -s eating.txt > eating.html+    pandoc -w s5 -s eating.txt > eating.html  and open up `eating.html` in a browser. @@ -1227,8 +1228,8 @@ incrementally without the `-i` option and all at once with the `-i` option), put it in a block quote: -	> - Eat spaghetti-	> - Drink wine+    > - Eat spaghetti+    > - Drink wine  In this way incremental and nonincremental lists can be mixed in a single document.@@ -1248,18 +1249,11 @@ option to specify a custom template.  You can change the style of the slides by putting customized CSS files-in--    $HOME/.pandoc/s5/default--(on unix) or--    C:\Documents And Settings\USERNAME\Application Data\pandoc\reference.odt--(on Windows).  The originals may be found in pandoc's system-data directory (generally `$CABALDIR/pandoc-VERSION/s5/default`).-Pandoc will look there for any files it does not find in the user's-pandoc data directory.+in `$DATADIR/s5/default`, where `$DATADIR` is the user data directory+(see `--data-dir`, above). The originals may be found in pandoc's system+data directory (generally `$CABALDIR/pandoc-VERSION/s5/default`). Pandoc+will look there for any files it does not find in the user data+directory.  Literate Haskell support ========================
Setup.hs view
@@ -1,39 +1,64 @@ import Distribution.Simple+import Distribution.Simple.Setup+         (copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..))+import Distribution.PackageDescription+         (PackageDescription(..), Executable(..), BuildInfo(..))+import Distribution.Simple.LocalBuildInfo+         (LocalBuildInfo(..), absoluteInstallDirs)+import Distribution.Verbosity ( Verbosity, silent )+import Distribution.Simple.InstallDirs (mandir, bindir, CopyDest (NoCopyDest))+import Distribution.Simple.Utils (copyFiles) import Control.Exception ( bracket_ ) import Control.Monad ( unless ) import System.Process ( runCommand, runProcess, waitForProcess ) import System.FilePath ( (</>), (<.>) ) import System.Directory-import System.IO ( stderr, openTempFile )+import System.IO ( stderr ) import System.Exit import System.Time import System.IO.Error ( isDoesNotExistError )-import Data.Maybe ( fromJust, isNothing, catMaybes )-import Data.List ( isInfixOf )+import Data.Maybe ( catMaybes )+import Data.List ( (\\) ) +main :: IO () main = do-  defaultMainWithHooks $ simpleUserHooks { runTests  = runTestSuite-                                         , postBuild = makeManPages }+  defaultMainWithHooks $ simpleUserHooks {+      runTests  = runTestSuite+    , postBuild = makeManPages +    , postCopy = \ _ flags pkg lbi -> do+         installManpages pkg lbi (fromFlag $ copyVerbosity flags)+              (fromFlag $ copyDest flags)+         installScripts pkg lbi (fromFlag $ copyVerbosity flags)+              (fromFlag $ copyDest flags)+    , postInst = \ _ flags pkg lbi -> do+         installManpages pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest+         installScripts pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest+    }   exitWith ExitSuccess  -- | Run test suite.-runTestSuite _ _ _ _ = do-  tempPath <- catch getTemporaryDirectory (\_ -> return ".")-  (outputPath, hOut) <- openTempFile tempPath "out"-  runProcess "pandoc" ["--version"] Nothing Nothing Nothing (Just hOut) Nothing >>= waitForProcess-  output <- readFile outputPath-  let highlightingSupport = "with syntax highlighting" `isInfixOf` output-  let testArgs = if highlightingSupport then ["lhs"] else []+runTestSuite :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO a+runTestSuite _ _ pkg _ = do+  let isHighlightingKate (Dependency (PackageName "highlighting-kate") _) = True+      isHighlightingKate _ = False+  let highlightingSupport = any isHighlightingKate $ buildDepends pkg+  let testArgs = ["lhs" | highlightingSupport]   let testCmd  = "runhaskell -i.. RunTests.hs " ++ unwords testArgs   inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith  -- | Build man pages from markdown sources in man/man1/.-makeManPages _ _ _ _ = do-  mapM_ makeManPage ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"]+makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()+makeManPages _ flags _ _ = mapM_ (makeManPage (fromFlag $ buildVerbosity flags)) manpages +manpages :: [FilePath]+manpages = ["pandoc.1", "markdown2pdf.1"]++manDir :: FilePath+manDir = "man" </> "man1"+ -- | Build a man page from markdown source in man/man1.-makeManPage manpage = do-  let manDir = "man" </> "man1"+makeManPage :: Verbosity -> FilePath -> IO ()+makeManPage verbosity manpage = do   let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"   let page = manDir </> manpage   let source = manDir </> manpage <.> "md"@@ -43,9 +68,25 @@                 "--template=templates/man.template", "-o", page, source]                 Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess     case ec of-         ExitSuccess -> putStrLn $ "Created " ++ manDir </> manpage+         ExitSuccess -> unless (verbosity == silent) $+                           putStrLn $ "Created " ++ manDir </> manpage          _           -> do putStrLn $ "Error creating " ++ manDir </> manpage                            exitWith ec++installScripts :: PackageDescription -> LocalBuildInfo+               -> Verbosity -> CopyDest -> IO ()+installScripts pkg lbi verbosity copy =+  copyFiles verbosity (bindir (absoluteInstallDirs pkg lbi copy))+      (zip (repeat ".") (wrappers \\ exes))+    where exes = map exeName $ filter isBuildable $ executables pkg+          isBuildable = buildable . buildInfo+          wrappers = ["markdown2pdf"]++installManpages :: PackageDescription -> LocalBuildInfo+                -> Verbosity -> CopyDest -> IO ()+installManpages pkg lbi verbosity copy =+  copyFiles verbosity (mandir (absoluteInstallDirs pkg lbi copy) </> "man1")+             (zip (repeat manDir) manpages)  -- | Returns a list of 'dependencies' that have been modified after 'file'. modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath]
changelog view
@@ -1,3 +1,235 @@+pandoc (1.5)++  [ John MacFarlane ]++  * Added --mathml option.  When this is selected, pandoc will convert+    TeX math into MathML.+    + Added data/MathMLinHTML.js, which is included when no URL is+      provided for --mathml.  This allows MathML to be displayed (in+      better browsers) as text/html.+    + Removed Text.Pandoc.LaTeXMathML.  The module was no longer+      necessary; it was replaced by two lines in pandoc.hs.+    + Replaced LaTeXMathML.js.commend and LaTeXMathML.js.packed with a+      single combined file, LaTeXMathML.js.++  * Added --data-dir option.+    This specifies a user data directory. If not specified, will default+    to ~/.pandoc on unix or Application Data\pandoc on Windows.+    Files placed in the user data directory will override system default+    data files.++  * Added Maybe datadir parameter to readDataFile, saveOpenDocumentAsODT,+    latexMathMLScript, s5HeaderIncludes, and getDefaultTemplate. If+	  Nothing, no user directory is searched for an override.++  * Added 'plain' output format. This is similar to markdown, but+    removes links, pictures, inline formatting, and most anything that+    looks even vaguely markupish. The function writePlain is exported by+    Text.Pandoc.Writers.Markdown, with which it shares most of its code.++  * Allow multi-line titles and authors in meta block.+    Titles may span multiple lines, provided continuation lines+    begin with a space character.  Separate authors may be put on+    multiple lines, provided each line after the first begins with+    a space character.  Each author must fit on one line. Multiple+    authors on a single line may still be separated by a semicolon.+    Based on a patch by Justin Bogner.++  * When given an absolute URI as parameter, pandoc will try to fetch+    the content via HTTP.  So you can do:+    'pandoc -r html -w markdown http://www.fsf.org'+    Adds dependency on HTTP.++  * Made HTML reader much more forgiving.+    + Incorporated idea (from HXT) that an element can be closed+      by an open tag for another element.+    + Javascript is partially parsed to make sure that a <script>+      section is not closed by a </script> in a comment or string.+    + More lenient non-quoted attribute values.+      Now we accept anything but a space character, quote, or <>.+      This helps in parsing e.g. www.google.com!+    + Bare & signs are now parsed as a string.  This is a common+      HTML mistake.+    + Skip a bare < in malformed HTML.++  * Removed html2markdown and hsmarkdown.+    + html2markdown is no longer needed, since you can now pass URI+      arguments to pandoc and directly convert web pages. (Note,+      however, that pandoc assumes the pages are UTF8. html2markdown+      made an attempt to guess the encoding and convert them.)+    + hsmarkdown is pointless -- a large executable that could be+      replaced by 'pandoc --strict'.++  * In most writers, an image in a paragraph by itself is now rendered+    as a figure, with the alt text as the caption. (Texinfo, HTML, RST,+    MediaWiki, Docbook, LaTeX, ConTeXt, HTML.) Other images are+    rendered inline.++  * Depend on extensible-exceptions.  This allows pandoc to be compiled+    on GHC 6.8.++  * Added --base-header-level option.  For example, --base-header-level=2+    will change level 1 headers to level 2, level 2 to level 3, etc.+    Closes Debian #563416.++  * Incomplete support for RST tables (simple and grid).+    Thanks to Eric Kow. Colspans and rowspans not yet supported.++  * Added accessors (docTitle, docAuthors, docDate) to Meta type.++  * MediaWiki writer:  format links with relative URLs as wikilinks.+    The new rule:  If the link target is an absolute URL, an external+    link is created. Otherwise, a wikilink is created.++  * Text.Pandoc.Shared: Export uniqueIdent, and don't allow tilde in+    identifier.  Note:  This may break links to sections that involve+    tildes.++  * Markdown(+lhs) reader:  handle "inverse bird tracks."+    Inverse bird tracks (<) are used for haskell example code that is not+    part of the literate Haskell program.  Resolves Issue #211.++  * LaTeX reader:+    + Recognize '\ ' (interword space).+    + Recognize nonbreaking space '~'.+    + Ignore \section, \pdfannot, \pdfstringdef.  Ignore alt title in+      section headers.  Don't treat \section as inline LaTeX.+      Resolves Issue #202.+    + LaTeX reader:  allow any special character to be escaped.+      Resolves Issue #221.+    + LaTeX reader: treat \paragraph and \subparagraph as level 4, 5+      headers.  Resolves Issue #207.++  * Use template variables for include-before/after.+    + These options now imply -s; previously they worked also in fragment+      mode.+    + Users can now adjust position of include-before and include-after+      text in the templates.+    + Default position of include-before moved back (as it was before 1.4)+      before table of contents.+    + Resolves Issue #217.++  * Don't print an empty table header: (all writers).+    Resolves Issue #210.++  * HTML, Docbook writer: Use tbody, thead, and cols in tables.++  * HTML writer: Don't include TOC div if table of contents is empty.++  * Markdown writer:  Fixed citations.+    Previously the markdown writer printed raw citation codes, e.g.+    [geach1970], rather than the expanded citations provided by+    citeproc, e.g. (Geach 1970). Now it prints the expanded citations.+    This means that the document produced can be processed as a markdown+    document without citeproc. Thanks to dsanson for reporting, and+    Andrea Rossato for the patch.++  * Improved and simplified title block in context template.+    Previously it caused an error if there was no title.+    This method should also be easier for users to customize.++  * Markdown reader:+    + Treat p., pp., sec., ch., as abbreviations in smart mode.+    + Disallow blank lines in inline code span.+    + Allow footnotes to be indented < 4 spaces.+      This fixes a regression.  A test case has been added.+    + Escape spaces in URLs as %20. Previously they were incorrectly+		  escaped as +, which is appropriate only for the query part of+			a URL. Resolves Issue #220.+    + Require two spaces after capital letter + period for list item.+      Otherwise "E. coli" starts a list. This might change the semantics+      of some existing documents, since previously the two-space+      requirement was only enforced when the second word started+      with a capital letter. But it is consistent with the existing+      documentation and follows the principle of least surprise.+      Resolves Issue #212.++  * LaTeX template: redefine labelwidth when using enumerate package.+    Otherwise the list labels (numbers) often extend past the left+    margin, which looks bad.++  * Mediawiki writer: Don't print a "== Notes ==" header before+    references.  This is too English-centric. Writers can provide their+    own header at the end of the document.++  * Promoted mediawiki headers.  '= head =' is now level 1, '== head =='+    level 2, etc.  This seems to be correct; it's only by convention+    that wikipedia articles have level 2 headers at most.+    Patch due to Eric Kow.++  * RunTests.hs: Set LANG to a UTF-8 locale. Use 'pandoc --data-dir=' so+    data files don't need to have been installed. This removes the need to+    set HOME.++  * HTML reader:+    + Handle spaces before <html>.  Resolves Issue #216.+    + Be forgiving in parsing a bare list within a list.+      The following is not valid xhtml, but the intent is clear:+      <ol>+      <li>one</li>+      <ol><li>sub</li></ol>+      <li>two</li>+      </ol>+      We'll treat the <ol> as if it's in a <li>.  Resolves Issue #215.++  * Updated INSTALL instructions.  cabal method is now promoted.++  * Updated markdown2pdf man page. It no longer says all pandoc options+    are accepted.++  * README/man pages: Removed advice to pipe through tidy before HTML+    reader.  This is obsolete, now that we have a forgiving HTML parser.++  * LaTeX writer: set numbersections template variable, so+    the section numbering options work again.++  * Removed obsolete Makefile.++  * Website: renamed index.txt.in -> index.txt.++  * New batch file to make-windows-installer.+    + Removed old Makefile.windows+    + Added make-windows-installer.bat+    + Modified default installer name in pandoc-setup.iss++  * Removed freebsd and macports directories.+    They are no longer up to date.++  * Setup.hs:+    + Made man page building sensitive to build verbosity.+    + Improved detection of highlighting support in test hook.+    + Install wrapper scripts into cabal bin directory.+    + Also simplified installManpages.+    + Setup.hs: install manpages to mandir.  Code borrowed from darcs.++  * Changed default of writerXeTeX to False.++  * HTML writer: don't include empty UL if --toc but no sections.+    Resolves Issue #199.++  * LaTeX writer:+	  + If book, report, or memoir documentclass, use \chapter{}+      for first-level headers. Otherwise use \section{}.+    + Removed stLink, link template variable. Reason: we now always+      include hyperref in the template.++  * Latex template:+	  + Only show \author if there are some.+    + Always include hyperref package. It is used not just for links but+      for toc, section heading bookmarks, footnotes, etc. Also added+      unicode=true on hyperref options.++  * markdown2pdf: always do at least two runs. hyperref bookmarks+    require this.++  * cabal file: Removed unneeded dependency on template-haskell.++  * Windows installer - fixed bug in data file locations.+    Resolves Issue #197.++  * Deprecated --custom-header in documentation.+    Removed old "Custom Headers" section in README.+ pandoc (1.4)    [ John MacFarlane ]
+ data/LaTeXMathML.js view
@@ -0,0 +1,198 @@+/*+LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/+Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,+(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.+Released under the GNU General Public License version 2 or later.+See the GNU General Public License (at http://www.gnu.org/copyleft/gpl.html)+for more details.+*/+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)+alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")+function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}+function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")+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;}+function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")+if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")+try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}+else return AMnoMathMLNote();}+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+else return-1;}+var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}+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);}+function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}+function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}+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);}+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;}+return h;}else+for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}+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;}+more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}+AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}+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};}+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)+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)+return[null,str,null];}+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);}}+return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")+output="\u2032";else if(symbol.input=="''")+output="\u2033";else if(symbol.input=="'''")+output="\u2033\u2032";else if(symbol.input=="''''")+output="\u2033\u2033";else if(symbol.input=="\\square")+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];}}}+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")+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");}+node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)+return[node,str,symbol.rtag];else+return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)+atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)+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);}+return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")+symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))+node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}+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)+mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")+mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")+mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}+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)+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)+node.setAttribute("columnspacing","0.25em");else+node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}+case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)+i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+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);}+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);}+node.appendChild(result[0]);return[node,result[1],symbol.tag];}}+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])+node.appendChild(space);return[node,result[1],symbol.tag];}else+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")+output="\u0302";else if(symbol.input=="\\widehat")+output="\u005E";else if(symbol.input=="\\bar")+output="\u00AF";else if(symbol.input=="\\grave")+output="\u0300";else if(symbol.input=="\\tilde")+output="\u0303";}+var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")+node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")+node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")+node1.setAttribute("accentunder","true");else+node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")+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++)+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++)+if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst++String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")+result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}+node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")+node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}+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];}+node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}+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];}}+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)+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]);}+node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")+node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")+node=AMcreateMmlNode("mfenced",node);}}+return[node,str,tag];}+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);}+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==".")+symbol.invisible=true;if(symbol!=null)+tag=symbol.rtag;}+if(symbol!=null)+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++)+if(node.childNodes[j].firstChild.nodeValue=="&")+pos[i][pos[i].length]=j;}+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);}+row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}+table.appendChild(AMcreateMmlNode("mtr",row));}+return[table,str];}+if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}+return[newFrag,str,tag];}+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];}+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)+node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}+return node;}+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])));}}+expr=!expr;}+return newFrag;}+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++)+arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)+if(alertIfNoMathML)+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]);}+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++)+i+=AMprocessNodeR(n.childNodes[i],linebreaks);}+return 0;}+function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")+for(var i=0;i<frag.length;i++)+if(frag[i].className=="AM")+AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}+if(st==null||st.indexOf("\$")!=-1)+AMprocessNodeR(n,linebreaks);}+if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}+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)))+{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}+else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))+{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]*$/,"")+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;}+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);}+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);}+DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}+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," ");}+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\\] \\[ ");}+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]+\}/);}+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]+\}/);}+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]+\}/);}+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';}+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}}}+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];}+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*\}/);}+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);}+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}}}+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];}+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);}+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);}+TABtbody.appendChild(TABrow);}+nodeTmp.appendChild(TABtbody);}+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);}+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+"]"));}+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);}+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);}}+if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}+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\\]|");}}+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;}}+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;}+if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}+else{tmpIndex=-1};TagIndex+=tmpIndex;}+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]))+newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}+return TheBody;}+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;}}+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=""}+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);}}+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;}}}+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");}+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);}+if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}+RootNode.appendChild(DIV2LI)}+AllDivs[i].removeChild(AllDivs[i].firstChild);}+AllDivs[i].appendChild(RootNode);}}+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"+refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}+return TheBody;}+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");}+if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}+PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}+AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+AMprocessNode(AMbody,false,spanclassAM);}}}+if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}+function generic()+{translate();};if(typeof window.addEventListener!='undefined')+{window.addEventListener('load',generic,false);}+else if(typeof document.addEventListener!='undefined')+{document.addEventListener('load',generic,false);}+else if(typeof window.attachEvent!='undefined')+{window.attachEvent('onload',generic);}+else+{if(typeof window.onload=='function')+{var existing=onload;window.onload=function()+{existing();generic();};}+else+{window.onload=generic;}}
− data/LaTeXMathML.js.comment
@@ -1,16 +0,0 @@-/*-LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/-Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,-(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU General Public License as published by-the Free Software Foundation; either version 2 of the License, or (at-your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-General Public License (at http://www.gnu.org/copyleft/gpl.html)-for more details.-*/
− data/LaTeXMathML.js.packed
@@ -1,191 +0,0 @@--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)-alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")-function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}-function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")-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;}-function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")-if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")-try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}-else return AMnoMathMLNote();}-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-else return-1;}-var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}-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);}-function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}-function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}-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);}-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;}-return h;}else-for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}-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;}-more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}-AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}-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};}-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)-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)-return[null,str,null];}-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);}}-return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")-output="\u2032";else if(symbol.input=="''")-output="\u2033";else if(symbol.input=="'''")-output="\u2033\u2032";else if(symbol.input=="''''")-output="\u2033\u2033";else if(symbol.input=="\\square")-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];}}}-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")-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");}-node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)-return[node,str,symbol.rtag];else-return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)-atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)-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);}-return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")-symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}-result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))-node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}-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)-mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")-mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")-mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}-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)-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)-node.setAttribute("columnspacing","0.25em");else-node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}-case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)-i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}-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);}-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);}-node.appendChild(result[0]);return[node,result[1],symbol.tag];}}-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])-node.appendChild(space);return[node,result[1],symbol.tag];}else-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")-output="\u0302";else if(symbol.input=="\\widehat")-output="\u005E";else if(symbol.input=="\\bar")-output="\u00AF";else if(symbol.input=="\\grave")-output="\u0300";else if(symbol.input=="\\tilde")-output="\u0303";}-var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")-node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")-node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")-node1.setAttribute("accentunder","true");else-node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")-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++)-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++)-if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+-String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")-result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}-node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")-node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}-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];}-node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}-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];}}-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)-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]);}-node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")-node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")-node=AMcreateMmlNode("mfenced",node);}}-return[node,str,tag];}-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);}-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==".")-symbol.invisible=true;if(symbol!=null)-tag=symbol.rtag;}-if(symbol!=null)-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++)-if(node.childNodes[j].firstChild.nodeValue=="&")-pos[i][pos[i].length]=j;}-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);}-row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}-table.appendChild(AMcreateMmlNode("mtr",row));}-return[table,str];}-if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}-return[newFrag,str,tag];}-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];}-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)-node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}-return node;}-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])));}}-expr=!expr;}-return newFrag;}-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++)-arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)-if(alertIfNoMathML)-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]);}-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++)-i+=AMprocessNodeR(n.childNodes[i],linebreaks);}-return 0;}-function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")-for(var i=0;i<frag.length;i++)-if(frag[i].className=="AM")-AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}-if(st==null||st.indexOf("\$")!=-1)-AMprocessNodeR(n,linebreaks);}-if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}-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)))-{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}-else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))-{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]*$/,"")-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;}-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);}-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);}-DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}-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," ");}-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\\] \\[ ");}-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]+\}/);}-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]+\}/);}-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]+\}/);}-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';}-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}}}-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];}-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*\}/);}-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);}-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}}}-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];}-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);}-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);}-TABtbody.appendChild(TABrow);}-nodeTmp.appendChild(TABtbody);}-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);}-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+"]"));}-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);}-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);}}-if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}-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\\]|");}}-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;}}-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;}-if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}-else{tmpIndex=-1};TagIndex+=tmpIndex;}-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]))-newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}-return TheBody;}-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;}}-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=""}-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);}}-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;}}}-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");}-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);}-if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}-RootNode.appendChild(DIV2LI)}-AllDivs[i].removeChild(AllDivs[i].firstChild);}-AllDivs[i].appendChild(RootNode);}}-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"-refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}-return TheBody;}-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");}-if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}-PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}-AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}-AMprocessNode(AMbody,false,spanclassAM);}}}-if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}-function generic()-{translate();};if(typeof window.addEventListener!='undefined')-{window.addEventListener('load',generic,false);}-else if(typeof document.addEventListener!='undefined')-{document.addEventListener('load',generic,false);}-else if(typeof window.attachEvent!='undefined')-{window.attachEvent('onload',generic);}-else-{if(typeof window.onload=='function')-{var existing=onload;window.onload=function()-{existing();generic();};}-else-{window.onload=generic;}}
+ data/MathMLinHTML.js view
@@ -0,0 +1,70 @@+/* +March 19, 2004 MathHTML (c) Peter Jipsen http://www.chapman.edu/~jipsen+Released under the GNU General Public License version 2 or later.+See the GNU General Public License (at http://www.gnu.org/copyleft/gpl.html)+for more details.+*/++function convertMath(node) {// for Gecko+  if (node.nodeType==1) {+    var newnode = +      document.createElementNS("http://www.w3.org/1998/Math/MathML",+        node.nodeName.toLowerCase());+    for(var i=0; i < node.attributes.length; i++)+      newnode.setAttribute(node.attributes[i].nodeName,+        node.attributes[i].nodeValue);+    for (var i=0; i<node.childNodes.length; i++) {+      var st = node.childNodes[i].nodeValue;+      if (st==null || st.slice(0,1)!=" " && st.slice(0,1)!="\n") +        newnode.appendChild(convertMath(node.childNodes[i]));+    }+    return newnode;+  }+  else return node;+}++function convert() {+  var mmlnode = document.getElementsByTagName("math");+  var st,str,node,newnode;+  for (var i=0; i<mmlnode.length; i++)+    if (document.createElementNS!=null)+      mmlnode[i].parentNode.replaceChild(convertMath(mmlnode[i]),mmlnode[i]);+    else { // convert for IE+      str = "";+      node = mmlnode[i];+      while (node.nodeName!="/MATH") {+        st = node.nodeName.toLowerCase();+        if (st=="#text") str += node.nodeValue;+        else {+          str += (st.slice(0,1)=="/" ? "</m:"+st.slice(1) : "<m:"+st);+          if (st.slice(0,1)!="/") +             for(var j=0; j < node.attributes.length; j++)+               if (node.attributes[j].nodeValue!="italic" &&+                 node.attributes[j].nodeValue!="" &&+                 node.attributes[j].nodeValue!="inherit" &&+                 node.attributes[j].nodeValue!=undefined)+                 str += " "+node.attributes[j].nodeName+"="++                     "\""+node.attributes[j].nodeValue+"\"";+          str += ">";+        }+        node = node.nextSibling;+        node.parentNode.removeChild(node.previousSibling);+      }+      str += "</m:math>";+      newnode = document.createElement("span");+      node.parentNode.replaceChild(newnode,node);+      newnode.innerHTML = str;+    }+}++if (document.createElementNS==null) {+  document.write("<object id=\"mathplayer\"\+  classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");+  document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");+}+if(typeof window.addEventListener != 'undefined'){+  window.addEventListener('load', convert, false);+}+if(typeof window.attachEvent != 'undefined') {+  window.attachEvent('onload', convert);+}
− hsmarkdown
@@ -1,5 +0,0 @@-#!/bin/sh-# hsmarkdown - intended as a drop-in replacement for Markdown.pl.-# Uses pandoc to convert from markdown to HTML, using --strict mode-# for maximum compatibility with official markdown syntax.-exec pandoc --from markdown --to html --strict -- "$@"
− html2markdown
@@ -1,221 +0,0 @@-#!/bin/sh -e-# converts HTML from a URL, file, or stdin to markdown-# uses an available program to fetch URL and tidy to normalize it first--REQUIRED="tidy"-SYNOPSIS="converts HTML from a URL, file, or STDIN to markdown-formatted text."--THIS=${0##*/}--NEWLINE='-'--err ()  { echo "$*"   | fold -s -w ${COLUMNS:-110} >&2; }-errn () { printf "$*" | fold -s -w ${COLUMNS:-110} >&2; }--usage () {-    err "$1 - $2" # short description-    err "See the $1(1) man page for usage."-}--# Portable which(1).-pathfind () {-    oldifs="$IFS"; IFS=':'-    for _p in $PATH; do-        if [ -x "$_p/$*" ] && [ -f "$_p/$*" ]; then-            IFS="$oldifs"-            return 0-        fi-    done-    IFS="$oldifs"-    return 1-}--for p in pandoc $REQUIRED; do-    pathfind $p || {-        err "You need '$p' to use this program!"-        exit 1-    }-done--CONF=$(pandoc --dump-args "$@" 2>&1) || {-    errcode=$?-    echo "$CONF" | sed -e '/^pandoc \[OPTIONS\] \[FILES\]/,$d' >&2-    [ $errcode -eq 2 ] && usage "$THIS" "$SYNOPSIS"-    exit $errcode-}--OUTPUT=$(echo "$CONF" | sed -ne '1p')-ARGS=$(echo "$CONF" | sed -e '1d')---grab_url_with () {-    url="${1:?internal error: grab_url_with: url required}"--    shift-    cmdline="$@"--    prog=-    prog_opts=-    if [ -n "$cmdline" ]; then-	eval "set -- $cmdline"-	prog=$1-	shift-	prog_opts="$@"-    fi--    if [ -z "$prog" ]; then-	# Locate a sensible web grabber (note the order).-	for p in wget lynx w3m curl links w3c; do-		if pathfind $p; then-		    prog=$p-		    break-		fi-	done--	[ -n "$prog" ] || {-            errn "$THIS:  Couldn't find a program to fetch the file from URL "-	    err "(e.g. wget, w3m, lynx, w3c, or curl)."-	    return 1-	}-    else-	pathfind "$prog" || {-	    err "$THIS:  No such web grabber '$prog' found; aborting."-	    return 1-	}-    fi--    # Setup proper base options for known grabbers.-    base_opts=-    case "$prog" in-    wget)  base_opts="-O-" ;;-    lynx)  base_opts="-source" ;;-    w3m)   base_opts="-dump_source" ;;-    curl)  base_opts="" ;;-    links) base_opts="-source" ;;-    w3c)   base_opts="-n -get" ;;-    *)     err "$THIS:  unhandled web grabber '$prog'; hope it succeeds."-    esac--    err "$THIS: invoking '$prog $base_opts $prog_opts $url'..."-    eval "set -- $base_opts $prog_opts"-    $prog "$@" "$url"-}--# Parse command-line arguments-parse_arguments () {-    while [ $# -gt 0 ]; do-        case "$1" in-            --encoding=*)-                wholeopt="$1"-                # extract encoding from after =-                encoding="${wholeopt#*=}" ;;-            -e|--encoding|-encoding)-                shift-                encoding="$1" ;; -            --grabber=*)-                wholeopt="$1"-                # extract encoding from after =-                grabber="\"${wholeopt#*=}\"" ;;-            -g|--grabber|-grabber)-                shift-                grabber="$1" ;; -            *)-                if [ -z "$argument" ]; then-                    argument="$1"-                else-                    err "Warning:  extra argument '$1' will be ignored."-                fi ;;-            esac-        shift-    done-}--argument=-encoding=-grabber=--oldifs="$IFS"-IFS=$NEWLINE-parse_arguments $ARGS-IFS="$oldifs"--inurl=-if [ -n "$argument" ] && ! [ -f "$argument" ]; then-    # Treat given argument as an URL.-    inurl="$argument"-fi--# As a security measure refuse to proceed if mktemp is not available.-pathfind mktemp || { err "Couldn't find 'mktemp'; aborting."; exit 1;  }--# Avoid issues with /tmp directory on Windows/Cygwin -cygwin=-cygwin=$(uname | sed -ne '/^CYGWIN/p')-if [ -n "$cygwin" ]; then-    TMPDIR=.-    export TMPDIR-fi--THIS_TEMPDIR=-THIS_TEMPDIR="$(mktemp -d -t $THIS.XXXXXXXX)" || exit 1-readonly THIS_TEMPDIR--trap 'exitcode=$?-      [ -z "$THIS_TEMPDIR" ] || rm -rf "$THIS_TEMPDIR"-      exit $exitcode' 0 1 2 3 13 15--if [ -n "$inurl" ]; then-    err "Attempting to fetch file from '$inurl'..."--    grabber_out=$THIS_TEMPDIR/grabber.out-    grabber_log=$THIS_TEMPDIR/grabber.log-    if ! grab_url_with "$inurl" "$grabber" 1>$grabber_out 2>$grabber_log; then-        errn "grab_url_with failed"-        if [ -f $grabber_log ]; then-            err " with the following error log."-            err-            cat >&2 $grabber_log-        else-            err .-        fi-        exit 1-    fi--    argument="$grabber_out"-fi--if [ -z "$encoding" ] && [ "x$argument" != "x" ]; then-    # Try to determine character encoding if not specified-    # and input is not STDIN.-    encoding=$(-        head "$argument" |-        LC_ALL=C tr 'A-Z' 'a-z' |-        sed -ne '/<meta .*content-type.*charset=/ {-            s/.*charset=["'\'']*\([-a-zA-Z0-9]*\).*["'\'']*/\1/p-        }'-    )-fi--if [ -n "$encoding" ] && pathfind iconv; then-    alias to_utf8='iconv -f "$encoding" -t utf-8'-else # assume UTF-8-    alias to_utf8='cat'-fi --htmlinput=$THIS_TEMPDIR/htmlinput--if [ -z "$argument" ]; then-    to_utf8 > $htmlinput                # read from STDIN-elif [ -f "$argument" ]; then-    to_utf8 "$argument" > $htmlinput    # read from file-else-    err "File '$argument' not found."-    exit 1-fi--if ! cat $htmlinput | pandoc --ignore-args -r html -w markdown "$@" ; then-     err "Failed to parse HTML.  Trying again with tidy..."-     tidy -q -asxhtml -utf8 $htmlinput | \-        pandoc --ignore-args -r html -w markdown "$@"-fi
− man/man1/hsmarkdown.1.md
@@ -1,42 +0,0 @@-% HSMARKDOWN(1) Pandoc User Manuals-% John MacFarlane-% January 8, 2008--# NAME--hsmarkdown - convert markdown-formatted text to HTML--# SYNOPSIS--hsmarkdown [*input-file*]...--# DESCRIPTION--`hsmarkdown` converts markdown-formatted text to HTML. It is designed-to be usable as a drop-in replacement for John Gruber's `Markdown.pl`.--If no *input-file* is specified, input is read from *stdin*.-Otherwise, the *input-files* are concatenated (with a blank-line between each) and used as input.  Output goes to *stdout* by-default.  For output to a file, use shell redirection:--    hsmarkdown input.txt > output.html--`hsmarkdown` uses the UTF-8 character encoding for both input and output.-If your local character encoding is not UTF-8, you should pipe input-and output through `iconv`:--    iconv -t utf-8 input.txt | hsmarkdown | iconv -f utf-8--`hsmarkdown` is implemented as a wrapper around `pandoc`(1).  It-calls `pandoc` with the options `--from markdown --to html---strict` and disables all other options.  (Command-line options-will be interpreted as filenames, as they are by `Markdown.pl`.)--# SEE ALSO--`pandoc`(1).  The *README*-file distributed with Pandoc contains full documentation.--The Pandoc source code and all documentation may be downloaded from-<http://johnmacfarlane.net/pandoc/>.
− man/man1/html2markdown.1.md
@@ -1,95 +0,0 @@-% HTML2MARKDOWN(1) Pandoc User Manuals-% John MacFarlane and Recai Oktas-% January 8, 2008--# NAME--html2markdown - converts HTML to markdown-formatted text--# SYNOPSIS--html2markdown [*pandoc-options*] [\-- *special-options*] [*input-file* or-*URL*]--# DESCRIPTION--`html2markdown` converts *input-file* or *URL* (or text-from *stdin*) from HTML to markdown-formatted plain text.-If a URL is specified, `html2markdown` uses an available program-(e.g. wget, w3m, lynx or curl) to fetch its contents.  Output is sent-to *stdout* unless an output file is specified using the `-o`-option.--`html2markdown` uses the character encoding specified in the-"Content-type" meta tag.  If this is not present, or if input comes-from *stdin*, UTF-8 is assumed.  A character encoding may be specified-explicitly using the `-e` special option.--# OPTIONS--`html2markdown` is a wrapper for `pandoc`, so all of-`pandoc`'s options may be used.  See `pandoc`(1) for-a complete list.  The following options are most relevant:---s, \--standalone-:   Include title, author, and date information (if present) at the-    top of markdown output.---o *FILE*, \--output=*FILE*-:   Write output to *FILE* instead of *stdout*.--\--strict-:   Use strict markdown syntax, with no extensions or variants.--\--reference-links-:   Use reference-style links, rather than inline links, in writing markdown-    or reStructuredText.---R, \--parse-raw-:   Parse untranslatable HTML codes as raw HTML.--\--no-wrap-:   Disable text wrapping in output.  (Default is to wrap text.)---H *FILE*, \--include-in-header=*FILE*-:   Include contents of *FILE* at the end of the header.  Implies-    `-s`.---B *FILE*, \--include-before-body=*FILE*-:   Include contents of *FILE* at the beginning of the document body.---A *FILE*, \--include-after-body=*FILE*-:   Include contents of *FILE* at the end of the document body.---C *FILE*, \--custom-header=*FILE*-:   Use contents of *FILE*-    as the document header (overriding the default header, which can be-    printed using `pandoc -D markdown`).  Implies `-s`.--# SPECIAL OPTIONS--In addition, the following special options may be used.  The special-options must be separated from the `html2markdown` command and any-regular `pandoc` options by the delimiter \``--`', as in--    html2markdown -o foo.txt -- -g 'curl -u bar:baz' -e latin1  \-    www.foo.com---e *encoding*, \--encoding=*encoding* -:   Assume the character encoding *encoding* in reading HTML.-    (Note: *encoding* will be passed to `iconv`; a list of-    available encodings may be obtained using `iconv -l`.)-    If this option is not specified and input is not from-    *stdin*, `html2markdown` will try to extract the character encoding-    from the "Content-type" meta tag.  If no character encoding is-    specified in this way, or if input is from *stdin*, UTF-8 will be-    assumed.---g *command*, \--grabber=*command*-:   Use *command* to fetch the contents of a URL.  (By default,-    `html2markdown` searches for an available program or text-based-    browser to fetch the contents of a URL.)--# SEE ALSO--`pandoc`(1), `iconv`(1)
man/man1/markdown2pdf.1.md view
@@ -13,14 +13,15 @@ # DESCRIPTION  `markdown2pdf` converts *input-file* (or text from standard -input) from markdown-formatted plain text to PDF, using `pdflatex`.-If no output filename is specified (using the `-o` option),-the name of the output file is derived from the input file; thus, for-example, if the input file is *hello.txt*, the output file will be-*hello.pdf*.  If the input is read from STDIN and no output filename-is specified, the output file will be named *stdin.pdf*.  If multiple-input files are specified, they will be concatenated before conversion,-and the name of the output file will be derived from the first input file.+input) from markdown-formatted plain text to PDF, using `pandoc`+and `pdflatex`. If no output filename is specified (using the `-o`+option), the name of the output file is derived from the input file;+thus, for example, if the input file is *hello.txt*, the output file+will be *hello.pdf*. If the input is read from STDIN and no output+filename is specified, the output file will be named *stdin.pdf*. If+multiple input files are specified, they will be concatenated before+conversion, and the name of the output file will be derived from the+first input file.  Input is assumed to be in the UTF-8 character encoding.  If your local character encoding is not UTF-8, you should pipe input@@ -35,11 +36,6 @@  # OPTIONS -`markdown2pdf` is a wrapper around `pandoc`, so all of-`pandoc`'s options can be used with `markdown2pdf` as well.-See `pandoc`(1) for a complete list.-The following options are most relevant:- -o *FILE*, \--output=*FILE* :   Write output to *FILE*. @@ -55,7 +51,8 @@ \--template=*FILE* :   Use *FILE* as a custom template for the generated document. Implies     `-s`. See the section TEMPLATES in `pandoc`(1) for information about-    template syntax.+    template syntax.  Use `pandoc -D latex` to print the default LaTeX+    template.  -V KEY=VAL, \--variable=*KEY:VAL* :   Set the template variable KEY to the value VAL when rendering the@@ -75,9 +72,8 @@ :   Include (LaTeX) contents of *FILE* at the end of the document body.  -C *FILE*, \--custom-header=*FILE*-:   Use contents of *FILE*-    as the LaTeX document header (overriding the default header, which can be-    printed using `pandoc -D latex`).  Implies `-s`.+:   Use contents of *FILE* as the document header. *Note: This option is+    deprecated. Users should transition to using `--template` instead.*  # SEE ALSO 
man/man1/pandoc.1.md view
@@ -14,9 +14,9 @@  Pandoc converts files from one markup format to another. It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and-it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, Texinfo,-groff man, MediaWiki markup, RTF, OpenDocument XML, ODT, DocBook XML,-and S5 HTML slide shows.+it can write plain text, markdown, reStructuredText, HTML, LaTeX,+ConTeXt, Texinfo, groff man, MediaWiki markup, RTF, OpenDocument XML,+ODT, DocBook XML, and S5 HTML slide shows.  If no *input-file* is specified, input is read from *stdin*. Otherwise, the *input-files* are concatenated (with a blank@@ -26,6 +26,11 @@      pandoc -o output.html input.txt +Instead of a file, an absolute URI may be given.  In this case+pandoc will fetch the content using HTTP:++    pandoc -f html -t markdown http://www.fsf.org+ The input and output formats may be specified using command-line options (see **OPTIONS**, below, for details).  If these formats are not specified explicitly, Pandoc will attempt to determine them@@ -48,16 +53,13 @@ the user documentation.  If standard markdown syntax is desired, the `--strict` option may be used. -Pandoc uses the UTF-8 character encoding for both input and output.-If your local character encoding is not UTF-8, you should pipe input-and output through `iconv`:+Pandoc uses the UTF-8 character encoding for both input and output+(unless compiled with GHC 6.12 or higher, in which case it uses+the local encoding). If your local character encoding is not UTF-8, you+should pipe input and output through `iconv`:      iconv -t utf-8 input.txt | pandoc | iconv -f utf-8 -Pandoc's HTML parser is not very forgiving.  If your input is-HTML, consider running it through `tidy`(1) before passing it-to Pandoc.  Or use `html2markdown`(1), a wrapper around `pandoc`.- # OPTIONS  -f *FORMAT*, -r *FORMAT*, \--from=*FORMAT*, \--read=*FORMAT*@@ -69,7 +71,7 @@  -t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT* :   Specify output format.  *FORMAT* can be `native` (native Haskell),-    `markdown` (markdown or plain text), `rst` (reStructuredText),+    `plain` (plain text), `markdown` (markdown), `rst` (reStructuredText),     `html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man),      `mediawiki` (MediaWiki markup), `texinfo` (GNU Texinfo),     `docbook` (DocBook XML), `opendocument` (OpenDocument XML),@@ -116,6 +118,10 @@     provide a *URL*. If no *URL* is provided, the contents of the     script will be inserted directly into the HTML header. +\--mathml+:   Convert TeX math to MathML.  In standalone mode, a small javascript+    will be inserted that allows the MathML to be viewed on some browsers.+ \--jsmath=*URL* :   Use jsMath to display embedded TeX math in HTML output.     The *URL* should point to the jsMath load script; if provided,@@ -172,6 +178,9 @@     RTF) or an instruction to create one (LaTeX, reStructuredText).     This option has no effect on man, DocBook, or S5 output. +\--base-header-level=*LEVEL*+:   Specify the base level for headers (defaults to 1).+ \--template=*FILE* :   Use *FILE* as a custom template for the generated document. Implies     `-s`. See TEMPLATES below for a description of template syntax. If@@ -193,15 +202,15 @@  -B *FILE*, \--include-before-body=*FILE* :   Include contents of *FILE* at the beginning of the document body.+    Implies `-s`.  -A *FILE*, \--include-after-body=*FILE* :   Include contents of *FILE* at the end of the document body.+    Implies `-s`.  -C *FILE*, \--custom-header=*FILE*-:   Use contents of *FILE* as the document header (overriding the-    default header, which can be printed by using the `-D` option).-    Implies `-s`. Note: This option is deprecated. Users should-    transition to using `--template` instead.+:   Use contents of *FILE* as the document header. *Note: This option is+    deprecated. Users should transition to using `--template` instead.*  \--reference-odt=*filename* :   Use the specified file as a style reference in producing an ODT.@@ -209,9 +218,8 @@     of an ODT produced using pandoc.  The contents of the reference ODT     are ignored, but its stylesheets are used in the new ODT. If no     reference ODT is specified on the command line, pandoc will look-    for `$HOME/.pandoc/reference.odt` (on unix) or-    `C:\Documents And Settings\USERNAME\Application Data\pandoc\reference.odt`-    (on Windows). If this is not found either, sensible defaults will be+    for a file `reference.odt` in the user data directory (see+    `--data-dir`). If this is not found either, sensible defaults will be     used.  -D *FORMAT*, \--print-default-template=*FORMAT*@@ -221,6 +229,20 @@ -T *STRING*, \--title-prefix=*STRING* :   Specify *STRING* as a prefix to the HTML window title. +\--data-dir*=DIRECTORY*+:   Specify the user data directory to search for pandoc data files.+    If this option is not specified, the default user data directory+    will be used:++        $HOME/.pandoc++    in unix and++        C:\Documents And Settings\USERNAME\Application Data\pandoc++    in Windows. A reference ODT, `templates` directory, `s5` directory+    placed in this directory will override pandoc's normal defaults.+ \--dump-args :   Print information about command-line arguments to *stdout*, then exit.     The first line of output contains the name of the output file specified@@ -258,10 +280,8 @@ where `FORMAT` is the name of the output format. A custom template can be specified using the `--template` option.  You can also override the system default templates for a given output format `FORMAT`-by putting a file `FORMAT.template` in `$HOME/.pandoc/templates`-(on unix) or-`C:\Documents And Settings\USERNAME\Application Data\pandoc\templates`-(on Windows).+by putting a file `templates/FORMAT.template` in the user data+directory (see `--data-dir`, below).  Templates may contain *variables*.  Variable names are sequences of alphanumerics, `-`, and `_`, starting with a letter.  A variable name@@ -284,6 +304,12 @@     values) `toc` :   non-null value if `--toc/--table-of-contents` was specified+`include-before`+:   contents specified by `-B/--include-before-body` (may have+    multiple values)+`include-after`+:   contents specified by `-A/--include-after-body` (may have+    multiple values) `body` :   body of document `title`
markdown2pdf view
@@ -123,8 +123,10 @@             fi           fi         fi-      else+      elif [ $runs -gt 1 ]; then   # always run at least twice for pdf bookmarks         finished=yes+      else+        runs=$(($runs + 1))       fi     done ) || exit $?
pandoc.cabal view
@@ -1,5 +1,5 @@ Name:            pandoc-Version:         1.4+Version:         1.5 Cabal-Version:   >= 1.2 Build-Type:      Custom License:         GPL@@ -34,19 +34,19 @@                  which convert this native representation into a target                  format. Thus, adding an input or output format requires                  only adding a reader or writer.-Data-Files:      +Data-Files:                  -- templates                  templates/html.template, templates/docbook.template,                  templates/opendocument.template, templates/latex.template,                  templates/context.template, templates/texinfo.template,                  templates/man.template, templates/markdown.template,-                 templates/rst.template,+                 templates/rst.template, templates/plain.template,                  templates/mediawiki.template, templates/rtf.template,                  -- data for ODT writer                  reference.odt,                  -- data for LaTeXMathML writer-                 data/LaTeXMathML.js.comment,-                 data/LaTeXMathML.js.packed,+                 data/LaTeXMathML.js,+                 data/MathMLinHTML.js,                  -- data for S5 writer                  s5/default/slides.js.comment,                  s5/default/slides.js.packed,@@ -59,16 +59,12 @@                  -- documentation                  README, INSTALL, COPYRIGHT, BUGS, changelog,                  -- wrappers-                 markdown2pdf, html2markdown, hsmarkdown+                 markdown2pdf Extra-Source-Files:                  -- sources for man pages                  man/man1/pandoc.1.md, man/man1/markdown2pdf.1.md,-                 man/man1/html2markdown.1.md, man/man1/hsmarkdown.1.md,-                 -- Makefile-                 Makefile,                  -- tests                  tests/bodybg.gif,-                 tests/writer.latex,                  tests/html-reader.html,                  tests/html-reader.native,                  tests/insert,@@ -90,6 +86,7 @@                  tests/tables.html,                  tests/tables.latex,                  tests/tables.man,+                 tests/tables.plain,                  tests/tables.markdown,                  tests/tables.mediawiki,                  tests/tables.native,@@ -98,13 +95,16 @@                  tests/tables.rst,                  tests/tables.rtf,                  tests/tables.txt,+                 tests/tables-rstsubset.native,                  tests/testsuite.native,                  tests/testsuite.txt,+                 tests/writer.latex,                  tests/writer.context,                  tests/writer.docbook,                  tests/writer.html,                  tests/writer.man,                  tests/writer.markdown,+                 tests/writer.plain,                  tests/writer.mediawiki,                  tests/writer.native,                  tests/writer.opendocument,@@ -122,8 +122,7 @@                  tests/lhs-test.html+lhs,                  tests/lhs-test.fragment.html+lhs,                  tests/RunTests.hs-Extra-Tmp-Files: man/man1/pandoc.1, man/man1/hsmarkdown.1,-                 man/man1/html2markdown.1, man/man1/markdown2pdf.1+Extra-Tmp-Files: man/man1/pandoc.1, man/man1/markdown2pdf.1  Flag highlighting   Description:   Compile in support for syntax highlighting of code blocks.@@ -132,7 +131,7 @@   Description:   Build the pandoc executable.   Default:       True Flag wrappers-  Description:   Build the wrappers (hsmarkdown, markdown2pdf).+  Description:   Build the wrappers (markdown2pdf).   Default:       True Flag library   Description:   Build the pandoc library.@@ -145,9 +144,11 @@   Build-Depends: pretty >= 1, containers >= 0.1,                  parsec >= 2.1 && < 3, xhtml >= 3000.0,                  mtl >= 1.1, network >= 2, filepath >= 1.1,-                 process >= 1, directory >= 1, template-haskell >= 2.2,+                 process >= 1, directory >= 1,                  bytestring >= 0.9, zip-archive >= 0.1.1.4,-                 utf8-string >= 0.3, old-time >= 1+                 utf8-string >= 0.3, old-time >= 1,+                 HTTP >= 4000.0.5, texmath, xml >= 1.3.5 && < 1.4,+                 extensible-exceptions   if impl(ghc >= 6.10)     Build-depends: base >= 4 && < 5, syb   else@@ -166,7 +167,6 @@                    Text.Pandoc.CharacterReferences,                    Text.Pandoc.Shared,                    Text.Pandoc.ODT,-                   Text.Pandoc.LaTeXMathML,                    Text.Pandoc.Highlighting,                    Text.Pandoc.Readers.HTML,                    Text.Pandoc.Readers.LaTeX,@@ -216,17 +216,6 @@     Build-depends: citeproc-hs >= 0.2     cpp-options:   -D_CITEPROC   if flag(executable)-    Buildable:      True-  else-    Buildable:      False--Executable hsmarkdown-  Hs-Source-Dirs:     src-  Main-Is:            hsmarkdown.hs-  Ghc-Options:        -Wall -threaded-  Ghc-Prof-Options:   -auto-all-  Extensions:         CPP-  if flag(wrappers)     Buildable:      True   else     Buildable:      False
src/Text/Pandoc.hs view
@@ -72,6 +72,7 @@                , HeaderType (..)                -- * Writers: converting /from/ Pandoc format                , writeMarkdown+               , writePlain                , writeRST                , writeLaTeX                , writeConTeXt
src/Text/Pandoc/Definition.hs view
@@ -35,11 +35,10 @@  data Pandoc = Pandoc Meta [Block] deriving (Eq, Read, Show, Typeable, Data) --- | Bibliographic information for the document:  title (list of 'Inline'),--- authors (list of strings), date (string).-data Meta = Meta [Inline]   -- title-                 [[Inline]] -- authors-                 [Inline]   -- date+-- | Bibliographic information for the document:  title, authors, date.+data Meta = Meta { docTitle   :: [Inline]+                 , docAuthors :: [[Inline]]+                 , docDate    :: [Inline] }             deriving (Eq, Show, Read, Typeable, Data)  -- | Alignment of a table column.
− src/Text/Pandoc/LaTeXMathML.hs
@@ -1,13 +0,0 @@--- | Definitions for use of LaTeXMathML in HTML.  --- (See <http://math.etsu.edu/LaTeXMathML/>)-module Text.Pandoc.LaTeXMathML ( latexMathMLScript ) where-import System.FilePath ( (</>) )-import Text.Pandoc.Shared (readDataFile)---- | String containing LaTeXMathML javascript.-latexMathMLScript :: IO String-latexMathMLScript = do- jsCom <- readDataFile $ "data" </> "LaTeXMathML.js.comment"- jsPacked <- readDataFile $ "data" </> "LaTeXMathML.js.packed"- return $ "<script type=\"text/javascript\">\n" ++ jsCom ++ jsPacked ++-          "</script>\n"
src/Text/Pandoc/ODT.hs view
@@ -42,22 +42,25 @@ import Control.Monad (liftM)  -- | Produce an ODT file from OpenDocument XML.-saveOpenDocumentAsODT :: FilePath      -- ^ Pathname of ODT file to be produced.-                      -> FilePath      -- ^ Relative directory of source file.+saveOpenDocumentAsODT :: Maybe FilePath -- ^ Path of user data directory+                      -> FilePath       -- ^ Pathname of ODT file to be produced+                      -> FilePath       -- ^ Relative directory of source file                       -> Maybe FilePath -- ^ Path specified by --reference-odt-                      -> String        -- ^ OpenDocument XML contents.+                      -> String         -- ^ OpenDocument XML contents                       -> IO ()-saveOpenDocumentAsODT destinationODTPath sourceDirRelative mbRefOdt xml = do+saveOpenDocumentAsODT datadir destinationODTPath sourceDirRelative mbRefOdt xml = do   refArchive <- liftM toArchive $        case mbRefOdt of              Just f -> B.readFile f              Nothing -> do-               userDataDir <- getAppUserDataDirectory "pandoc" -               let userRefOdt = userDataDir </> "reference.odt"-               userRefOdtExists <- doesFileExist userRefOdt-               if userRefOdtExists-                  then B.readFile userRefOdt-                  else getDataFileName "reference.odt" >>= B.readFile+               let defaultODT = getDataFileName "reference.odt" >>= B.readFile+               case datadir of+                     Nothing  -> defaultODT+                     Just d   -> do+                        exists <- doesFileExist (d </> "reference.odt")+                        if exists+                           then B.readFile (d </> "reference.odt")+                           else defaultODT   -- handle pictures   let (newContents, pics) =          case runParser pPictures [] "OpenDocument XML contents" xml of
src/Text/Pandoc/Readers/HTML.hs view
@@ -50,6 +50,7 @@ import Data.List ( isPrefixOf, isSuffixOf, intercalate ) import Data.Char ( toLower, isAlphaNum ) import Network.URI ( parseURIReference, URI (..) )+import Control.Monad ( liftM )  -- | Convert HTML-formatted string to 'Pandoc' document. readHtml :: ParserState   -- ^ Parser state@@ -71,7 +72,7 @@                   "br", "cite", "code", "dfn", "em", "font", "i", "img",                   "input", "kbd", "label", "q", "s", "samp", "select",                   "small", "span", "strike", "strong", "sub", "sup",-                  "textarea", "tt", "u", "var"] ++ eitherBlockOrInline+                  "textarea", "tt", "u", "var"] -}  blockHtmlTags :: [[Char]]@@ -80,7 +81,7 @@                  "h5", "h6", "head", "hr", "html", "isindex", "menu", "noframes",                  "noscript", "ol", "p", "pre", "table", "ul", "dd",                  "dt", "frameset", "li", "tbody", "td", "tfoot",-                 "th", "thead", "tr", "script"] ++ eitherBlockOrInline+                 "th", "thead", "tr", "script", "style"]  sanitaryTags :: [[Char]] sanitaryTags = ["a", "abbr", "acronym", "address", "area", "b", "big",@@ -112,6 +113,40 @@                       "summary", "tabindex", "target", "title", "type",                       "usemap", "valign", "value", "vspace", "width"] +-- taken from HXT and extended++closes :: String -> String -> Bool+"EOF" `closes` _ = True+_ `closes` "body" = False+_ `closes` "html" = False+"a" `closes` "a" = True+"li" `closes` "li" = True+"th" `closes` t | t `elem` ["th","td"] = True+"td" `closes` t | t `elem` ["th","td"] = True+"tr" `closes` t | t `elem` ["th","td","tr"] = True+"dt" `closes` t | t `elem` ["dt","dd"] = True+"dd" `closes` t | t `elem` ["dt","dd"] = True+"hr" `closes` "p" = True+"p" `closes` "p" = True+"meta" `closes` "meta" = True+"colgroup" `closes` "colgroup" = True+"form" `closes` "form" = True+"label" `closes` "label" = True+"map" `closes` "map" = True+"object" `closes` "object" = True+_ `closes` t | t `elem` ["option","style","script","textarea","title"] = True+t `closes` "select" | t /= "option" = True+"thead" `closes` t | t `elem` ["colgroup"] = True+"tfoot" `closes` t | t `elem` ["thead","colgroup"] = True+"tbody" `closes` t | t `elem` ["tbody","tfoot","thead","colgroup"] = True+t `closes` t2 |+   t `elem` ["h1","h2","h3","h4","h5","h6","dl","ol","ul","table","div","p"] &&+   t2 `elem` ["h1","h2","h3","h4","h5","h6","p" ] = True -- not "div"+t1 `closes` t2 |+   t1 `elem` blockHtmlTags &&+   t2 `notElem` (blockHtmlTags ++ eitherBlockOrInline) = True+_ `closes` _ = False+ -- -- HTML utility functions --@@ -176,6 +211,19 @@   map toLower $ takeWhile isAlphaNum $ dropWhile isSpaceOrSlash rest extractTagType _ = "" +-- Parse any HTML tag (opening or self-closing) and return tag type+anyOpener :: GenParser Char ParserState [Char]+anyOpener = try $ do+  char '<'+  spaces+  tag <- many1 alphaNum+  skipMany htmlAttribute+  spaces+  option "" (string "/")+  spaces+  char '>'+  return $ map toLower tag + -- | Parse any HTML tag (opening or self-closing) and return text of tag anyHtmlTag :: GenParser Char ParserState [Char] anyHtmlTag = try $ do@@ -257,32 +305,30 @@   (content, quoteStr) <- choice [ (quoted '\''),                                    (quoted '"'),                                    (do-                                     a <- many (alphaNum <|> (oneOf "-._:"))+                                     a <- many (noneOf " \t\n\r\"'<>")                                      return (a,"")) ]   return (name, content,           (name ++ "=" ++ quoteStr ++ content ++ quoteStr))  -- | Parse an end tag of type 'tag'-htmlEndTag :: [Char] -> GenParser Char st [Char]+htmlEndTag :: [Char] -> GenParser Char ParserState [Char] htmlEndTag tag = try $ do-  char '<'   -  spaces-  char '/'-  spaces-  stringAnyCase tag-  spaces-  char '>'-  return $ "</" ++ tag ++ ">"--{---- | Returns @True@ if the tag is (or can be) an inline tag.-isInline :: String -> Bool-isInline tag = (extractTagType tag) `elem` inlineHtmlTags--}+  closedByNext <- lookAhead $ option False $ liftM (`closes` tag) $+                   anyOpener <|> (eof >> return "EOF")+  if closedByNext+     then return ""+     else do char '<'   +             spaces+             char '/'+             spaces+             stringAnyCase tag+             spaces+             char '>'+             return $ "</" ++ tag ++ ">"  -- | Returns @True@ if the tag is (or can be) a block tag. isBlock :: String -> Bool-isBlock tag = (extractTagType tag) `elem` blockHtmlTags +isBlock tag = (extractTagType tag) `elem` (blockHtmlTags ++ eitherBlockOrInline)  anyHtmlBlockTag :: GenParser Char ParserState [Char] anyHtmlBlockTag = try $ do@@ -298,18 +344,43 @@ -- Scripts must be treated differently, because they can contain '<>' etc. htmlScript :: GenParser Char ParserState [Char] htmlScript = try $ do-  open <- string "<script"-  rest <- manyTill anyChar (htmlEndTag "script")+  lookAhead $ htmlTag "script"+  open <- anyHtmlTag+  rest <- liftM concat $ manyTill scriptChunk (htmlEndTag "script")   st <- getState   if stateSanitizeHTML st && not ("script" `elem` sanitaryTags)      then return "<!-- unsafe HTML removed -->"      else return $ open ++ rest ++ "</script>" +scriptChunk :: GenParser Char ParserState [Char]+scriptChunk = jsComment <|> jsString <|> jsChars+  where jsComment = jsEndlineComment <|> jsMultilineComment+        jsString  = jsSingleQuoteString <|> jsDoubleQuoteString+        jsChars   = many1 (noneOf "<\"'*/") <|> count 1 anyChar+        jsEndlineComment = try $ do+           string "//"+           res <- manyTill anyChar newline+           return ("//" ++ res)+        jsMultilineComment = try $ do+           string "/*"+           res <- manyTill anyChar (try $ string "*/")+           return ("/*" ++ res ++ "*/")+        jsSingleQuoteString = stringwith '\''+        jsDoubleQuoteString = stringwith '"'+        charWithEsc escapable = try $+           (try $ char '\\' >> oneOf ('\\':escapable) >>= \x -> return ['\\',x])+          <|> count 1 anyChar+        stringwith c = try $ do+           char c+           res <- liftM concat $ manyTill (charWithEsc [c]) (char c)+           return (c : (res ++ [c]))+ -- | Parses material between style tags. -- Style tags must be treated differently, because they can contain CSS htmlStyle :: GenParser Char ParserState [Char] htmlStyle = try $ do-  open <- string "<style"+  lookAhead $ htmlTag "style"+  open <- anyHtmlTag   rest <- manyTill anyChar (htmlEndTag "style")   st <- getState   if stateSanitizeHTML st && not ("style" `elem` sanitaryTags)@@ -404,9 +475,18 @@        _            -> fail "not title"   inlinesTilEnd "h1" +endOfDoc :: GenParser Char ParserState ()+endOfDoc = try $ do+  spaces+  optional (htmlEndTag "body")+  spaces+  optional (htmlEndTag "html" >> many anyChar) -- ignore stuff after </html>+  eof + parseHtml :: GenParser Char ParserState Pandoc parseHtml = do   sepEndBy (choice [xmlDec, definition, htmlComment]) spaces+  spaces   skipHtmlTag "html"   spaces   meta <- option (Meta [] [] []) parseHead@@ -415,11 +495,7 @@   spaces   optional bodyTitle  -- skip title in body, because it's represented in meta   blocks <- parseBlocks-  spaces-  optional (htmlEndTag "body")-  spaces-  optional (htmlEndTag "html" >> many anyChar) -- ignore anything after </html>-  eof+  endOfDoc   return $ Pandoc meta blocks  --@@ -438,6 +514,7 @@                , para                , plain                , rawHtmlBlock'+               , notFollowedBy' endOfDoc >> char '<' >> return Null                ] <?> "block"  --@@ -524,7 +601,9 @@                                           _              -> DefaultStyle                               return (read sta, sty')   spaces-  items <- sepEndBy1 (blocksIn "li") spaces+  -- note: if they have an <ol> or <ul> not in scope of a <li>,+  -- treat it as a list item, though it's not valid xhtml...+  items <- sepEndBy1 (blocksIn "li" <|> liftM (:[]) list) spaces   htmlEndTag "ol"   return $ OrderedList (start, style, DefaultDelim) items @@ -532,7 +611,9 @@ bulletList = try $ do   htmlTag "ul"   spaces-  items <- sepEndBy1 (blocksIn "li") spaces+  -- note: if they have an <ol> or <ul> not in scope of a <li>,+  -- treat it as a list item, though it's not valid xhtml...+  items <- sepEndBy1 (blocksIn "li" <|> liftM (:[]) list) spaces   htmlEndTag "ul"   return $ BulletList items @@ -586,6 +667,7 @@                 , link                 , image                 , rawHtmlInline+                , char '&' >> return (Str "&") -- common HTML error                 ] <?> "inline"  code :: GenParser Char ParserState Inline@@ -599,7 +681,7 @@  rawHtmlInline :: GenParser Char ParserState Inline rawHtmlInline = do-  result <- htmlScript <|> htmlStyle <|> htmlComment <|> anyHtmlInlineTag+  result <- anyHtmlInlineTag <|> htmlComment   state <- getState   if stateParseRaw state then return (HtmlInline result) else return (Str "") @@ -640,7 +722,7 @@ linebreak = htmlTag "br" >> optional newline >> return LineBreak  str :: GenParser Char st Inline-str = many1 (noneOf "<& \t\n") >>= return . Str+str = many1 (noneOf "< \t\n&") >>= return . Str  -- -- links and images
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -39,6 +39,7 @@ import Data.Maybe ( fromMaybe ) import Data.Char ( chr ) import Data.List ( isPrefixOf, isSuffixOf )+import Control.Monad ( when )  -- | Parse LaTeX from string and return 'Pandoc' document. readLaTeX :: ParserState   -- ^ Parser state, including options for parser@@ -169,12 +170,13 @@ header = try $ do   char '\\'   subs <- many (try (string "sub"))-  string "section"+  base <- try (string "section" >> return 1) <|> (string "paragraph" >> return 4)   optional (char '*')+  optional $ bracketedText '[' ']' -- alt title   char '{'   title' <- manyTill inline (char '}')   spaces-  return $ Header (length subs + 1) (normalizeSpaces title')+  return $ Header (length subs + base) (normalizeSpaces title')  -- -- hrule block@@ -399,22 +401,23 @@   notFollowedBy' $ choice $ map end ["itemize", "enumerate", "description",                                      "document"]   state <- getState-  if stateParserContext state == ListItemState-     then notFollowedBy' $ string "\\item"-     else return ()+  when (stateParserContext state == ListItemState) $+     notFollowedBy' (string "\\item")   if stateParseRaw state      then do         (name, star, args) <- command         spaces         return $ Plain [TeX ("\\" ++ name ++ star ++ concat args)]-     else do -- skip unknown command, leaving arguments to be parsed-        char '\\'-        letter-        many (letter <|> digit)-        optional (try $ string "{}")+     else do+        (name, _, args) <- command         spaces-        return Null+        if name `elem` commandsToIgnore+           then return Null+           else return $ Plain [Str $ concat args] +commandsToIgnore :: [String]+commandsToIgnore = ["special","pdfannot","pdfstringdef"]+ -- latex comment comment :: GenParser Char st Block comment = try $ char '%' >> manyTill anyChar newline >> spaces >> return Null@@ -429,7 +432,6 @@                  , whitespace                  , quoted                  , apostrophe-                 , spacer                  , strong                  , math                  , ellipses@@ -449,6 +451,7 @@                  , footnote                  , linebreak                  , accentedChar+                 , nonbreakingSpace                  , specialChar                  , rawLaTeXInline                  , escapedChar@@ -539,7 +542,7 @@  escapedChar :: GenParser Char st Inline escapedChar = do-  result <- escaped (oneOf " $%&_#{}\n")+  result <- escaped (oneOf specialChars)   return $ if result == Str "\n" then Str " " else result  -- nonescaped special characters@@ -547,8 +550,16 @@ unescapedChar = oneOf "`$^&_#{}|<>" >>= return . (\c -> Str [c])  specialChar :: GenParser Char st Inline-specialChar = choice [ backslash, tilde, caret, bar, lt, gt, doubleQuote ]+specialChar = choice [ spacer, interwordSpace,+                       backslash, tilde, caret,+                       bar, lt, gt, doubleQuote ] +spacer :: GenParser Char st Inline+spacer = try (string "\\,") >> return (Str "")++interwordSpace :: GenParser Char st Inline+interwordSpace = try (string "\\ ") >> return (Str "\160")+ backslash :: GenParser Char st Inline backslash = try (string "\\textbackslash") >> optional (try $ string "{}") >> return (Str "\\") @@ -664,15 +675,15 @@          return . Strong  whitespace :: GenParser Char st Inline-whitespace = many1 (oneOf "~ \t") >> return Space+whitespace = many1 (oneOf " \t") >> return Space +nonbreakingSpace :: GenParser Char st Inline+nonbreakingSpace = char '~' >> return (Str "\160")+ -- hard line break linebreak :: GenParser Char st Inline linebreak = try (string "\\\\") >> return LineBreak -spacer :: GenParser Char st Inline-spacer = try (string "\\,") >> return (Str "")- str :: GenParser Char st Inline str = many1 (noneOf specialChars) >>= return . Str @@ -764,15 +775,16 @@ -- | Parse any LaTeX command and return it in a raw TeX inline element. rawLaTeXInline :: GenParser Char ParserState Inline rawLaTeXInline = try $ do-  notFollowedBy' $ oneOfStrings ["\\begin", "\\end", "\\item", "\\ignore"]+  notFollowedBy' $ oneOfStrings ["\\begin", "\\end", "\\item", "\\ignore",+                                 "\\section"]   state <- getState   if stateParseRaw state      then do         (name, star, args) <- command         return $ TeX ("\\" ++ name ++ star ++ concat args)-     else do -- skip unknown command, leaving arguments to be parsed-        char '\\'-        letter-        many (letter <|> digit)-        optional (try $ string "{}")-        return $ Str ""+     else do+        (name, _, args) <- command+        spaces+        if name `elem` commandsToIgnore+           then return $ Str ""+           else return $ Str (concat args)
src/Text/Pandoc/Readers/Markdown.hs view
@@ -33,7 +33,7 @@  import Data.List ( transpose, isPrefixOf, isSuffixOf, sortBy, findIndex, intercalate ) import Data.Ord ( comparing )-import Data.Char ( isAlphaNum, isUpper )+import Data.Char ( isAlphaNum ) import Data.Maybe import Text.Pandoc.Definition import Text.Pandoc.Shared @@ -73,6 +73,10 @@ -- auxiliary functions -- +-- | Replace spaces with %20+uriEscapeSpaces :: String -> String+uriEscapeSpaces = substitute " " "%20"+ indentSpaces :: GenParser Char ParserState [Char] indentSpaces = try $ do   state <- getState@@ -129,15 +133,23 @@ --  titleLine :: GenParser Char ParserState [Inline]-titleLine = try $ char '%' >> skipSpaces >> manyTill inline newline+titleLine = try $ do+  char '%'+  skipSpaces+  res <- many $ (notFollowedBy newline >> inline)+             <|> try (endline >> whitespace)+  newline+  return $ normalizeSpaces res  authorsLine :: GenParser Char ParserState [[Inline]] authorsLine = try $ do    char '%'   skipSpaces-  authors <- sepEndBy (many1 (notFollowedBy (oneOf ";\n") >> inline)) (oneOf ";")+  authors <- sepEndBy (many (notFollowedBy (oneOf ";\n") >> inline))+                       (char ';' <|>+                        try (newline >> notFollowedBy blankline >> spaceChar))   newline-  return $ map normalizeSpaces authors+  return $ filter (not . null) $ map normalizeSpaces authors  dateLine :: GenParser Char ParserState [Inline] dateLine = try $ do@@ -194,7 +206,7 @@   tit <- option "" referenceTitle   blanklines   endPos <- getPosition-  let newkey = (lab, (intercalate "+" $ words $ removeTrailingSpace src,  tit))+  let newkey = (lab, (uriEscapeSpaces $ removeTrailingSpace src,  tit))   st <- getState   let oldkeys = stateKeys st   updateState $ \s -> s { stateKeys = newkey : oldkeys }@@ -210,8 +222,8 @@                                       notFollowedBy (noneOf ")\n")))   return $ decodeCharacterReferences tit -noteMarker :: GenParser Char st [Char]-noteMarker = string "[^" >> manyTill (noneOf " \t\n") (char ']')+noteMarker :: GenParser Char ParserState [Char]+noteMarker = skipNonindentSpaces >> string "[^" >> manyTill (noneOf " \t\n") (char ']')  rawLine :: GenParser Char ParserState [Char] rawLine = do@@ -397,8 +409,10 @@ lhsCodeBlock :: GenParser Char ParserState Block lhsCodeBlock = do   failUnlessLHS-  contents <- lhsCodeBlockBird <|> lhsCodeBlockLaTeX-  return $ CodeBlock ("",["sourceCode","literate","haskell"],[]) contents+  liftM (CodeBlock ("",["sourceCode","literate","haskell"],[]))+          (lhsCodeBlockBird <|> lhsCodeBlockLaTeX)+    <|> liftM (CodeBlock ("",["sourceCode","haskell"],[]))+          lhsCodeBlockInverseBird  lhsCodeBlockLaTeX :: GenParser Char ParserState String lhsCodeBlockLaTeX = try $ do@@ -409,10 +423,16 @@   return $ stripTrailingNewlines contents  lhsCodeBlockBird :: GenParser Char ParserState String-lhsCodeBlockBird = try $ do+lhsCodeBlockBird = lhsCodeBlockBirdWith '>'++lhsCodeBlockInverseBird :: GenParser Char ParserState String+lhsCodeBlockInverseBird = lhsCodeBlockBirdWith '<'++lhsCodeBlockBirdWith :: Char -> GenParser Char ParserState String+lhsCodeBlockBirdWith c = try $ do   pos <- getPosition   when (sourceColumn pos /= 1) $ fail "Not in first column"-  lns <- many1 birdTrackLine+  lns <- many1 $ birdTrackLine c   -- if (as is normal) there is always a space after >, drop it   let lns' = if all (\ln -> null ln || take 1 ln == " ") lns                 then map (drop 1) lns@@ -420,9 +440,9 @@   blanklines   return $ intercalate "\n" lns' -birdTrackLine :: GenParser Char st [Char]-birdTrackLine = do-  char '>'+birdTrackLine :: Char -> GenParser Char st [Char]+birdTrackLine c = do+  char c   manyTill anyChar newline  @@ -479,7 +499,7 @@              -- if it could be an abbreviated first name, insist on more than one space              if delim == Period && (style == UpperAlpha || (style == UpperRoman &&                 num `elem` [1, 5, 10, 50, 100, 500, 1000]))-                then char '\t' <|> (char ' ' >>~ notFollowedBy (satisfy isUpper))+                then char '\t' <|> (try $ char ' ' >> spaceChar)                 else spaceChar              skipSpaces              return (num, style, delim)@@ -945,7 +965,7 @@   starts <- many1 (char '`')   skipSpaces   result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|>-                       (char '\n' >> return " ")) +                       (char '\n' >> notFollowedBy' blankline >> return " "))                       (try (skipSpaces >> count (length starts) (char '`') >>                        notFollowedBy (char '`')))   return $ Code $ removeLeadingTrailingSpace $ concat result@@ -1124,7 +1144,8 @@   let abbrevs = [ "Mr.", "Mrs.", "Ms.", "Capt.", "Dr.", "Prof.",                   "Gen.", "Gov.", "e.g.", "i.e.", "Sgt.", "St.",                   "vol.", "vs.", "Sen.", "Rep.", "Pres.", "Hon.",-                  "Rev.", "Ph.D.", "M.D.", "M.A." ]+                  "Rev.", "Ph.D.", "M.D.", "M.A.", "p.", "pp.",+                  "ch.", "sec." ]       abbrPairs = map (break (=='.')) abbrevs   in  map snd $ filter (\(y,_) -> y == x) abbrPairs @@ -1173,7 +1194,7 @@   tit <- option "" linkTitle   skipSpaces   eof-  return (intercalate "+" $ words $ removeTrailingSpace src, tit)+  return (uriEscapeSpaces $ removeTrailingSpace src, tit)  linkTitle :: GenParser Char st String linkTitle = try $ do 
src/Text/Pandoc/Readers/RST.hs view
@@ -33,8 +33,8 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared  import Text.ParserCombinators.Parsec-import Control.Monad ( when, unless )-import Data.List ( findIndex, delete, intercalate )+import Control.Monad ( when, unless, liftM )+import Data.List ( findIndex, delete, intercalate, transpose )  -- | Parse reStructuredText string and return Pandoc document. readRST :: ParserState -- ^ Parser state, including options for parser@@ -127,6 +127,7 @@                , header                , hrule                , lineBlock     -- must go before definitionList+               , table                , list                , lhsCodeBlock                , para@@ -580,6 +581,211 @@   src <- targetURI   return (normalizeSpaces ref, (removeLeadingTrailingSpace src, "")) +--+-- tables+--++-- General tables TODO:+--  - figure out if leading spaces are acceptable and if so, add+--    support for them+--+-- Simple tables TODO:+--  - column spans+--  - multiline support+--  - ensure that rightmost column span does not need to reach end +--  - require at least 2 columns+--+-- Grid tables TODO:+--  - column spans++dashedLine :: Char -> GenParser Char st (Int, Int)+dashedLine ch = do+  dashes <- many1 (char ch)+  sp     <- many (char ' ')+  return (length dashes, length $ dashes ++ sp)++simpleDashedLines :: Char -> GenParser Char st [(Int,Int)]+simpleDashedLines ch = try $ many1 (dashedLine ch)++gridPart :: Char -> GenParser Char st (Int, Int)+gridPart ch = do+  dashes <- many1 (char ch)+  char '+'+  return (length dashes, length dashes + 1)++gridDashedLines :: Char -> GenParser Char st [(Int,Int)]+gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) >>~ blankline++-- Parse a table row separator+simpleTableSep :: Char -> GenParser Char ParserState Char+simpleTableSep ch = try $ simpleDashedLines ch >> newline++gridTableSep :: Char -> GenParser Char ParserState Char+gridTableSep ch = try $ gridDashedLines ch >> return '\n'++-- Parse a table footer+simpleTableFooter :: GenParser Char ParserState [Char]+simpleTableFooter = try $ simpleTableSep '=' >> blanklines++gridTableFooter :: GenParser Char ParserState [Char]+gridTableFooter = blanklines++-- Parse a raw line and split it into chunks by indices.+simpleTableRawLine :: [Int] -> GenParser Char ParserState [String]+simpleTableRawLine indices = do+  line <- many1Till anyChar newline+  return (simpleTableSplitLine indices line)++gridTableRawLine :: [Int] -> GenParser Char ParserState [String]+gridTableRawLine indices = do+  char '|'+  line <- many1Till anyChar newline+  return (gridTableSplitLine indices $ removeTrailingSpace line)++-- Parse a table row and return a list of blocks (columns).+simpleTableRow :: [Int] -> GenParser Char ParserState [[Block]]+simpleTableRow indices = do+  notFollowedBy' simpleTableFooter+  firstLine <- simpleTableRawLine indices+  colLines  <- return [] -- TODO+  let cols = map unlines . transpose $ firstLine : colLines+  mapM (parseFromString (many plain)) cols++gridTableRow :: [Int]+             -> GenParser Char ParserState [[Block]]+gridTableRow indices = do+  colLines <- many1 (gridTableRawLine indices)+  let cols = map ((++ "\n") . unlines . removeOneLeadingSpace) $+               transpose colLines+  mapM (liftM compactifyCell . parseFromString (many block)) cols++compactifyCell :: [Block] -> [Block]+compactifyCell bs = head $ compactify [bs]++simpleTableSplitLine :: [Int] -> String -> [String]+simpleTableSplitLine indices line =+  map removeLeadingTrailingSpace+  $ tail $ splitByIndices (init indices) line++gridTableSplitLine :: [Int] -> String -> [String]+gridTableSplitLine indices line =+  map removeFinalBar $ tail $ splitByIndices (init indices) line++removeFinalBar :: String -> String+removeFinalBar = reverse . dropWhile (=='|') .  dropWhile (`elem` " \t") .+                 reverse++removeOneLeadingSpace :: [String] -> [String]+removeOneLeadingSpace xs =+  if all startsWithSpace xs+     then map (drop 1) xs+     else xs+   where startsWithSpace ""     = True+         startsWithSpace (y:_) = y == ' '++-- Calculate relative widths of table columns, based on indices+widthsFromIndices :: Int      -- Number of columns on terminal+                  -> [Int]    -- Indices+                  -> [Double] -- Fractional relative sizes of columns+widthsFromIndices _ [] = []+widthsFromIndices numColumns indices =+  let lengths' = zipWith (-) indices (0:indices)+      lengths  = reverse $+                 case reverse lengths' of+                      []       -> []+                      [x]      -> [x]+                      -- compensate for the fact that intercolumn+                      -- spaces are counted in widths of all columns+                      -- but the last...+                      (x:y:zs) -> if x < y && y - x <= 2+                                     then y:y:zs+                                     else x:y:zs+      totLength = sum lengths+      quotient = if totLength > numColumns+                   then fromIntegral totLength+                   else fromIntegral numColumns+      fracs = map (\l -> (fromIntegral l) / quotient) lengths in+  tail fracs++simpleTableHeader :: Bool  -- ^ Headerless table +                  -> GenParser Char ParserState ([[Char]], [Alignment], [Int])+simpleTableHeader headless = try $ do+  optional blanklines+  rawContent  <- if headless+                    then return ""+                    else simpleTableSep '=' >> anyLine+  dashes      <- simpleDashedLines '='+  newline+  let lines'   = map snd dashes+  let indices  = scanl (+) 0 lines'+  let aligns   = replicate (length lines') AlignDefault+  let rawHeads = if headless+                    then replicate (length dashes) ""+                    else simpleTableSplitLine indices rawContent+  return (rawHeads, aligns, indices)++gridTableHeader :: Bool -- ^ Headerless table+                -> GenParser Char ParserState ([String], [Alignment], [Int])+gridTableHeader headless = try $ do+  optional blanklines+  dashes <- gridDashedLines '-'+  rawContent  <- if headless+                    then return $ repeat "" +                    else many1+                         (notFollowedBy (gridTableSep '=') >> char '|' >> many1Till anyChar newline)+  if headless+     then return ()+     else gridTableSep '=' >> return ()+  let lines'   = map snd dashes+  let indices  = scanl (+) 0 lines'+  let aligns   = replicate (length lines') AlignDefault -- RST does not have a notion of alignments+  let rawHeads = if headless+                    then replicate (length dashes) ""+                    else map (intercalate " ") $ transpose+                       $ map (gridTableSplitLine indices) rawContent+  return (rawHeads, aligns, indices)++-- Parse a table using 'headerParser', 'lineParser', and 'footerParser'.+tableWith :: GenParser Char ParserState ([[Char]], [Alignment], [Int])+          -> ([Int] -> GenParser Char ParserState [[Block]])+          -> GenParser Char ParserState sep+          -> GenParser Char ParserState end+          -> GenParser Char ParserState Block+tableWith headerParser rowParser lineParser footerParser = try $ do+    (rawHeads, aligns, indices) <- headerParser+    lines' <- rowParser indices `sepEndBy` lineParser+    footerParser+    heads <- mapM (parseFromString (many plain)) rawHeads+    state <- getState+    let captions = [] -- no notion of captions in RST+    let numColumns = stateColumns state+    let widths = widthsFromIndices numColumns indices+    return $ Table captions aligns widths heads lines'++-- Parse a simple table with '---' header and one line per row.+simpleTable :: Bool  -- ^ Headerless table+            -> GenParser Char ParserState Block+simpleTable headless = do+  Table c a _w h l <- tableWith (simpleTableHeader headless) simpleTableRow sep simpleTableFooter+  -- Simple tables get 0s for relative column widths (i.e., use default)+  return $ Table c a (replicate (length a) 0) h l+ where+  sep = return () -- optional (simpleTableSep '-')++-- Parse a grid table:  starts with row of '-' on top, then header+-- (which may be grid), then the rows,+-- which may be grid, separated by blank lines, and+-- ending with a footer (dashed line followed by blank line).+gridTable :: Bool -- ^ Headerless table+               -> GenParser Char ParserState Block+gridTable headless =+  tableWith (gridTableHeader headless) gridTableRow (gridTableSep '-') gridTableFooter++table :: GenParser Char ParserState Block+table = gridTable False <|> simpleTable False <|>+        gridTable True  <|> simpleTable True <?> "table"++  --   -- inline  --@@ -719,4 +925,3 @@            Nothing     -> fail "no corresponding key"            Just target -> return target   return $ Image (normalizeSpaces ref) src-
src/Text/Pandoc/Shared.hs view
@@ -97,6 +97,7 @@                      compactify,                      Element (..),                      hierarchicalize,+                     uniqueIdent,                      isHeaderBlock,                      -- * Writer options                      HTMLMathMethod (..),@@ -902,7 +903,7 @@ inlineListToIdentifier' (x:xs) =   xAsText ++ inlineListToIdentifier' xs   where xAsText = case x of-          Str s          -> filter (\c -> c `elem` "_-.~" || not (isPunctuation c)) $+          Str s          -> filter (\c -> c `elem` "_-." || not (isPunctuation c)) $                             intercalate "-" $ words $ map toLower s           Emph lst       -> inlineListToIdentifier' lst           Strikeout lst  -> inlineListToIdentifier' lst@@ -952,6 +953,8 @@ headerLtEq level (Header l _) = l <= level headerLtEq _ _ = False +-- | Generate a unique identifier from a list of inlines.+-- Second argument is a list of already used identifiers. uniqueIdent :: [Inline] -> [String] -> String uniqueIdent title' usedIdents =   let baseIdent = inlineListToIdentifier title'@@ -976,6 +979,7 @@                     | JsMath (Maybe String)       -- url of jsMath load script                     | GladTeX                     | MimeTeX String              -- url of mimetex.cgi +                    | MathML (Maybe String)       -- url of MathMLinHTML.js                     deriving (Show, Read, Eq)  -- | Methods for obfuscating email addresses in HTML.@@ -1018,7 +1022,7 @@                 , writerTabStop          = 4                 , writerTableOfContents  = False                 , writerS5               = False-                , writerXeTeX            = True+                , writerXeTeX            = False                 , writerHTMLMathMethod   = PlainMath                 , writerIgnoreNotes      = False                 , writerIncremental      = False@@ -1044,9 +1048,11 @@   setCurrentDirectory oldDir   return result --- | Read file from user data directory or, if not found there, from--- Cabal data directory.  On unix the user data directory is @$HOME/.pandoc@.-readDataFile :: FilePath -> IO String-readDataFile fname = do-  userDir <- getAppUserDataDirectory "pandoc"-  catch (readFile $ userDir </> fname) (\_ -> getDataFileName fname >>= readFile) +-- | Read file from specified user data directory or, if not found there, from+-- Cabal data directory.+readDataFile :: Maybe FilePath -> FilePath -> IO String+readDataFile userDir fname =+  case userDir of+       Nothing  -> getDataFileName fname >>= readFile+       Just u   -> catch (readFile $ u </> fname)+                   (\_ -> getDataFileName fname >>= readFile)
src/Text/Pandoc/Templates.hs view
@@ -66,27 +66,29 @@  module Text.Pandoc.Templates ( renderTemplate                              , TemplateTarget-                             , getDefaultTemplate) where+                             , getDefaultTemplate ) where  import Text.ParserCombinators.Parsec import Control.Monad (liftM, when, forM)-import qualified Control.Exception as E (try, IOException) import System.FilePath-import Text.Pandoc.Shared (readDataFile) import Data.List (intercalate, intersperse) import Text.PrettyPrint (text, Doc) import Text.XHtml (primHtml, Html) import Data.ByteString.Lazy.UTF8 (ByteString, fromString)+import Text.Pandoc.Shared (readDataFile)+import qualified Control.Exception.Extensible as E (try, IOException) --- | Get the default template, either from the application's user data--- directory (~/.pandoc on unix) or from the cabal data directory.-getDefaultTemplate :: String -> IO (Either E.IOException String)-getDefaultTemplate "native" = return $ Right ""-getDefaultTemplate "s5" = getDefaultTemplate "html"-getDefaultTemplate "odt" = getDefaultTemplate "opendocument"-getDefaultTemplate format = do-  let format' = takeWhile (/='+') format  -- strip off "+lhs" if present-  E.try $ readDataFile $ "templates" </> format' <.> "template"+-- | Get default template for the specified writer.+getDefaultTemplate :: (Maybe FilePath) -- ^ User data directory to search first +                   -> String           -- ^ Name of writer +                   -> IO (Either E.IOException String)+getDefaultTemplate _ "native" = return $ Right ""+getDefaultTemplate user "s5" = getDefaultTemplate user "html"+getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument"+getDefaultTemplate user writer = do+  let format = takeWhile (/='+') writer  -- strip off "+lhs" if present+  let fname = "templates" </> format  <.> "template"+  E.try $ readDataFile user fname  data TemplateState = TemplateState Int [(String,String)] 
src/Text/Pandoc/Writers/ConTeXt.hs view
@@ -64,13 +64,7 @@                   then return ""                   else liftM render $ inlineListToConTeXt date   body <- blockListToConTeXt blocks -  let before = if null (writerIncludeBefore options)-                  then empty-                  else text $ writerIncludeBefore options-  let after  = if null (writerIncludeAfter options)-                  then empty-                  else text $ writerIncludeAfter options-  let main = render $ before $$ body $$ after+  let main = render body   let context  = writerVariables options ++                  [ ("toc", if writerTableOfContents options then "yes" else "")                  , ("body", main)@@ -115,6 +109,10 @@   let options = stOptions st   contents <- wrapTeXIfNeeded options False inlineListToConTeXt lst    return $ Reg contents+blockToConTeXt (Para [Image txt (src,_)]) = do+  capt <- inlineListToConTeXt txt+  return $ Pad $ text "\\placefigure[here,nonumber]{" <> capt <>+                 text "}{\\externalfigure[" <> text src <> text "]}"  blockToConTeXt (Para lst) = do    st <- get   let options = stOptions st@@ -185,13 +183,15 @@               else ("p(" ++ printf "%.2f" colWidth ++ "\\textwidth)|")     let colDescriptors = "|" ++ (concat $                                   zipWith colDescriptor widths aligns)-    headers <- tableRowToConTeXt heads +    headers <- if all null heads+                  then return empty+                  else liftM ($$ text "\\HL") $ tableRowToConTeXt heads      captionText <- inlineListToConTeXt caption      let captionText' = if null caption then text "none" else captionText     rows' <- mapM tableRowToConTeXt rows      return $ Pad $ text "\\placetable[here]{" <> captionText' <> char '}' $$              text "\\starttable[" <> text colDescriptors <> char ']' $$-             text "\\HL" $$ headers $$ text "\\HL" $$+             text "\\HL" $$ headers $$              vcat rows' $$ text "\\HL\n\\stoptable"  tableRowToConTeXt :: [[Block]] -> State WriterState Doc@@ -269,10 +269,8 @@   label <- inlineListToConTeXt txt   return $ text "\\useURL[" <> text ref <> text "][" <> text src <>            text "][][" <> label <> text "]\\from[" <> text ref <> char ']'-inlineToConTeXt (Image alternate (src, tit)) = do-  alt <- inlineListToConTeXt alternate-  return $ text "\\placefigure\n[]\n[fig:" <> alt <> text "]\n{" <> -           text tit <> text "}\n{\\externalfigure[" <> text src <> text "]}" +inlineToConTeXt (Image _ (src, _)) = do+  return $ text "{\\externalfigure[" <> text src <> text "]}" inlineToConTeXt (Note contents) = do   contents' <- blockListToConTeXt contents   let rawnote = stripTrailingNewlines $ render contents'
src/Text/Pandoc/Writers/Docbook.hs view
@@ -65,12 +65,7 @@       authors = map (authorToDocbook opts) auths       date = inlinesToDocbook opts dat       elements = hierarchicalize blocks-      before   = writerIncludeBefore opts-      after    = writerIncludeAfter opts-      main     = render $-                 (if null before then empty else text before) $$-                 vcat (map (elementToDocbook opts) elements) $$-                 (if null after then empty else text after)+      main     = render $ vcat (map (elementToDocbook opts) elements)       context = writerVariables opts ++                 [ ("body", main)                 , ("title", render title)@@ -129,6 +124,14 @@ blockToDocbook _ Null = empty blockToDocbook _ (Header _ _) = empty -- should not occur after hierarchicalize blockToDocbook opts (Plain lst) = wrap opts lst+blockToDocbook opts (Para [Image txt (src,_)]) =+  let capt = inlinesToDocbook opts txt+  in  inTagsIndented "figure" $+        inTagsSimple "title" capt $$+        (inTagsIndented "mediaobject" $+           (inTagsIndented "imageobject"+             (selfClosingTag "imagedata" [("fileref",src)])) $$+           inTagsSimple "textobject" (inTagsSimple "phrase" capt)) blockToDocbook opts (Para lst) = inTagsIndented "para" $ wrap opts lst blockToDocbook opts (BlockQuote blocks) =   inTagsIndented "blockquote" $ blocksToDocbook opts blocks@@ -168,24 +171,22 @@ blockToDocbook opts (Table caption aligns widths headers rows) =   let alignStrings = map alignmentToString aligns       captionDoc   = if null caption-                      then empty-                      else inTagsIndented "caption" -                           (inlinesToDocbook opts caption)+                        then empty+                        else inTagsIndented "caption" +                              (inlinesToDocbook opts caption)       tableType    = if isEmpty captionDoc then "informaltable" else "table"-  in  inTagsIndented tableType $ captionDoc $$-     (colHeadsToDocbook opts alignStrings widths headers) $$ -     (vcat $ map (tableRowToDocbook opts alignStrings) rows)--colHeadsToDocbook :: WriterOptions -                  -> [[Char]]-                  -> [Double]-                  -> [[Block]] -                  -> Doc-colHeadsToDocbook opts alignStrings widths headers =-  let heads = zipWith3 (\align width item -> -              tableItemToDocbook opts "th" align width item) -              alignStrings widths headers-  in  inTagsIndented "tr" $ vcat heads+      percent w    = show (truncate (100*w) :: Integer) ++ "%"+      coltags = if all (== 0.0) widths+                   then empty+                   else vcat $ map (\w ->+                          selfClosingTag "col" [("width", percent w)]) widths+      head' = if all null headers+                 then empty+                 else inTagsIndented "thead" $+                         tableRowToDocbook opts alignStrings "th" headers+      body' = inTagsIndented "tbody" $+              vcat $ map (tableRowToDocbook opts alignStrings "td") rows+  in  inTagsIndented tableType $ captionDoc $$ coltags $$ head' $$ body'  alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of@@ -194,22 +195,22 @@                                  AlignCenter -> "center"                                  AlignDefault -> "left" -tableRowToDocbook :: WriterOptions -> [[Char]] -> [[Block]] -> Doc-tableRowToDocbook opts aligns cols = inTagsIndented "tr" $ -  vcat $ zipWith3 (tableItemToDocbook opts "td") aligns (repeat 0) cols+tableRowToDocbook :: WriterOptions+                  -> [String]+                  -> String+                  -> [[Block]]+                  -> Doc+tableRowToDocbook opts aligns celltype cols =+  inTagsIndented "tr" $ vcat $+     zipWith (tableItemToDocbook opts celltype) aligns cols  tableItemToDocbook :: WriterOptions                    -> [Char]                    -> [Char]-                   -> Double                    -> [Block]                    -> Doc-tableItemToDocbook opts tag align width item =-  let attrib = [("align", align)] ++ -               if width /= 0-                  then [("style", "{width: " ++ -                        show (truncate (100*width) :: Integer) ++ "%;}")]-                  else [] +tableItemToDocbook opts tag align item =+  let attrib = [("align", align)]   in  inTags True tag attrib $ vcat $ map (blockToDocbook opts) item  -- | Take list of inline elements and return wrapped doc.
src/Text/Pandoc/Writers/HTML.hs view
@@ -42,6 +42,8 @@ import Data.Maybe ( catMaybes ) import Control.Monad.State import Text.XHtml.Transitional hiding ( stringToHtml )+import Text.TeXMath+import Text.XML.Light.Output  data WriterState = WriterState     { stNotes            :: [Html]  -- ^ List of notes@@ -86,7 +88,7 @@ -- result is (title, authors, date, toc, body, new variables) pandocToHtml :: WriterOptions              -> Pandoc-             -> State WriterState (Html, [Html], Html, Html, Html, [(String,String)])+             -> State WriterState (Html, [Html], Html, Maybe Html, Html, [(String,String)]) pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do   let standalone = writerStandalone opts   tit <- if standalone@@ -101,29 +103,30 @@   let sects = hierarchicalize blocks   toc <- if writerTableOfContents opts              then tableOfContents opts sects-            else return noHtml+            else return Nothing   blocks' <- liftM toHtmlFromList $ mapM (elementToHtml opts) sects   st <- get   let notes = reverse (stNotes st)-  let before = primHtml $ writerIncludeBefore opts-  let after = primHtml $ writerIncludeAfter opts-  let thebody = before +++ blocks' +++ footnoteSection notes +++ after+  let thebody = blocks' +++ footnoteSection notes   let  math = if stMath st                 then case writerHTMLMathMethod opts of                            LaTeXMathML (Just url) ->                               script !                                [src url, thetype "text/javascript"] $ noHtml+                           MathML (Just url) ->+                              script ! +                              [src url, thetype "text/javascript"] $ noHtml                            JsMath (Just url) ->                               script !                               [src url, thetype "text/javascript"] $ noHtml-                           _ -> case lookup "latexmathml-script" (writerVariables opts) of+                           _ -> case lookup "mathml-script" (writerVariables opts) of                                       Just s ->                                          script ! [thetype "text/javascript"] <<                                            primHtml s                                       Nothing -> noHtml                 else noHtml   let newvars = [("highlighting","yes") | stHighlighting st] ++-                [("math", renderHtmlFragment math) | stMath st] +                [("math", renderHtmlFragment math) | stMath st]   return (tit, auths, date, toc, thebody, newvars)  inTemplate :: TemplateTarget a@@ -131,7 +134,7 @@            -> Html            -> [Html]            -> Html-           -> Html+           -> Maybe Html            -> Html            -> [(String,String)]            -> a@@ -144,9 +147,11 @@       context     = variables ++                     [ ("body", renderHtmlFragment body')                     , ("pagetitle", topTitle')-                    , ("toc", renderHtmlFragment toc)                     , ("title", renderHtmlFragment tit)                     , ("date", date') ] +++                    (case toc of+                         Just t  -> [ ("toc", renderHtmlFragment t)]+                         Nothing -> [])  ++                     [ ("author", a) | a <- authors ]   in  renderTemplate context $ writerTemplate opts @@ -155,12 +160,15 @@ prefixedId opts s = identifier $ writerIdentifierPrefix opts ++ s  -- | Construct table of contents from list of elements.-tableOfContents :: WriterOptions -> [Element] -> State WriterState Html-tableOfContents _ [] = return noHtml+tableOfContents :: WriterOptions -> [Element] -> State WriterState (Maybe Html)+tableOfContents _ [] = return Nothing tableOfContents opts sects = do   let opts'        = opts { writerIgnoreNotes = True }   contents  <- mapM (elementToListItem opts') sects-  return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents+  let tocList = catMaybes contents+  return $ if null tocList+              then Nothing+              else Just $ thediv ! [prefixedId opts' "TOC"] $ unordList tocList  -- | Convert section number to string showSecNum :: [Int] -> String@@ -258,6 +266,11 @@ blockToHtml :: WriterOptions -> Block -> State WriterState Html blockToHtml _ Null = return $ noHtml  blockToHtml opts (Plain lst) = inlineListToHtml opts lst+blockToHtml opts (Para [Image txt (s,tit)]) = do+  img <- inlineToHtml opts (Image txt (s,tit))+  capt <- inlineListToHtml opts txt+  return $ thediv ! [theclass "figure"] <<+             [img, paragraph ! [theclass "caption"] << capt] blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph) blockToHtml _ (RawHtml str) = return $ primHtml str blockToHtml _ (HorizontalRule) = return $ hr@@ -342,21 +355,33 @@   captionDoc <- if null capt                    then return noHtml                    else inlineListToHtml opts capt >>= return . caption-  colHeads <- colHeadsToHtml opts alignStrings -                             widths headers-  rows'' <- zipWithM (tableRowToHtml opts alignStrings) (cycle ["odd", "even"]) rows'-  return $ table $ captionDoc +++ colHeads +++ rows''+  let percent w = show (truncate (100*w) :: Integer) ++ "%"+  let coltags = if all (== 0.0) widths+                   then noHtml+                   else concatHtml $ map+                         (\w -> col ! [width $ percent w] $ noHtml) widths+  head' <- if all null headers+              then return noHtml+              else liftM (thead <<) $ tableRowToHtml opts alignStrings 0 headers+  body' <- liftM (tbody <<) $+               zipWithM (tableRowToHtml opts alignStrings) [1..] rows'+  return $ table $ captionDoc +++ coltags +++ head' +++ body' -colHeadsToHtml :: WriterOptions-               -> [[Char]]-               -> [Double]+tableRowToHtml :: WriterOptions+               -> [String]+               -> Int                -> [[Block]]                -> State WriterState Html-colHeadsToHtml opts alignStrings widths headers = do-  heads <- sequence $ zipWith3 -           (\alignment columnwidth item -> tableItemToHtml opts th alignment columnwidth item) -           alignStrings widths headers-  return $ tr ! [theclass "header"] $ toHtmlFromList heads+tableRowToHtml opts alignStrings rownum cols' = do+  let mkcell = if rownum == 0 then th else td+  let rowclass = case rownum of+                      0                  -> "header"+                      x | x `rem` 2 == 1 -> "odd"+                      _                  -> "even"+  cols'' <- sequence $ zipWith +            (\alignment item -> tableItemToHtml opts mkcell alignment item) +            alignStrings cols'+  return $ tr ! [theclass rowclass] $ toHtmlFromList cols''  alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of@@ -365,28 +390,14 @@                                  AlignCenter  -> "center"                                  AlignDefault -> "left" -tableRowToHtml :: WriterOptions-               -> [[Char]]-               -> String-               -> [[Block]]-               -> State WriterState Html-tableRowToHtml opts aligns rowclass columns =-  (sequence $ zipWith3 (tableItemToHtml opts td) aligns (repeat 0) columns) >>=-  return . (tr ! [theclass rowclass]) . toHtmlFromList- tableItemToHtml :: WriterOptions                 -> (Html -> Html)                 -> [Char]-                -> Double                 -> [Block]                 -> State WriterState Html-tableItemToHtml opts tag' align' width' item = do+tableItemToHtml opts tag' align' item = do   contents <- blockListToHtml opts item-  let attrib = [align align'] ++ -               if width' /= 0-                  then [thestyle ("width: " ++ (show  (truncate (100 * width') :: Integer)) ++ "%;")]-                  else [] -  return $ tag' ! attrib $ contents+  return $ tag' ! [align align'] $ contents  blockListToHtml :: WriterOptions -> [Block] -> State WriterState Html blockListToHtml opts lst = @@ -445,6 +456,17 @@                                                     alt str, title str]                                GladTeX ->                                   return $ primHtml $ "<EQ>" ++ str ++ "</EQ>"+                               MathML _ -> do+                                  let dt = if t == InlineMath+                                              then DisplayInline+                                              else DisplayBlock+                                  let conf = useShortEmptyTags (const False)+                                               defaultConfigPP+                                  case texMathToMathML dt str of+                                        Right r -> return $ primHtml $+                                                    ppcElement conf r+                                        Left  _ -> inlineToHtml opts+                                                     (Math t str)                                PlainMath ->                                    inlineListToHtml opts (readTeXMath str) >>=                                   return . (thespan ! [theclass "math"]) ) 
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -32,7 +32,7 @@ import Text.Pandoc.Shared import Text.Pandoc.Templates import Text.Printf ( printf )-import Data.List ( (\\), isSuffixOf, intersperse )+import Data.List ( (\\), isSuffixOf, isPrefixOf, intersperse ) import Data.Char ( toLower ) import Control.Monad.State import Text.PrettyPrint.HughesPJ hiding ( Str )@@ -46,10 +46,10 @@               , stTable      :: Bool          -- true if document has a table               , stStrikeout  :: Bool          -- true if document has strikeout               , stSubscript  :: Bool          -- true if document has subscript-              , stLink       :: Bool          -- true if document has links               , stUrl        :: Bool          -- true if document has visible URL link               , stGraphics   :: Bool          -- true if document contains images               , stLHS        :: Bool          -- true if document has literate haskell code+              , stBook       :: Bool          -- true if document uses book or memoir class               }  -- | Convert Pandoc to LaTeX.@@ -59,22 +59,22 @@   WriterState { stInNote = False, stOLLevel = 1, stOptions = options,                 stVerbInNote = False, stEnumerate = False,                 stTable = False, stStrikeout = False, stSubscript = False,-                stLink = False, stUrl = False, stGraphics = False,-                stLHS = False } +                stUrl = False, stGraphics = False,+                stLHS = False, stBook = False }   pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do+  let template = writerTemplate options+  let usesBookClass x = "\\documentclass" `isPrefixOf` x &&+         ("{memoir}" `isSuffixOf` x || "{book}" `isSuffixOf` x ||+          "{report}" `isSuffixOf` x)+  when (any usesBookClass (lines template)) $+    modify $ \s -> s{stBook = True}   titletext <- liftM render $ inlineListToLaTeX title   authorsText <- mapM (liftM render . inlineListToLaTeX) authors   dateText <- liftM render $ inlineListToLaTeX date   body <- blockListToLaTeX blocks-  let before = if null (writerIncludeBefore options)-                 then empty-                 else text $ writerIncludeBefore options-  let after = if null (writerIncludeAfter options)-                 then empty-                 else text $ writerIncludeAfter options-  let main = render $ before $$ body $$ after+  let main = render body   st <- get   let context  = writerVariables options ++                  [ ("toc", if writerTableOfContents options then "yes" else "")@@ -88,12 +88,12 @@                  [ ("tables", "yes") | stTable st ] ++                  [ ("strikeout", "yes") | stStrikeout st ] ++                  [ ("subscript", "yes") | stSubscript st ] ++-                 [ ("links", "yes") | stLink st ] ++                  [ ("url", "yes") | stUrl st ] +++                 [ ("numbersections", "yes") | writerNumberSections options ] ++                  [ ("lhs", "yes") | stLHS st ] ++                  [ ("graphics", "yes") | stGraphics st ]   return $ if writerStandalone options-              then renderTemplate context $ writerTemplate options+              then renderTemplate context template               else main  -- escape things as needed for LaTeX@@ -130,6 +130,11 @@   st <- get   let opts = stOptions st   wrapTeXIfNeeded opts True inlineListToLaTeX lst+blockToLaTeX (Para [Image txt (src,tit)]) = do+  capt <- inlineListToLaTeX txt+  img <- inlineToLaTeX (Image txt (src,tit))+  return $ text "\\begin{figure}[htb]" $$ text "\\centering" $$ img $$+           (text "\\caption{" <> capt <> char '}') $$ text "\\end{figure}\n" blockToLaTeX (Para lst) = do   st <- get   let opts = stOptions st@@ -195,18 +200,26 @@                  else do                    res <- inlineListToLaTeX lstNoNotes                    return $ char '[' <> res <> char ']'-  return $ if (level > 0) && (level <= 3)-              then text ("\\" ++ (concat (replicate (level - 1) "sub")) ++ -                   "section") <> optional <> char '{' <> txt <> text "}\n"-              else txt <> char '\n'+  let stuffing = optional <> char '{' <> txt <> char '}'+  book <- liftM stBook get+  return $ case (book, level) of+                (True, 1)    -> text "\\chapter" <> stuffing <> char '\n'+                (True, 2)    -> text "\\section" <> stuffing <> char '\n'+                (True, 3)    -> text "\\subsection" <> stuffing <> char '\n'+                (True, 4)    -> text "\\subsubsection" <> stuffing <> char '\n'+                (False, 1)   -> text "\\section" <> stuffing <> char '\n'+                (False, 2)   -> text "\\subsection" <> stuffing <> char '\n'+                (False, 3)   -> text "\\subsubsection" <> stuffing <> char '\n'+                _            -> txt <> char '\n'  blockToLaTeX (Table caption aligns widths heads rows) = do-  headers <- tableRowToLaTeX heads+  headers <- if all null heads+                then return empty+                else liftM ($$ text "\\hline") $ tableRowToLaTeX heads   captionText <- inlineListToLaTeX caption   rows' <- mapM tableRowToLaTeX rows   let colDescriptors = concat $ zipWith toColDescriptor widths aligns   let tableBody = text ("\\begin{tabular}{" ++ colDescriptors ++ "}") $$-                  headers $$ text "\\hline" $$ vcat rows' $$ -                  text "\\end{tabular}" +                  headers $$ vcat rows' $$ text "\\end{tabular}"    let centered txt = text "\\begin{center}" $$ txt $$ text "\\end{center}"   modify $ \s -> s{ stTable = True }   return $ if isEmpty captionText@@ -315,8 +328,7 @@ inlineToLaTeX (HtmlInline _) = return empty inlineToLaTeX (LineBreak) = return $ text "\\\\"  inlineToLaTeX Space = return $ char ' '-inlineToLaTeX (Link txt (src, _)) = do-  modify $ \s -> s{ stLink = True }+inlineToLaTeX (Link txt (src, _)) =   case txt of         [Code x] | x == src ->  -- autolink              do modify $ \s -> s{ stUrl = True }
src/Text/Pandoc/Writers/Man.hs view
@@ -48,10 +48,6 @@ -- | Return groff man representation of document. pandocToMan :: WriterOptions -> Pandoc -> State WriterState String pandocToMan opts (Pandoc (Meta title authors date) blocks) = do-  let before  = writerIncludeBefore opts-  let after   = writerIncludeAfter opts-  let before' = if null before then empty else text before-  let after'  = if null after then empty else text after   titleText <- inlineListToMan opts title   authors' <- mapM (inlineListToMan opts) authors   date' <- inlineListToMan opts date @@ -66,7 +62,7 @@   body <- blockListToMan opts blocks   notes <- liftM stNotes get   notes' <- notesToMan opts (reverse notes)-  let main = render $ before' $$ body $$ notes' $$ after'+  let main = render $ body $$ notes'   hasTables <- liftM stHasTables get   let context  = writerVariables opts ++                  [ ("body", main)@@ -178,13 +174,15 @@   let makeRow cols = text "T{" $$                       (vcat $ intersperse (text "T}@T{") cols) $$                       text "T}"-  let colheadings' = makeRow colheadings+  let colheadings' = if all null headers+                        then empty+                        else makeRow colheadings $$ char '_'   body <- mapM (\row -> do                           cols <- mapM (blockListToMan opts) row                          return $ makeRow cols) rows   return $ text ".PP" $$ caption' $$             text ".TS" $$ text "tab(@);" $$ coldescriptions $$ -           colheadings' $$ char '_' $$ vcat body $$ text ".TE"+           colheadings' $$ vcat body $$ text ".TE"  blockToMan opts (BulletList items) = do   contents <- mapM (bulletListItemToMan opts) items
src/Text/Pandoc/Writers/Markdown.hs view
@@ -29,7 +29,7 @@  Markdown:  <http://daringfireball.net/projects/markdown/> -}-module Text.Pandoc.Writers.Markdown ( writeMarkdown) where+module Text.Pandoc.Writers.Markdown (writeMarkdown, writePlain) where import Text.Pandoc.Definition import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Shared @@ -41,13 +41,44 @@  type Notes = [[Block]] type Refs = KeyTable-type WriterState = (Notes, Refs)+data WriterState = WriterState { stNotes :: Notes+                               , stRefs :: Refs+                               , stPlain :: Bool }  -- | Convert Pandoc to Markdown. writeMarkdown :: WriterOptions -> Pandoc -> String writeMarkdown opts document = -  evalState (pandocToMarkdown opts document) ([],[]) +  evalState (pandocToMarkdown opts document) WriterState{ stNotes = []+                                                        , stRefs  = []+                                                        , stPlain = False } +-- | Convert Pandoc to plain text (like markdown, but without links,+-- pictures, or inline formatting).+writePlain :: WriterOptions -> Pandoc -> String+writePlain opts document =+  evalState (pandocToMarkdown opts document') WriterState{ stNotes = []+                                                         , stRefs  = []+                                                         , stPlain = True }+    where document' = plainify document++plainify :: Pandoc -> Pandoc+plainify = processWith go+  where go :: [Inline] -> [Inline]+        go (Emph xs : ys) = go xs ++ go ys+        go (Strong xs : ys) = go xs ++ go ys+        go (Strikeout xs : ys) = go xs ++ go ys+        go (Superscript xs : ys) = go xs ++ go ys+        go (Subscript xs : ys) = go xs ++ go ys+        go (SmallCaps xs : ys) = go xs ++ go ys+        go (Code s : ys) = Str s : go ys+        go (Math _ s : ys) = Str s : go ys+        go (TeX _ : ys) = Str "" : go ys+        go (HtmlInline _ : ys) = Str "" : go ys+        go (Link xs _ : ys) = go xs ++ go ys+        go (Image _ _ : ys) = go ys+        go (x : ys) = x : go ys+        go [] = []+ -- | Return markdown representation of document. pandocToMarkdown :: WriterOptions -> Pandoc -> State WriterState String pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do@@ -60,17 +91,11 @@                then tableOfContents opts headerBlocks                else empty   body <- blockListToMarkdown opts blocks-  let before = if null (writerIncludeBefore opts)-                  then empty-                  else text $ writerIncludeBefore opts-  let after = if null (writerIncludeAfter opts)-                  then empty-                  else text $ writerIncludeAfter opts-  (notes, _) <- get-  notes' <- notesToMarkdown opts (reverse notes)-  (_, refs) <- get  -- note that the notes may contain refs-  refs' <- keyTableToMarkdown opts (reverse refs)-  let main = render $ before $+$ body $+$ text "" $+$ notes' $+$ text "" $+$ refs' $+$ after+  st <- get+  notes' <- notesToMarkdown opts (reverse $ stNotes st)+  st' <- get  -- note that the notes may contain refs+  refs' <- keyTableToMarkdown opts (reverse $ stRefs st')+  let main = render $ body $+$ text "" $+$ notes' $+$ text "" $+$ refs'   let context  = writerVariables opts ++                  [ ("toc", render toc)                  , ("body", main)@@ -120,7 +145,9 @@ tableOfContents opts headers =   let opts' = opts { writerIgnoreNotes = True }       contents = BulletList $ map elementToListItem $ hierarchicalize headers-  in  evalState (blockToMarkdown opts' contents) ([],[])+  in  evalState (blockToMarkdown opts' contents) WriterState{ stNotes = []+                                                            , stRefs  = []+                                                            , stPlain = False }  -- | Converts an Element to a list item for a table of contents, elementToListItem :: Element -> [Block]@@ -170,13 +197,18 @@                then char '\\'                else empty    return $ esc <> contents <> text "\n"-blockToMarkdown _ (RawHtml str) = return $ text str+blockToMarkdown _ (RawHtml str) = do+  st <- get+  if stPlain st+     then return empty+     else return $ text str blockToMarkdown _ HorizontalRule = return $ text "\n* * * * *\n" blockToMarkdown opts (Header level inlines) = do   contents <- inlineListToMarkdown opts inlines+  st <- get   -- use setext style headers if in literate haskell mode.   -- ghc interprets '#' characters in column 1 as line number specifiers.-  if writerLiterateHaskell opts+  if writerLiterateHaskell opts || stPlain st      then let len = length $ render contents           in  return $ contents <> text "\n" <>                        case level of@@ -191,11 +223,14 @@ blockToMarkdown opts (CodeBlock _ str) = return $   (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n" blockToMarkdown opts (BlockQuote blocks) = do+  st <- get   -- if we're writing literate haskell, put a space before the bird tracks   -- so they won't be interpreted as lhs...   let leader = if writerLiterateHaskell opts                   then text . (" > " ++)-                  else text . ("> " ++)+                  else if stPlain st+                          then text . ("  " ++)+                          else text . ("> " ++)   contents <- blockListToMarkdown opts blocks   return $ (vcat $ map leader $ lines $ render contents) <>             text "\n"@@ -219,20 +254,28 @@           else map (floor . (78 *)) widths   let makeRow = hsepBlocks . (zipWith alignHeader aligns) .                  (zipWith docToBlock widthsInChars)-  let head' = makeRow headers'   let rows' = map makeRow rawRows+  let head' = makeRow headers'   let maxRowHeight = maximum $ map heightOfBlock (head':rows')   let underline = hsep $                    map (\width -> text $ replicate width '-') widthsInChars   let border = if maxRowHeight > 1                   then text $ replicate (sum widthsInChars + (length widthsInChars - 1)) '-'-                  else empty+                  else if all null headers+                          then underline+                          else empty+  let head'' = if all null headers+                  then empty+                  else border $+$ blockToDoc head'   let spacer = if maxRowHeight > 1                   then text ""                   else empty   let body = vcat $ intersperse spacer $ map blockToDoc rows'-  return $ (nest 2 $ border $+$ (blockToDoc head') $+$ underline $+$ body $+$ -                     border $+$ caption'') <> text "\n"+  let bottom = if all null headers+                  then underline+                  else border+  return $ (nest 2 $ head'' $+$ underline $+$ body $+$ +                     bottom $+$ caption'') <> text "\n" blockToMarkdown opts (BulletList items) = do   contents <- mapM (bulletListItemToMarkdown opts) items   return $ (vcat contents) <> text "\n"@@ -271,7 +314,8 @@ definitionListItemToMarkdown opts (label, defs) = do   labelText <- inlineListToMarkdown opts label   let tabStop = writerTabStop opts-  let leader  = char ':'+  st <- get+  let leader  = if stPlain st then empty else text "  ~"   contents <- liftM vcat $     mapM (liftM ((leader $$) . nest tabStop . vcat) . mapM (blockToMarkdown opts))           defs   return $ labelText $+$ contents@@ -287,18 +331,18 @@ --   Prefer label if possible; otherwise, generate a unique key. getReference :: [Inline] -> Target -> State WriterState [Inline] getReference label (src, tit) = do-  (_,refs) <- get-  case find ((== (src, tit)) . snd) refs of+  st <- get+  case find ((== (src, tit)) . snd) (stRefs st) of     Just (ref, _) -> return ref     Nothing       -> do-      let label' = case find ((== label) . fst) refs of+      let label' = case find ((== label) . fst) (stRefs st) of                       Just _ -> -- label is used; generate numerical label                                  case find (\n -> not (any (== [Str (show n)])-                                           (map fst refs))) [1..(10000 :: Integer)] of+                                           (map fst (stRefs st)))) [1..(10000 :: Integer)] of                                       Just x  -> [Str (show x)]                                       Nothing -> error "no unique label"                       Nothing -> label-      modify (\(notes, refs') -> (notes, (label', (src,tit)):refs'))+      modify (\s -> s{ stRefs = (label', (src,tit)) : stRefs st })       return label'  -- | Convert list of Pandoc inline elements to markdown.@@ -344,20 +388,18 @@       marker     = replicate (longest + 1) '`'        spacer     = if (longest == 0) then "" else " " in   return $ text (marker ++ spacer ++ str ++ spacer ++ marker)-inlineToMarkdown _ (Str str) = return $ text $ escapeString str+inlineToMarkdown _ (Str str) = do+  st <- get+  if stPlain st+     then return $ text str+     else return $ text $ escapeString str inlineToMarkdown _ (Math InlineMath str) = return $ char '$' <> text str <> char '$' inlineToMarkdown _ (Math DisplayMath str) = return $ text "$$" <> text str <> text "$$" inlineToMarkdown _ (TeX str) = return $ text str inlineToMarkdown _ (HtmlInline str) = return $ text str  inlineToMarkdown _ (LineBreak) = return $ text "  \n" inlineToMarkdown _ Space = return $ char ' '-inlineToMarkdown _ (Cite cits _ ) = do-  let format (a,b) xs = text a <>-                        (if b /= [] then char '@' else empty) <>-                        text b <> -                        (if isEmpty xs then empty else text "; ") <>-                        xs-  return $ char '[' <> foldr format empty cits <> char ']'+inlineToMarkdown opts (Cite _ cits) = inlineListToMarkdown opts cits inlineToMarkdown opts (Link txt (src, tit)) = do   linktext <- inlineListToMarkdown opts txt   let linktitle = if null tit then empty else text $ " \"" ++ tit ++ "\""@@ -384,7 +426,7 @@   linkPart <- inlineToMarkdown opts (Link txt (source, tit))    return $ char '!' <> linkPart inlineToMarkdown _ (Note contents) = do -  modify (\(notes, refs) -> (contents:notes, refs)) -- add to notes in state-  (notes, _) <- get-  let ref = show $ (length notes)+  modify (\st -> st{ stNotes = contents : stNotes st })+  st <- get+  let ref = show $ (length $ stNotes st)   return $ text "[^" <> text ref <> char ']'
src/Text/Pandoc/Writers/MediaWiki.hs view
@@ -53,14 +53,12 @@ -- | Return MediaWiki representation of document. pandocToMediaWiki :: WriterOptions -> Pandoc -> State WriterState String pandocToMediaWiki opts (Pandoc _ blocks) = do-  let before  = writerIncludeBefore opts-  let after   = writerIncludeAfter opts   body <- blockListToMediaWiki opts blocks   notesExist <- get >>= return . stNotes   let notes = if notesExist-                 then "\n== Notes ==\n<references />"+                 then "\n<references />"                  else "" -  let main = before ++ body ++ after ++ notes+  let main = body ++ notes   let context = writerVariables opts ++                 [ ("body", main) ] ++                 [ ("toc", "yes") | writerTableOfContents opts ]@@ -82,6 +80,14 @@ blockToMediaWiki opts (Plain inlines) =    inlineListToMediaWiki opts inlines +blockToMediaWiki opts (Para [Image txt (src,tit)]) = do+  capt <- inlineListToMediaWiki opts txt +  let opt = if null txt+               then ""+               else "|alt=" ++ if null tit then capt else tit +++                    "|caption " ++ capt+  return $ "[[Image:" ++ src ++ "|frame|none" ++ opt ++ "]]\n"+ blockToMediaWiki opts (Para inlines) = do   useTags <- get >>= return . stUseTags   listLevel <- get >>= return . stListLevel@@ -96,7 +102,7 @@  blockToMediaWiki opts (Header level inlines) = do   contents <- inlineListToMediaWiki opts inlines-  let eqs = replicate (level + 1) '='+  let eqs = replicate level '='   return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"  blockToMediaWiki _ (CodeBlock (_,classes,_) str) = do@@ -118,17 +124,27 @@   contents <- blockListToMediaWiki opts blocks   return $ "<blockquote>" ++ contents ++ "</blockquote>"  -blockToMediaWiki opts (Table caption aligns widths headers rows) =  do+blockToMediaWiki opts (Table capt aligns widths headers rows') = do   let alignStrings = map alignmentToString aligns-  captionDoc <- if null caption+  captionDoc <- if null capt                    then return ""                    else do-                     c <- inlineListToMediaWiki opts caption-                     return $ "<caption>" ++ c ++ "</caption>"-  colHeads <- colHeadsToMediaWiki opts alignStrings widths headers-  rows' <- mapM (tableRowToMediaWiki opts alignStrings) rows-  return $  "<table>\n" ++ captionDoc ++ colHeads ++ vcat rows' ++ "\n</table>"- +                      c <- inlineListToMediaWiki opts capt+                      return $ "<caption>" ++ c ++ "</caption>\n"+  let percent w = show (truncate (100*w) :: Integer) ++ "%"+  let coltags = if all (== 0.0) widths+                   then ""+                   else unlines $ map+                         (\w -> "<col width=\"" ++ percent w ++ "\" />") widths+  head' <- if all null headers+              then return ""+              else do+                 hs <- tableRowToMediaWiki opts alignStrings 0 headers+                 return $ "<thead>\n" ++ hs ++ "\n</thead>\n"+  body' <- zipWithM (tableRowToMediaWiki opts alignStrings) [1..] rows'+  return $ "<table>\n" ++ captionDoc ++ coltags ++ head' +++            "<tbody>\n" ++ unlines body' ++ "</tbody>\n</table>\n"+ blockToMediaWiki opts x@(BulletList items) = do   oldUseTags <- get >>= return . stUseTags   let useTags = oldUseTags || not (isSimpleList x)@@ -249,25 +265,27 @@ isPlainOrPara (Para  _) = True isPlainOrPara _         = False -tr :: String -> String -tr x =  "<tr>\n" ++ x ++ "\n</tr>"- -- | Concatenates strings with line breaks between them. vcat :: [String] -> String vcat = intercalate "\n"  -- Auxiliary functions for tables: -colHeadsToMediaWiki :: WriterOptions-                    -> [[Char]]-                    -> [Double]+tableRowToMediaWiki :: WriterOptions+                    -> [String]+                    -> Int                     -> [[Block]]                     -> State WriterState String-colHeadsToMediaWiki opts alignStrings widths headers = do-  heads <- sequence $ zipWith3 -           (\alignment columnwidth item -> tableItemToMediaWiki opts "th" alignment columnwidth item) -           alignStrings widths headers-  return $ tr $ vcat heads+tableRowToMediaWiki opts alignStrings rownum cols' = do+  let celltype = if rownum == 0 then "th" else "td"+  let rowclass = case rownum of+                      0                  -> "header"+                      x | x `rem` 2 == 1 -> "odd"+                      _                  -> "even"+  cols'' <- sequence $ zipWith +            (\alignment item -> tableItemToMediaWiki opts celltype alignment item) +            alignStrings cols'+  return $ "<tr class=\"" ++ rowclass ++ "\">\n" ++ unlines cols'' ++ "</tr>"  alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of@@ -276,27 +294,16 @@                                  AlignCenter  -> "center"                                  AlignDefault -> "left" -tableRowToMediaWiki :: WriterOptions-                    -> [[Char]]-                    -> [[Block]]-                    -> State WriterState String-tableRowToMediaWiki opts aligns columns = -  (sequence $ zipWith3 (tableItemToMediaWiki opts "td") aligns (repeat 0) columns) >>=-     return . tr . vcat- tableItemToMediaWiki :: WriterOptions-                     -> [Char]-                     -> [Char]-                     -> Double+                     -> String+                     -> String                      -> [Block]                      -> State WriterState String-tableItemToMediaWiki opts tag' align' width' item = do+tableItemToMediaWiki opts celltype align' item = do+  let mkcell x = "<" ++ celltype ++ " align=\"" ++ align' ++ "\">" +++                    x ++ "</" ++ celltype ++ ">"   contents <- blockListToMediaWiki opts item-  let attrib = " align=\"" ++ align' ++ "\"" ++-               if width' /= 0-                  then " style=\"width: " ++ (show  (truncate (100 * width') :: Integer)) ++ "%;\""-                  else "" -  return $ "<" ++ tag' ++ attrib ++ ">" ++ contents ++ "</" ++ tag' ++ ">"+  return $ mkcell contents  -- | Convert list of Pandoc block elements to MediaWiki. blockListToMediaWiki :: WriterOptions -- ^ Options@@ -370,17 +377,15 @@ inlineToMediaWiki _ Space = return " "  inlineToMediaWiki opts (Link txt (src, _)) = do-  link <- inlineListToMediaWiki opts txt-  let useAuto = txt == [Code src]-  let src' = if isURI src-                then src-                else if take 1 src == "/"-                         then "http://{{SERVERNAME}}" ++ src-                         else "http://{{SERVERNAME}}/" ++ src-  return $ if useAuto-              then src'-              else "[" ++ src' ++ " " ++ link ++ "]"-+  label <- inlineListToMediaWiki opts txt+  if txt == [Code src] -- autolink+     then return src+     else if isURI src+             then return $ "[" ++ src ++ " " ++ label ++ "]"+             else return $ "[[" ++ src' ++ "|" ++ label ++ "]]"+                   where src' = case src of+                                     '/':xs -> xs  -- with leading / it's a+                                     _      -> src -- link to a help page inlineToMediaWiki opts (Image alt (source, tit)) = do   alt' <- inlineListToMediaWiki opts alt   let txt = if (null tit)
src/Text/Pandoc/Writers/OpenDocument.hs view
@@ -166,12 +166,7 @@            date'' <- inlinesToOpenDocument opts date            doc'' <- blocksToOpenDocument opts blocks            return (doc'', title'', authors'', date'')-      before   = writerIncludeBefore opts-      after    = writerIncludeAfter opts-      body     = (if null before then empty else text before) $$-                 doc $$-                 (if null after then empty else text after)-      body'    = render body+      body'    = render doc       styles   = stTableStyles s ++ stParaStyles s ++ stTextStyles s       listStyle (n,l) = inTags True "text:list-style"                           [("style:name", "L" ++ show n)] (vcat l)@@ -313,7 +308,9 @@         captionDoc <- if null c                       then return empty                       else withParagraphStyle o "Caption" [Para c]-        th <- colHeadsToOpenDocument       o name (map fst paraHStyles) h+        th <- if all null h+                 then return empty+                 else colHeadsToOpenDocument o name (map fst paraHStyles) h         tr <- mapM (tableRowToOpenDocument o name (map fst paraStyles)) r         return $ inTags True "table:table" [ ("table:name"      , name)                                            , ("table:style-name", name)
src/Text/Pandoc/Writers/RST.hs view
@@ -59,10 +59,6 @@ pandocToRST :: Pandoc -> State WriterState String pandocToRST (Pandoc (Meta tit auth dat) blocks) = do   opts <- liftM stOptions get-  let before  = writerIncludeBefore opts-      after   = writerIncludeAfter opts-      before' = if null before then empty else text before-      after'  = if null after then empty else text after   title <- titleToRST tit   authors <- mapM inlineListToRST auth   date <- inlineListToRST dat@@ -72,8 +68,7 @@   refs <- liftM (reverse . stLinks) get >>= keyTableToRST   pics <- liftM (reverse . stImages) get >>= pictTableToRST   hasMath <- liftM stHasMath get-  let main = render $ before' $+$ body $+$ notes $+$-                      text "" $+$ refs $+$ pics $+$ after'+  let main = render $ body $+$ notes $+$ text "" $+$ refs $+$ pics   let context = writerVariables opts ++                 [ ("body", main)                 , ("title", render title)@@ -150,6 +145,12 @@ blockToRST (Plain inlines) = do   opts <- get >>= (return . stOptions)   wrappedRST opts inlines+blockToRST (Para [Image txt (src,tit)]) = do+  capt <- inlineListToRST txt+  let fig = text "figure:: " <> text src+  let align = text ":align: center"+  let alt = text ":alt: " <> if null tit then capt else text tit+  return $ (text ".. " <> (fig $$ align $$ alt $$ text "" $$ capt)) $$ text "" blockToRST (Para inlines) = do   opts <- get >>= (return . stOptions)   contents <- wrappedRST opts inlines@@ -204,8 +205,10 @@                           map (\l -> text $ replicate l ch) widthsInChars) <>                   char ch <> char '+'   let body = vcat $ intersperse (border '-') $ map blockToDoc rows'-  return $ border '-' $+$ blockToDoc head' $+$ border '=' $+$ body $+$ -           border '-' $$ caption'' $$ text ""+  let head'' = if all null headers+                  then empty+                  else blockToDoc head' $+$ border '='+  return $ border '-' $+$ head'' $+$ body $+$ border '-' $$ caption'' $$ text "" blockToRST (BulletList items) = do   contents <- mapM bulletListItemToRST items   -- ensure that sublists have preceding blank line
src/Text/Pandoc/Writers/RTF.hs view
@@ -42,9 +42,7 @@       authorstext = map inlineListToRTF authors       datetext = inlineListToRTF date       spacer = not $ all null $ titletext : datetext : authorstext-      body = writerIncludeBefore options ++ -             concatMap (blockToRTF 0 AlignDefault) blocks ++ -             writerIncludeAfter options+      body = concatMap (blockToRTF 0 AlignDefault) blocks       context = writerVariables options ++                 [ ("body", body)                 , ("title", titletext)@@ -173,7 +171,9 @@ blockToRTF indent alignment (Header level lst) = rtfPar indent 0 alignment $   "\\b \\fs" ++ (show (40 - (level * 4))) ++ " " ++ inlineListToRTF lst blockToRTF indent alignment (Table caption aligns sizes headers rows) = -  tableRowToRTF True indent aligns sizes headers ++ +  (if all null headers+      then ""+      else tableRowToRTF True indent aligns sizes headers) ++    concatMap (tableRowToRTF False indent aligns sizes) rows ++   rtfPar indent 0 alignment (inlineListToRTF caption) 
src/Text/Pandoc/Writers/S5.hs view
@@ -44,30 +44,30 @@ import System.FilePath ( (</>) ) import Data.List ( intercalate ) -s5HeaderIncludes :: IO String-s5HeaderIncludes = do-  c <- s5CSS-  j <- s5Javascript+s5HeaderIncludes :: Maybe FilePath -> IO String+s5HeaderIncludes datadir = do+  c <- s5CSS datadir+  j <- s5Javascript datadir   return $ s5Meta ++ c ++ j  s5Meta :: String s5Meta = "<!-- configuration parameters -->\n<meta name=\"defaultView\" content=\"slideshow\" />\n<meta name=\"controlVis\" content=\"hidden\" />\n" -s5Javascript :: IO String-s5Javascript = do-  jsCom <- readDataFile $ "s5" </> "default" </> "slides.js.comment"-  jsPacked <- readDataFile $ "s5" </> "default" </> "slides.js.packed"+s5Javascript :: Maybe FilePath -> IO String+s5Javascript datadir = do+  jsCom <- readDataFile datadir $ "s5" </> "default" </> "slides.js.comment"+  jsPacked <- readDataFile datadir $ "s5" </> "default" </> "slides.js.packed"   return $ "<script type=\"text/javascript\">\n" ++ jsCom ++ jsPacked ++            "</script>\n" -s5CSS :: IO String-s5CSS = do-  s5CoreCSS <- readDataFile $ "s5" </> "default" </> "s5-core.css"-  s5FramingCSS <- readDataFile $ "s5" </> "default" </> "framing.css"-  s5PrettyCSS <- readDataFile $ "s5" </> "default" </> "pretty.css"-  s5OperaCSS <- readDataFile $ "s5" </> "default" </> "opera.css"-  s5OutlineCSS <- readDataFile $ "s5" </> "default" </> "outline.css"-  s5PrintCSS <- readDataFile $ "s5" </> "default" </> "print.css"+s5CSS :: Maybe FilePath -> IO String+s5CSS datadir = do+  s5CoreCSS <- readDataFile datadir $ "s5" </> "default" </> "s5-core.css"+  s5FramingCSS <- readDataFile datadir $ "s5" </> "default" </> "framing.css"+  s5PrettyCSS <- readDataFile datadir $ "s5" </> "default" </> "pretty.css"+  s5OperaCSS <- readDataFile datadir $ "s5" </> "default" </> "opera.css"+  s5OutlineCSS <- readDataFile datadir $ "s5" </> "default" </> "outline.css"+  s5PrintCSS <- readDataFile datadir $ "s5" </> "default" </> "print.css"   return $ "<style type=\"text/css\" media=\"projection\" id=\"slideProj\">\n" ++ s5CoreCSS ++ "\n" ++ s5FramingCSS ++ "\n" ++ s5PrettyCSS ++ "\n</style>\n<style type=\"text/css\" media=\"projection\" id=\"operaFix\">\n" ++ s5OperaCSS ++ "\n</style>\n<style type=\"text/css\" media=\"screen\" id=\"outlineStyle\">\n" ++ s5OutlineCSS ++ "\n</style>\n<style type=\"text/css\" media=\"print\" id=\"slidePrint\">\n" ++ s5PrintCSS ++ "\n</style>\n"  s5Links :: String
src/Text/Pandoc/Writers/Texinfo.hs view
@@ -69,13 +69,7 @@   let titlePage = not $ all null $ title : date : authors   main <- blockListToTexinfo blocks   st <- get-  let before = if null (writerIncludeBefore options)-                  then empty-                  else text (writerIncludeBefore options)-  let after  = if null (writerIncludeAfter options)-                  then empty-                  else text (writerIncludeAfter options)-  let body = render $ before $$ main $$ after+  let body = render main   let context = writerVariables options ++                 [ ("body", body)                 , ("title", render titleText)@@ -113,6 +107,12 @@ blockToTexinfo (Plain lst) =   inlineListToTexinfo lst +blockToTexinfo (Para [Image txt (src,tit)]) = do+  capt <- inlineListToTexinfo txt+  img  <- inlineToTexinfo (Image txt (src,tit))+  return $ text "@float" $$ img $$ (text "@caption{" <> capt <> char '}') $$+           text "@end float"+ blockToTexinfo (Para lst) =   inlineListToTexinfo lst    -- this is handled differently from Plain in blockListToTexinfo @@ -191,7 +191,9 @@     seccmd _ = error "illegal seccmd level"  blockToTexinfo (Table caption aligns widths heads rows) = do-  headers <- tableHeadToTexinfo aligns heads+  headers <- if all null heads+                then return empty+                else tableHeadToTexinfo aligns heads   captionText <- inlineListToTexinfo caption   rowsText <- mapM (tableRowToTexinfo aligns) rows   colDescriptors <-
− src/hsmarkdown.hs
@@ -1,47 +0,0 @@-{--Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu>--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU General Public License as published by-the Free Software Foundation; either version 2 of the License, or-(at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA--}--{- |-   Copyright   : Copyright (C) 2009 John MacFarlane-   License     : GNU GPL, version 2 or above--   Maintainer  : John MacFarlane <jgm@berkeley@edu>-   Stability   : alpha-   Portability : portable--Wrapper around pandoc that emulates Markdown.pl as closely as possible.--}-module Main where-import System.Process-import System.Environment ( getArgs )--- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv--- So we use System.IO.UTF8 only if we have an earlier version-#if MIN_VERSION_base(4,2,0)-#else-import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )-import System.IO.UTF8-#endif-import Control.Monad (forM_)--main :: IO ()-main = do-    files <- getArgs-    let runPandoc inp = readProcess "pandoc" ["--from", "markdown", "--to", "html", "--strict"] inp >>= putStrLn-    if null files-       then getContents >>= runPandoc-       else forM_ files $ \f -> readFile f >>= runPandoc 
src/markdown2pdf.hs view
@@ -3,7 +3,7 @@ import Data.List (isInfixOf, intercalate, isPrefixOf) import Data.Maybe (isNothing) -import Control.Monad (unless, guard, when)+import Control.Monad (unless, guard) import Control.Exception (tryJust, bracket)  import System.IO (stderr)@@ -75,6 +75,7 @@     case result of       Left (Left err) -> return $ Left err       Left (Right _) | n > 1  -> step (n-1 :: Int)+      Right _ | n > 2 -> step (n-1 :: Int)       Left (Right msg) -> return $ Left msg       Right pdfFile   -> return $ Right pdfFile @@ -201,8 +202,6 @@       Left err -> exit err       Right texFile  -> do         -- run pdflatex-        when ("--toc" `elem` opts || "--table-of-contents" `elem` opts) $-          runLatex latexProgram texFile >> return () -- toc requires extra run         latexRes <- runLatex latexProgram texFile         case latexRes of           Left err      -> exit err
src/pandoc.hs view
@@ -32,8 +32,7 @@ import Text.Pandoc import Text.Pandoc.ODT import Text.Pandoc.Writers.S5 (s5HeaderIncludes)-import Text.Pandoc.LaTeXMathML (latexMathMLScript)-import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..) )+import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile ) #ifdef _HIGHLIGHTING import Text.Pandoc.Highlighting ( languages ) #endif@@ -42,8 +41,9 @@ import System.FilePath import System.Console.GetOpt import Data.Maybe ( fromMaybe )-import Data.Char ( toLower )+import Data.Char ( toLower, isDigit ) import Data.List ( intercalate, isSuffixOf )+import System.Directory ( getAppUserDataDirectory ) import System.IO ( stdout, stderr ) -- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv -- So we use System.IO.UTF8 only if we have an earlier version@@ -57,10 +57,13 @@ import Text.CSL import Text.Pandoc.Biblio #endif-import Control.Monad (when, unless)+import Control.Monad (when, unless, liftM)+import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))+import Network.URI (parseURI, isURI)+import Data.ByteString.Lazy.UTF8 (toString)  copyrightMessage :: String-copyrightMessage = "\nCopyright (C) 2006-8 John MacFarlane\n" +++copyrightMessage = "\nCopyright (C) 2006-2010 John MacFarlane\n" ++                     "Web:  http://johnmacfarlane.net/pandoc\n" ++                     "This is free software; see the source for copying conditions.  There is no\n" ++                     "warranty, not even for merchantability or fitness for a particular purpose."@@ -119,6 +122,7 @@           ,("man"          , writeMan)           ,("markdown"     , writeMarkdown)           ,("markdown+lhs" , writeMarkdown)+          ,("plain"        , writePlain)           ,("rst"          , writeRST)           ,("rst+lhs"      , writeRST)           ,("mediawiki"    , writeMediaWiki)@@ -132,6 +136,12 @@ writeDoc :: WriterOptions -> Pandoc -> String writeDoc _ = prettyPandoc +headerShift :: Int -> Pandoc -> Pandoc+headerShift n = processWith shift+  where shift :: Block -> Block+        shift (Header level inner) = Header (level + n) inner+        shift x                    = x+ -- | Data structure for command line options. data Opt = Opt     { optTabStop           :: Int     -- ^ Number of spaces per tab@@ -141,6 +151,7 @@     , optWriter            :: String  -- ^ Writer format     , optParseRaw          :: Bool    -- ^ Parse unconvertable HTML and TeX     , optTableOfContents   :: Bool    -- ^ Include table of contents+    , optTransforms        :: [Pandoc -> Pandoc]  -- ^ Doc transforms to apply     , optTemplate          :: String  -- ^ Custom template     , optVariables         :: [(String,String)] -- ^ Template variables to set     , optBefore            :: [String] -- ^ Texts to include before body@@ -162,6 +173,7 @@     , optEmailObfuscation  :: ObfuscationMethod     , optIdentifierPrefix  :: String     , optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks+    , optDataDir           :: Maybe FilePath #ifdef _CITEPROC     , optBiblioFile        :: String     , optBiblioFormat      :: String@@ -179,6 +191,7 @@     , optWriter            = ""    -- null for default writer     , optParseRaw          = False     , optTableOfContents   = False+    , optTransforms        = []     , optTemplate          = ""     , optVariables         = []     , optBefore            = []@@ -200,6 +213,7 @@     , optEmailObfuscation  = JavascriptObfuscation     , optIdentifierPrefix  = ""     , optIndentedCodeClasses = []+    , optDataDir           = Nothing #ifdef _CITEPROC     , optBiblioFile        = []     , optBiblioFormat      = []@@ -272,6 +286,13 @@                   "URL")                  "" -- "Use LaTeXMathML script in html output" +    , Option "" ["mathml"]+                 (OptArg+                  (\arg opt ->+                      return opt { optHTMLMathMethod = MathML arg })+                   "URL")+                 "" -- "Use mathml for HTML math"+     , Option "" ["mimetex"]                  (OptArg                   (\arg opt -> return opt { optHTMLMathMethod = MimeTeX@@ -346,6 +367,21 @@                  (\opt -> return opt { optTableOfContents = True }))                "" -- "Include table of contents" +    , Option "" ["base-header-level"]+                 (ReqArg+                  (\arg opt -> do+                     if all isDigit arg && (read arg :: Int) >= 1+                        then do+                           let oldTransforms = optTransforms opt+                           let shift = read arg - 1+                           return opt{ optTransforms =+                                         headerShift shift : oldTransforms }+                        else do+                           hPutStrLn stderr $ "base-header-level must be a number >= 1"+                           exitWith $ ExitFailure 19)+                  "LEVEL")+                 "" -- "Headers base level"+     , Option "" ["template"]                  (ReqArg                   (\arg opt -> do@@ -393,9 +429,10 @@                  (ReqArg                   (\arg opt -> do                      text <- readFile arg-                     let oldBefore = optBefore opt-                     -- add new text to end, so it is included in proper order-                     return opt { optBefore =  oldBefore ++ [text] })+                     -- add new ones to end, so they're included in order specified+                     let newvars = optVariables opt ++ [("include-before",text)]+                     return opt { optVariables = newvars,+                                  optStandalone = True })                   "FILENAME")                  "" -- "File to include before document body" @@ -403,9 +440,10 @@                  (ReqArg                   (\arg opt -> do                      text <- readFile arg-                     let oldAfter = optAfter opt-                     -- add new text to end, so it is included in proper order-                     return opt { optAfter = oldAfter ++ [text]})+                     -- add new ones to end, so they're included in order specified+                     let newvars = optVariables opt ++ [("include-after",text)]+                     return opt { optVariables = newvars,+                                  optStandalone = True })                   "FILENAME")                  "" -- "File to include after document body" @@ -438,7 +476,7 @@     , Option "D" ["print-default-template"]                  (ReqArg                   (\arg _ -> do-                     templ <- getDefaultTemplate arg+                     templ <- getDefaultTemplate Nothing arg                      case templ of                           Right t -> hPutStr stdout t                           Left e  -> error $ show e@@ -462,6 +500,12 @@                   "FILENAME")                  "" #endif+    , Option "" ["data-dir"]+                 (ReqArg+                  (\arg opt -> return opt { optDataDir = Just arg })+                 "DIRECTORY") -- "Directory containing pandoc data files."+                ""+     , Option "" ["dump-args"]                  (NoArg                   (\opt -> return opt { optDumpArgs = True }))@@ -498,9 +542,9 @@   (intercalate ", " $ map fst writers) ++ "\nOptions:")  -- Determine default reader based on source file extensions-defaultReaderName :: [FilePath] -> String-defaultReaderName [] = "markdown"-defaultReaderName (x:xs) =+defaultReaderName :: String -> [FilePath] -> String+defaultReaderName fallback [] = fallback+defaultReaderName fallback (x:xs) =   case takeExtension (map toLower x) of     ".xhtml"    -> "html"     ".html"     -> "html"@@ -511,7 +555,7 @@     ".rst"      -> "rst"     ".lhs"      -> "markdown+lhs"     ".native"   -> "native"-    _           -> defaultReaderName xs+    _           -> defaultReaderName fallback xs  -- Returns True if extension of first source is .lhs lhsExtension :: [FilePath] -> Bool@@ -581,6 +625,7 @@               , optBefore            = befores               , optAfter             = afters               , optTableOfContents   = toc+              , optTransforms        = transforms               , optTemplate          = template               , optOutputFile        = outputFile               , optNumberSections    = numberSections@@ -598,6 +643,7 @@               , optEmailObfuscation  = obfuscationMethod               , optIdentifierPrefix  = idPrefix               , optIndentedCodeClasses = codeBlockClasses+              , optDataDir           = mbDataDir #ifdef _CITEPROC               , optBiblioFile         = biblioFile               , optBiblioFormat       = biblioFormat@@ -619,9 +665,18 @@    let sources = if ignoreArgs then [] else args +  datadir <- case mbDataDir of+                  Nothing   -> catch+                                 (liftM Just $ getAppUserDataDirectory "pandoc")+                                 (const $ return Nothing)+                  Just _    -> return mbDataDir+   -- assign reader and writer based on options and filenames   let readerName' = if null readerName-                      then defaultReaderName sources+                      then let fallback = if any isURI sources+                                             then "html"+                                             else "markdown"+                           in  defaultReaderName fallback sources                       else readerName     let writerName' = if null writerName@@ -636,7 +691,7 @@      Just r  -> return r      Nothing -> error ("Unknown writer: " ++ writerName') -  templ <- getDefaultTemplate writerName'+  templ <- getDefaultTemplate datadir writerName'   let defaultTemplate = case templ of                              Right t -> t                              Left  e -> error (show e)@@ -654,14 +709,17 @@    variables' <- if writerName' == "s5" && standalone'                    then do-                     inc <- s5HeaderIncludes+                     inc <- s5HeaderIncludes datadir                      return $ ("header-includes", inc) : variables                    else return variables    variables'' <- case mathMethod of                       LaTeXMathML Nothing -> do-                         s <- latexMathMLScript-                         return $ ("latexmathml-script", s) : variables'+                         s <- readDataFile datadir $ "data" </> "LaTeXMathML.js"+                         return $ ("mathml-script", s) : variables'+                      MathML Nothing -> do+                         s <- readDataFile datadir $ "data"</>"MathMLinHTML.js"+                         return $ ("mathml-script", s) : variables'                       _ -> return variables'    let startParserState =@@ -717,23 +775,29 @@   let readSources [] = mapM readSource ["-"]       readSources srcs = mapM readSource srcs       readSource "-" = getContents-      readSource src = readFile src+      readSource src = case parseURI src of+                            Just u  -> readURI u+                            Nothing -> readFile src+      readURI uri = simpleHTTP (mkRequest GET uri) >>= getResponseBody >>=+                      return . toString  -- treat all as UTF8    let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)    doc <- fmap (reader startParserState . convertTabs . intercalate "\n") (readSources sources) -  doc' <- do+  let doc' = foldr ($) doc transforms++  doc'' <- do #ifdef _CITEPROC-          processBiblio cslFile refs doc+          processBiblio cslFile refs doc' #else-          return doc+          return doc' #endif -  let writerOutput = writer writerOptions doc' ++ "\n"- +  let writerOutput = writer writerOptions doc'' ++ "\n"+   case writerName' of-       "odt"   -> saveOpenDocumentAsODT outputFile sourceDirRelative referenceODT writerOutput+       "odt"   -> saveOpenDocumentAsODT datadir outputFile sourceDirRelative referenceODT writerOutput        _       -> if outputFile == "-"                      then putStr writerOutput                      else writeFile outputFile writerOutput
templates/context.template view
@@ -17,24 +17,6 @@ \setuphead[subsection][style=\tfb] \setuphead[subsubsection][style=\bf] -% define title block commands-\unprotect-\def\doctitle#1{\gdef\@title{#1}}-\def\author#1{\gdef\@author{#1}}-\def\date#1{\gdef\@date{#1}}-\date{\currentdate}  % Default to today unless specified otherwise.-\def\maketitle{%-  \startalignment[center]-    \blank[2*big]-      {\tfd \@title}-    \blank[3*medium]-      {\tfa \@author}-    \blank[2*medium]-      {\tfa \@date}-    \blank[3*medium]-  \stopalignment}-\protect- % define descr (for definition lists) \definedescription[descr][   headstyle=bold,style=normal,align=left,location=hanging,@@ -75,19 +57,32 @@ $header-includes$ $endfor$ +\starttext $if(title)$-\doctitle{$title$}+\startalignment[center]+  \blank[2*big]+  {\tfd $title$}+$if(author)$+  \blank[3*medium]+  {\tfa $for(author)$$author$$sep$\crlf $endfor$} $endif$-\author{$for(author)$$author$$sep$\\$endfor$} $if(date)$-\date{$date$}+  \blank[2*medium]+  {\tfa $date$} $endif$-\starttext-\maketitle+  \blank[3*medium]+\stopalignment+$endif$+$for(include-before)$+$include-before$+$endfor$ $if(toc)$ \placecontent $endif$  $body$ +$for(include-after)$+$include-after$+$endfor$ \stoptext
templates/docbook.template view
@@ -17,6 +17,12 @@     <date>$date$</date> $endif$   </articleinfo>+$for(include-before)$+$include-before$+$endfor$ $body$+$for(include-after)$+$include-after$+$endfor$ </article> 
templates/html.template view
@@ -33,20 +33,26 @@ $for(css)$   <link rel="stylesheet" href="$css$" type="text/css" /> $endfor$+$if(math)$+  $math$+$endif$ $for(header-includes)$   $header-includes$ $endfor$-$if(latexmathml-script)$-  $latexmathml-script$-$endif$ </head> <body> $if(title)$ <h1 class="title">$title$</h1> $endif$+$for(include-before)$+$include-before$+$endfor$ $if(toc)$ $toc$ $endif$ $body$+$for(include-after)$+$include-after$+$endfor$ </body> </html>
templates/latex.template view
@@ -20,13 +20,17 @@ \usepackage{listings} \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} $endif$-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt} $endif$ $if(verbatim-in-note)$ \usepackage{fancyvrb} $endif$ $if(fancy-enums)$+% Redefine labelwidth for lists; otherwise, the enumerate package will cause+% markers to extend beyond the left margin.+\makeatletter\AtBeginDocument{%+  \renewcommand{\@listi}+    {\setlength{\labelwidth}{4em}}+}\makeatother \usepackage{enumerate} $endif$ $if(tables)$@@ -41,15 +45,15 @@ $if(subscript)$ \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}} $endif$-$if(links)$-\usepackage[breaklinks=true]{hyperref}-$endif$ $if(url)$ \usepackage{url} $endif$ $if(graphics)$ \usepackage{graphicx} $endif$+\usepackage[breaklinks=true,unicode=true]{hyperref}+\setlength{\parindent}{0pt}+\setlength{\parskip}{6pt plus 2pt minus 1pt} $if(numbersections)$ $else$ \setcounter{secnumdepth}{0}@@ -64,7 +68,9 @@ $if(title)$ \title{$title$} $endif$+$if(author)$ \author{$for(author)$$author$$sep$\\$endfor$}+$endif$ $if(date)$ \date{$date$} $endif$@@ -74,10 +80,18 @@ \maketitle $endif$ +$for(include-before)$+$include-before$++$endfor$ $if(toc)$ \tableofcontents  $endif$ $body$+$for(include-after)$++$include-after$+$endfor$  \end{document}
templates/man.template view
@@ -5,7 +5,13 @@ $for(header-includes)$ $header-includes$ $endfor$+$for(include-before)$+$include-before$+$endfor$ $body$+$for(include-after)$+$include-after$+$endfor$ $if(author)$ .SH AUTHORS $for(author)$$author$$sep$; $endfor$.
templates/markdown.template view
@@ -8,8 +8,16 @@ $header-includes$  $endfor$+$for(include-before)$+$include-before$++$endfor$ $if(toc)$ $toc$  $endif$ $body$+$for(include-after)$++$include-after$+$endfor$
templates/mediawiki.template view
@@ -1,8 +1,16 @@ $if(legacy-header)$ $legacy-header$ $endif$+$for(include-before)$+$include-before$++$endfor$ $if(toc)$ __TOC__  $endif$ $body$+$for(include-after)$++$include-after$+$endfor$
templates/opendocument.template view
@@ -15,7 +15,13 @@ $if(date)$ <text:p text:style-name="Date">$date$</text:p> $endif$+$for(include-before)$+$include-before$+$endfor$ $body$+$for(include-after)$+$include-after$+$endfor$ </office:text> </office:body> </office:document-content>
+ templates/plain.template view
@@ -0,0 +1,23 @@+$if(titleblock)$+$title$+$for(author)$$author$$sep$; $endfor$+$date$++$endif$+$for(header-includes)$+$header-includes$++$endfor$+$for(include-before)$+$include-before$++$endfor$+$if(toc)$+$toc$++$endif$+$body$+$for(include-after)$++$include-after$+$endfor$
templates/rst.template view
@@ -20,6 +20,10 @@    :format: html latex  $endif$+$for(include-before)$+$include-before$++$endfor$ $if(toc)$ .. contents:: @@ -29,3 +33,7 @@  $endfor$ $body$+$for(include-after)$++$include-after$+$endfor$
templates/rtf.template view
@@ -21,5 +21,11 @@ $if(spacer)$ {\pard \ql \f0 \sa180 \li0 \fi0 \par} $endif$+$for(include-before)$+$include-before$+$endfor$ $body$+$for(include-after)$+$include-after$+$endfor$ }
templates/texinfo.template view
@@ -51,10 +51,18 @@ @end titlepage  $endif$+$for(include-before)$+$include-before$++$endfor$ $if(toc)$ @contents  $endif$ $body$+$for(include-after)$++$include-after$+$endfor$  @bye
tests/RunTests.hs view
@@ -52,6 +52,7 @@                 , "context"                 , "texinfo"                 , "man"+                , "plain"                 , "markdown"                 , "rst"                 , "mediawiki"@@ -93,6 +94,8 @@              "markdown-reader-more.txt" "markdown-reader-more.native"   r8 <- runTest "rst reader" ["-r", "rst", "-w", "native", "-s", "-S"]              "rst-reader.rst" "rst-reader.native"+  r8a <- runTest "rst reader (tables)" ["-r", "rst", "-w", "native"]+             "tables.rst" "tables-rstsubset.native"   r9 <- runTest "html reader" ["-r", "html", "-w", "native", "-s"]              "html-reader.html" "html-reader.native"   r10 <- runTest "latex reader" ["-r", "latex", "-w", "native", "-s", "-R"]@@ -105,7 +108,14 @@   r13s <- if runLhsTests              then mapM runLhsReaderTest lhsReaderFormats              else putStrLn "Skipping lhs reader tests because they presuppose highlighting support" >> return []-  let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11] ++ r12s ++ r13s+  let results = r1s +++                [ r2, r3, r4, r5 -- S5+                , r6, r7, r7a    -- markdown reader+                , r8, r8a        -- rst+                , r9             -- html+                , r10            -- latex+                , r11            -- native+                ] ++ r12s ++ r13s   if all id results      then do        putStrLn "\nAll tests passed."@@ -150,9 +160,9 @@   let inpPath = inp   let normPath = norm   hFlush stdout-  env <- getEnvironment  -- we need at least HOME so pandoc can find data files   -- Note: COLUMNS must be set for markdown table reader-  ph <- runProcess pandocPath (opts ++ [inpPath]) Nothing (Just (("COLUMNS", "80"):env)) Nothing (Just hOut) (Just stderr)+  -- and we need LANG set for ghc 6.12+  ph <- runProcess pandocPath (opts ++ [inpPath] ++ ["--data-dir", ".."]) Nothing (Just [("COLUMNS", "80"),("LANG","en_US.UTF-8")]) Nothing (Just hOut) (Just stderr)   ec <- waitForProcess ph   result  <- if ec == ExitSuccess                 then do
tests/html-reader.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] [] [])+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [], docDate = []}) [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."] , HorizontalRule , Header 1 [Str "Headers"]
tests/latex-reader.latex view
@@ -5,7 +5,7 @@ \setlength{\parskip}{6pt plus 2pt minus 1pt}  \newcommand{\textsubscript}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}-\usepackage[breaklinks=true]{hyperref}+\usepackage[breaklinks=true,unicode=true]{hyperref} \usepackage[normalem]{ulem} \usepackage{enumerate} \usepackage{fancyvrb}@@ -35,7 +35,7 @@  Level 5 -\section{Level 1}+\section[alt title ignored]{Level 1}  \subsection{Level 2 with \emph{emphasis}} 
tests/latex-reader.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]] [Str "July",Space,Str "17,",Space,Str "2006"])+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]}) [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite."] , HorizontalRule , Header 1 [Str "Headers"]
tests/lhs-test.latex view
@@ -2,11 +2,11 @@ \usepackage{amsmath} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc}+\usepackage[breaklinks=true,unicode=true]{hyperref} \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setcounter{secnumdepth}{0} -\author{}  \begin{document} 
tests/lhs-test.latex+lhs view
@@ -4,11 +4,11 @@ \usepackage[utf8x]{inputenc} \usepackage{listings} \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}+\usepackage[breaklinks=true,unicode=true]{hyperref} \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setcounter{secnumdepth}{0} -\author{}  \begin{document} 
tests/lhs-test.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [] [] [])+Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) [ Header 1 [Str "lhs",Space,Str "test"] , Para [Code "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"] , CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry       \n          -- arr (\\op (x,y) -> x `op` y) "
tests/markdown-reader-more.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [] [] [])+Pandoc (Meta {docTitle = [Str "Title",Space,Str "spanning",Space,Str "multiple",Space,Str "lines"], docAuthors = [[Str "Author",Space,Str "One"],[Str "Author",Space,Str "Two"],[Str "Author",Space,Str "Three"],[Str "Author",Space,Str "Four"]], docDate = []}) [ Header 1 [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"] , Header 2 [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"] , Para [Link [Str "foo"] ("/url",""),Space,Str "and",Space,Link [Str "bar"] ("/url","title")]@@ -6,8 +6,8 @@ , Para [TeX "\\placeformula",Space,TeX "\\startformula\n   L_{1} = L_{2}\n   \\stopformula"] , Para [TeX "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"] , Header 2 [Str "URLs",Space,Str "with",Space,Str "spaces"]-, Para [Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("/bar+and+baz",""),Space,Link [Str "foo"] ("bar+baz","title")]-, Para [Link [Str "baz"] ("/foo+foo",""),Space,Link [Str "bam"] ("/foo+fee",""),Space,Link [Str "bork"] ("/foo/zee+zob","title")]+, Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20%20and%20%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]+, Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")] , Header 2 [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"] , HorizontalRule , HorizontalRule@@ -21,5 +21,11 @@   [ [ Plain [Str "one"]     , RawHtml "<!--\n- two\n-->" ], [ Plain [Str "three"] ] ] , Header 2 [Str "Backslash",Space,Str "newline"]-, Para [Str "hi",LineBreak,Str "there"] ]+, Para [Str "hi",LineBreak,Str "there"]+, Header 2 [Str "Code",Space,Str "spans"]+, Para [Code "hi\\"]+, Para [Code "hi there"]+, Para [Code "hi````there"]+, Para [Str "`",Str "hi"]+, Para [Str "there",Str "`"] ] 
tests/markdown-reader-more.txt view
@@ -1,3 +1,9 @@+% Title+  spanning multiple lines+% Author One+  Author Two; Author Three;+  Author Four+  # Additional markdown reader tests  ## Blank line before URL in link reference@@ -63,4 +69,17 @@  hi\ there++## Code spans++`hi\`++`hi+there`++`` hi````there ``++`hi++there` 
tests/rst-reader.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str "Subtitle"] [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]] [Str "July",Space,Str "17,",Space,Str "2006"])+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str "Subtitle"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]}) [ DefinitionList   [ ([Str "Revision"],      [ [ Plain [Str "3"] ]@@ -243,5 +243,70 @@ , Para [Str "A",Space,Str "third",Space,Str "paragraph"] , Header 1 [Str "Line",Space,Str "blocks"] , Para [Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be",LineBreak,Str "    ",Str "or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,",LineBreak,Str "        ",Str "when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,",LineBreak,Str "            ",Str "due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]-, Para [Str "Continuation",Space,Str "line",LineBreak,Str "  ",Str "and",Space,Str "another"] ]+, Para [Str "Continuation",Space,Str "line",LineBreak,Str "  ",Str "and",Space,Str "another"]+, Header 1 [Str "Simple",Space,Str "Tables"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]+  [ [ Plain [Str "col",Space,Str "1"] ]+  , [ Plain [Str "col",Space,Str "2"] ]+  , [ Plain [Str "col",Space,Str "3"] ] ] [+  [ [ Plain [Str "r1",Space,Str "a"] ]+  , [ Plain [Str "b"] ]+  , [ Plain [Str "c"] ] ],+  [ [ Plain [Str "r2",Space,Str "d"] ]+  , [ Plain [Str "e"] ]+  , [ Plain [Str "f"] ] ] ]+, Para [Str "Headless"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]+  [   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "r1",Space,Str "a"] ]+  , [ Plain [Str "b"] ]+  , [ Plain [Str "c"] ] ],+  [ [ Plain [Str "r2",Space,Str "d"] ]+  , [ Plain [Str "e"] ]+  , [ Plain [Str "f"] ] ] ]+, Header 1 [Str "Grid",Space,Str "Tables"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2375,0.15,0.1625]+  [ [ Plain [Str "col",Space,Str "1"] ]+  , [ Plain [Str "col",Space,Str "2"] ]+  , [ Plain [Str "col",Space,Str "3"] ] ] [+  [ [ Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"] ]+  , [ Plain [Str "b",Space,Str "b",Space,Str "2"] ]+  , [ Plain [Str "c",Space,Str "c",Space,Str "2"] ] ],+  [ [ Plain [Str "r2",Space,Str "d"] ]+  , [ Plain [Str "e"] ]+  , [ Plain [Str "f"] ] ] ]+, Para [Str "Headless"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2375,0.15,0.1625]+  [   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"] ]+  , [ Plain [Str "b",Space,Str "b",Space,Str "2"] ]+  , [ Plain [Str "c",Space,Str "c",Space,Str "2"] ] ],+  [ [ Plain [Str "r2",Space,Str "d"] ]+  , [ Plain [Str "e"] ]+  , [ Plain [Str "f"] ] ] ]+, Para [Str "Spaces",Space,Str "at",Space,Str "ends",Space,Str "of",Space,Str "lines"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2375,0.15,0.1625]+  [   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "r1",Space,Str "a",Space,Str "r1",Space,Str "bis"] ]+  , [ Plain [Str "b",Space,Str "b",Space,Str "2"] ]+  , [ Plain [Str "c",Space,Str "c",Space,Str "2"] ] ],+  [ [ Plain [Str "r2",Space,Str "d"] ]+  , [ Plain [Str "e"] ]+  , [ Plain [Str "f"] ] ] ]+, Para [Str "Multiple",Space,Str "blocks",Space,Str "in",Space,Str "a",Space,Str "cell"]+, Table [] [AlignDefault,AlignDefault,AlignDefault] [0.2375,0.15,0.1625]+  [   []+  ,   []+  ,   [] ] [+  [ [ Para [Str "r1",Space,Str "a"]+    , Para [Str "r1",Space,Str "bis"] ], [ BulletList+      [ [ Plain [Str "b"] ]+      , [ Plain [Str "b",Space,Str "2"] ]+      , [ Plain [Str "b",Space,Str "2"] ] ] ], [ Plain [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"] ] ] ] ] 
tests/rst-reader.rst view
@@ -453,3 +453,58 @@ |   and        another +Simple Tables+=============++==================  ===========  ==========+col 1               col 2        col 3 +==================  ===========  ==========+r1 a                b            c+r2 d                e            f+==================  ===========  ==========++Headless++==================  ===========  ==========+r1 a                b            c+r2 d                e            f+==================  ===========  ==========+++Grid Tables+===========+++------------------+-----------+------------++| col 1            | col 2     | col 3      |++==================+===========+============++| r1 a             | b         | c          |+| r1 bis           | b 2       | c 2        |++------------------+-----------+------------++| r2 d             | e         | f          |++------------------+-----------+------------+++Headless+++------------------+-----------+------------++| r1 a             | b         | c          |+| r1 bis           | b 2       | c 2        |++------------------+-----------+------------++| r2 d             | e         | f          |++------------------+-----------+------------+++Spaces at ends of lines+++------------------+-----------+------------+  +| r1 a             | b         | c          |+| r1 bis           | b 2       | c 2        | ++------------------+-----------+------------++| r2 d             | e         | f          |++------------------+-----------+------------+++Multiple blocks in a cell+++------------------+-----------+------------+  +| r1 a             | - b       | c          |+|                  | - b 2     | c 2        | +| r1 bis           | - b 2     | c 2        | ++------------------+-----------+------------+
tests/s5.fancy.html view
@@ -7,6 +7,207 @@   <meta name="author" content="Sam Smith" />   <meta name="author" content="Jen Jones" />   <meta name="date" content="July 15, 2006" />+  <script type="text/javascript"+  >/*+  LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/+  Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,+  (c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.+  Released under the GNU General Public License version 2 or later.+  See the GNU General Public License (at http://www.gnu.org/copyleft/gpl.html)+  for more details.+  */+  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)+  alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")+  function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}+  function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")+  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;}+  function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")+  if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")+  try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}+  else return AMnoMathMLNote();}+  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+  else return-1;}+  var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}+  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);}+  function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}+  function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}+  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);}+  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;}+  return h;}else+  for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}+  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;}+  more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}+  AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}+  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};}+  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)+  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)+  return[null,str,null];}+  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);}}+  return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")+  output="\u2032";else if(symbol.input=="''")+  output="\u2033";else if(symbol.input=="'''")+  output="\u2033\u2032";else if(symbol.input=="''''")+  output="\u2033\u2033";else if(symbol.input=="\\square")+  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];}}}+  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")+  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");}+  node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)+  return[node,str,symbol.rtag];else+  return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)+  atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)+  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);}+  return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")+  symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+  result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))+  node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}+  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)+  mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")+  mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")+  mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}+  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)+  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)+  node.setAttribute("columnspacing","0.25em");else+  node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}+  case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)+  i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+  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);}+  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);}+  node.appendChild(result[0]);return[node,result[1],symbol.tag];}}+  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])+  node.appendChild(space);return[node,result[1],symbol.tag];}else+  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")+  output="\u0302";else if(symbol.input=="\\widehat")+  output="\u005E";else if(symbol.input=="\\bar")+  output="\u00AF";else if(symbol.input=="\\grave")+  output="\u0300";else if(symbol.input=="\\tilde")+  output="\u0303";}+  var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")+  node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")+  node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")+  node1.setAttribute("accentunder","true");else+  node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")+  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++)+  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++)+  if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst++  String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")+  result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}+  node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")+  node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}+  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];}+  node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}+  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];}}+  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)+  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]);}+  node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")+  node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")+  node=AMcreateMmlNode("mfenced",node);}}+  return[node,str,tag];}+  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);}+  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==".")+  symbol.invisible=true;if(symbol!=null)+  tag=symbol.rtag;}+  if(symbol!=null)+  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++)+  if(node.childNodes[j].firstChild.nodeValue=="&")+  pos[i][pos[i].length]=j;}+  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);}+  row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}+  table.appendChild(AMcreateMmlNode("mtr",row));}+  return[table,str];}+  if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}+  return[newFrag,str,tag];}+  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];}+  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)+  node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}+  return node;}+  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])));}}+  expr=!expr;}+  return newFrag;}+  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++)+  arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)+  if(alertIfNoMathML)+  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]);}+  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++)+  i+=AMprocessNodeR(n.childNodes[i],linebreaks);}+  return 0;}+  function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")+  for(var i=0;i<frag.length;i++)+  if(frag[i].className=="AM")+  AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}+  if(st==null||st.indexOf("\$")!=-1)+  AMprocessNodeR(n,linebreaks);}+  if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}+  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)))+  {for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}+  else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))+  {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]*$/,"")+  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;}+  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);}+  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);}+  DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}+  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," ");}+  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\\] \\[ ");}+  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]+\}/);}+  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]+\}/);}+  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]+\}/);}+  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';}+  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}}}+  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];}+  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*\}/);}+  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);}+  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}}}+  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];}+  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);}+  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);}+  TABtbody.appendChild(TABrow);}+  nodeTmp.appendChild(TABtbody);}+  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);}+  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+"]"));}+  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);}+  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);}}+  if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}+  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\\]|");}}+  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;}}+  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;}+  if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}+  else{tmpIndex=-1};TagIndex+=tmpIndex;}+  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]))+  newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}+  return TheBody;}+  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;}}+  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=""}+  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);}}+  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;}}}+  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");}+  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);}+  if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}+  RootNode.appendChild(DIV2LI)}+  AllDivs[i].removeChild(AllDivs[i].firstChild);}+  AllDivs[i].appendChild(RootNode);}}+  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"+  refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}+  return TheBody;}+  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");}+  if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}+  PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}+  AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+  AMprocessNode(AMbody,false,spanclassAM);}}}+  if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}+  function generic()+  {translate();};if(typeof window.addEventListener!='undefined')+  {window.addEventListener('load',generic,false);}+  else if(typeof document.addEventListener!='undefined')+  {document.addEventListener('load',generic,false);}+  else if(typeof window.attachEvent!='undefined')+  {window.attachEvent('onload',generic);}+  else+  {if(typeof window.onload=='function')+  {var existing=onload;window.onload=function()+  {existing();generic();};}+  else+  {window.onload=generic;}}+  </script+  >   <!-- configuration parameters -->   <meta name="defaultView" content="slideshow" />   <meta name="controlVis" content="hidden" />@@ -267,215 +468,6 @@   createControls();slideLabel();fixLinks();externalLinks();fontScale();if(!isOp){notOperaFix();incrementals=createIncrementals();slideJump();if(defaultView=='outline'){toggle();}   document.onkeyup=keys;document.onkeypress=trap;document.onclick=clicker;}}   window.onload=startup;window.onresize=function(){setTimeout('fontScale()',50);}-  </script>-  <script type="text/javascript">-  /*-  LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/-  Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,-  (c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.-  -  This program is free software; you can redistribute it and/or modify-  it under the terms of the GNU General Public License as published by-  the Free Software Foundation; either version 2 of the License, or (at-  your option) any later version.-  -  This program is distributed in the hope that it will be useful,-  but WITHOUT ANY WARRANTY; without even the implied warranty of-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-  General Public License (at http://www.gnu.org/copyleft/gpl.html)-  for more details.-  */-  -  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)-  alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")-  function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}-  function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")-  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;}-  function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")-  if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")-  try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}-  else return AMnoMathMLNote();}-  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-  else return-1;}-  var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}-  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);}-  function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}-  function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}-  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);}-  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;}-  return h;}else-  for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}-  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;}-  more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}-  AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}-  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};}-  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)-  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)-  return[null,str,null];}-  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);}}-  return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")-  output="\u2032";else if(symbol.input=="''")-  output="\u2033";else if(symbol.input=="'''")-  output="\u2033\u2032";else if(symbol.input=="''''")-  output="\u2033\u2033";else if(symbol.input=="\\square")-  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];}}}-  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")-  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");}-  node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)-  return[node,str,symbol.rtag];else-  return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)-  atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)-  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);}-  return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")-  symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}-  result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))-  node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}-  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)-  mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")-  mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")-  mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}-  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)-  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)-  node.setAttribute("columnspacing","0.25em");else-  node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}-  case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)-  i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}-  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);}-  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);}-  node.appendChild(result[0]);return[node,result[1],symbol.tag];}}-  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])-  node.appendChild(space);return[node,result[1],symbol.tag];}else-  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")-  output="\u0302";else if(symbol.input=="\\widehat")-  output="\u005E";else if(symbol.input=="\\bar")-  output="\u00AF";else if(symbol.input=="\\grave")-  output="\u0300";else if(symbol.input=="\\tilde")-  output="\u0303";}-  var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")-  node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")-  node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")-  node1.setAttribute("accentunder","true");else-  node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")-  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++)-  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++)-  if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst+-  String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")-  result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}-  node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")-  node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}-  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];}-  node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}-  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];}}-  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)-  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]);}-  node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")-  node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")-  node=AMcreateMmlNode("mfenced",node);}}-  return[node,str,tag];}-  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);}-  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==".")-  symbol.invisible=true;if(symbol!=null)-  tag=symbol.rtag;}-  if(symbol!=null)-  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++)-  if(node.childNodes[j].firstChild.nodeValue=="&")-  pos[i][pos[i].length]=j;}-  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);}-  row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}-  table.appendChild(AMcreateMmlNode("mtr",row));}-  return[table,str];}-  if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}-  return[newFrag,str,tag];}-  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];}-  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)-  node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}-  return node;}-  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])));}}-  expr=!expr;}-  return newFrag;}-  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++)-  arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&&notifyIfNoMathML)-  if(alertIfNoMathML)-  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]);}-  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++)-  i+=AMprocessNodeR(n.childNodes[i],linebreaks);}-  return 0;}-  function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")-  for(var i=0;i<frag.length;i++)-  if(frag[i].className=="AM")-  AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}-  if(st==null||st.indexOf("\$")!=-1)-  AMprocessNodeR(n,linebreaks);}-  if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}-  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)))-  {for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}-  else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))-  {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]*$/,"")-  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;}-  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);}-  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);}-  DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}-  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," ");}-  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\\] \\[ ");}-  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]+\}/);}-  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]+\}/);}-  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]+\}/);}-  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';}-  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}}}-  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];}-  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*\}/);}-  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);}-  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}}}-  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];}-  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);}-  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);}-  TABtbody.appendChild(TABrow);}-  nodeTmp.appendChild(TABtbody);}-  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);}-  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+"]"));}-  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);}-  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);}}-  if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}-  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\\]|");}}-  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;}}-  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;}-  if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}-  else{tmpIndex=-1};TagIndex+=tmpIndex;}-  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]))-  newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}-  return TheBody;}-  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;}}-  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=""}-  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);}}-  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;}}}-  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");}-  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);}-  if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}-  RootNode.appendChild(DIV2LI)}-  AllDivs[i].removeChild(AllDivs[i].firstChild);}-  AllDivs[i].appendChild(RootNode);}}-  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"-  refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}-  return TheBody;}-  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");}-  if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}-  PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}-  AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}-  AMprocessNode(AMbody,false,spanclassAM);}}}-  if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}-  function generic()-  {translate();};if(typeof window.addEventListener!='undefined')-  {window.addEventListener('load',generic,false);}-  else if(typeof document.addEventListener!='undefined')-  {document.addEventListener('load',generic,false);}-  else if(typeof window.attachEvent!='undefined')-  {window.attachEvent('onload',generic);}-  else-  {if(typeof window.onload=='function')-  {var existing=onload;window.onload=function()-  {existing();generic();};}-  else-  {window.onload=generic;}}   </script> </head> <body>
tests/s5.inserts.html view
@@ -57,7 +57,8 @@       ></li     ></ul   ></div->STUFF INSERTED+>+STUFF INSERTED </body> </html> 
tests/s5.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "My",Space,Str "S5",Space,Str "Document"] [[Str "Sam",Space,Str "Smith"],[Str "Jen",Space,Str "Jones"]] [Str "July",Space,Str "15,",Space,Str "2006"])+Pandoc (Meta {docTitle = [Str "My",Space,Str "S5",Space,Str "Document"], docAuthors = [[Str "Sam",Space,Str "Smith"],[Str "Jen",Space,Str "Jones"]], docDate = [Str "July",Space,Str "15,",Space,Str "2006"]}) [ Header 1 [Str "First",Space,Str "slide"] , BulletList   [ [ Plain [Str "first",Space,Str "bullet"] ]
+ tests/tables-rstsubset.native view
@@ -0,0 +1,119 @@+Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})+[ Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]+  [ [ Plain [Str "Right"] ]+  , [ Plain [Str "Left"] ]+  , [ Plain [Str "Center"] ]+  , [ Plain [Str "Default"] ] ] [+  [ [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ] ],+  [ [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ] ],+  [ [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ] ] ]+, Para [Str "Table",Str ":",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]+, Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]+  [ [ Plain [Str "Right"] ]+  , [ Plain [Str "Left"] ]+  , [ Plain [Str "Center"] ]+  , [ Plain [Str "Default"] ] ] [+  [ [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ] ],+  [ [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ] ],+  [ [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ] ] ]+, Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]+  [ [ Plain [Str "Right"] ]+  , [ Plain [Str "Left"] ]+  , [ Plain [Str "Center"] ]+  , [ Plain [Str "Default"] ] ] [+  [ [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ] ],+  [ [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ] ],+  [ [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ] ] ]+, Para [Str "Table",Str ":",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]+, Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]+  [ [ Plain [Str "Centered",Space,Str "Header"] ]+  , [ Plain [Str "Left",Space,Str "Aligned"] ]+  , [ Plain [Str "Right",Space,Str "Aligned"] ]+  , [ Plain [Str "Default",Space,Str "aligned"] ] ] [+  [ [ Plain [Str "First"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "12.0"] ]+  , [ Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."] ] ],+  [ [ Plain [Str "Second"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "5.0"] ]+  , [ Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."] ] ] ]+, Para [Str "Table",Str ":",Space,Str "Here's",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]+, Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]+  [ [ Plain [Str "Centered",Space,Str "Header"] ]+  , [ Plain [Str "Left",Space,Str "Aligned"] ]+  , [ Plain [Str "Right",Space,Str "Aligned"] ]+  , [ Plain [Str "Default",Space,Str "aligned"] ] ] [+  [ [ Plain [Str "First"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "12.0"] ]+  , [ Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."] ] ],+  [ [ Plain [Str "Second"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "5.0"] ]+  , [ Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."] ] ] ]+, Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]+  [   []+  ,   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ] ],+  [ [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ] ],+  [ [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ] ] ]+, Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]+, Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]+  [   []+  ,   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "First"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "12.0"] ]+  , [ Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."] ] ],+  [ [ Plain [Str "Second"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "5.0"] ]+  , [ Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."] ] ] ] ]+
tests/tables.context view
@@ -132,3 +132,44 @@ \NC\AR \HL \stoptable++Table without column headers:++\placetable[here]{none}+\starttable[|r|l|c|r|]+\HL+\NC 12+\NC 12+\NC 12+\NC 12+\NC\AR+\NC 123+\NC 123+\NC 123+\NC 123+\NC\AR+\NC 1+\NC 1+\NC 1+\NC 1+\NC\AR+\HL+\stoptable++Multiline table without column headers:++\placetable[here]{none}+\starttable[|cp(0.15\textwidth)|lp(0.14\textwidth)|rp(0.16\textwidth)|lp(0.34\textwidth)|]+\HL+\NC First+\NC row+\NC 12.0+\NC Example of a row that spans multiple lines.+\NC\AR+\NC Second+\NC row+\NC 5.0+\NC Here's another one. Note the blank line between rows.+\NC\AR+\HL+\stoptable
tests/tables.docbook view
@@ -5,123 +5,131 @@   <caption>     Demonstration of simple table syntax.   </caption>-  <tr>-    <th align="right">-      Right-    </th>-    <th align="left">-      Left-    </th>-    <th align="center">-      Center-    </th>-    <th align="left">-      Default-    </th>-  </tr>-  <tr>-    <td align="right">-      12-    </td>-    <td align="left">-      12-    </td>-    <td align="center">-      12-    </td>-    <td align="left">-      12-    </td>-  </tr>-  <tr>-    <td align="right">-      123-    </td>-    <td align="left">-      123-    </td>-    <td align="center">-      123-    </td>-    <td align="left">-      123-    </td>-  </tr>-  <tr>-    <td align="right">-      1-    </td>-    <td align="left">-      1-    </td>-    <td align="center">-      1-    </td>-    <td align="left">-      1-    </td>-  </tr>+  <thead>+    <tr>+      <th align="right">+        Right+      </th>+      <th align="left">+        Left+      </th>+      <th align="center">+        Center+      </th>+      <th align="left">+        Default+      </th>+    </tr>+  </thead>+  <tbody>+    <tr>+      <td align="right">+        12+      </td>+      <td align="left">+        12+      </td>+      <td align="center">+        12+      </td>+      <td align="left">+        12+      </td>+    </tr>+    <tr>+      <td align="right">+        123+      </td>+      <td align="left">+        123+      </td>+      <td align="center">+        123+      </td>+      <td align="left">+        123+      </td>+    </tr>+    <tr>+      <td align="right">+        1+      </td>+      <td align="left">+        1+      </td>+      <td align="center">+        1+      </td>+      <td align="left">+        1+      </td>+    </tr>+  </tbody> </table> <para>   Simple table without caption: </para> <informaltable>-  <tr>-    <th align="right">-      Right-    </th>-    <th align="left">-      Left-    </th>-    <th align="center">-      Center-    </th>-    <th align="left">-      Default-    </th>-  </tr>-  <tr>-    <td align="right">-      12-    </td>-    <td align="left">-      12-    </td>-    <td align="center">-      12-    </td>-    <td align="left">-      12-    </td>-  </tr>-  <tr>-    <td align="right">-      123-    </td>-    <td align="left">-      123-    </td>-    <td align="center">-      123-    </td>-    <td align="left">-      123-    </td>-  </tr>-  <tr>-    <td align="right">-      1-    </td>-    <td align="left">-      1-    </td>-    <td align="center">-      1-    </td>-    <td align="left">-      1-    </td>-  </tr>+  <thead>+    <tr>+      <th align="right">+        Right+      </th>+      <th align="left">+        Left+      </th>+      <th align="center">+        Center+      </th>+      <th align="left">+        Default+      </th>+    </tr>+  </thead>+  <tbody>+    <tr>+      <td align="right">+        12+      </td>+      <td align="left">+        12+      </td>+      <td align="center">+        12+      </td>+      <td align="left">+        12+      </td>+    </tr>+    <tr>+      <td align="right">+        123+      </td>+      <td align="left">+        123+      </td>+      <td align="center">+        123+      </td>+      <td align="left">+        123+      </td>+    </tr>+    <tr>+      <td align="right">+        1+      </td>+      <td align="left">+        1+      </td>+      <td align="center">+        1+      </td>+      <td align="left">+        1+      </td>+    </tr>+  </tbody> </informaltable> <para>   Simple table indented two spaces:@@ -130,62 +138,66 @@   <caption>     Demonstration of simple table syntax.   </caption>-  <tr>-    <th align="right">-      Right-    </th>-    <th align="left">-      Left-    </th>-    <th align="center">-      Center-    </th>-    <th align="left">-      Default-    </th>-  </tr>-  <tr>-    <td align="right">-      12-    </td>-    <td align="left">-      12-    </td>-    <td align="center">-      12-    </td>-    <td align="left">-      12-    </td>-  </tr>-  <tr>-    <td align="right">-      123-    </td>-    <td align="left">-      123-    </td>-    <td align="center">-      123-    </td>-    <td align="left">-      123-    </td>-  </tr>-  <tr>-    <td align="right">-      1-    </td>-    <td align="left">-      1-    </td>-    <td align="center">-      1-    </td>-    <td align="left">-      1-    </td>-  </tr>+  <thead>+    <tr>+      <th align="right">+        Right+      </th>+      <th align="left">+        Left+      </th>+      <th align="center">+        Center+      </th>+      <th align="left">+        Default+      </th>+    </tr>+  </thead>+  <tbody>+    <tr>+      <td align="right">+        12+      </td>+      <td align="left">+        12+      </td>+      <td align="center">+        12+      </td>+      <td align="left">+        12+      </td>+    </tr>+    <tr>+      <td align="right">+        123+      </td>+      <td align="left">+        123+      </td>+      <td align="center">+        123+      </td>+      <td align="left">+        123+      </td>+    </tr>+    <tr>+      <td align="right">+        1+      </td>+      <td align="left">+        1+      </td>+      <td align="center">+        1+      </td>+      <td align="left">+        1+      </td>+    </tr>+  </tbody> </table> <para>   Multiline table with caption:@@ -194,93 +206,197 @@   <caption>     Here's the caption. It may span multiple lines.   </caption>-  <tr>-    <th align="center" style="{width: 15%;}">-      Centered Header-    </th>-    <th align="left" style="{width: 13%;}">-      Left Aligned-    </th>-    <th align="right" style="{width: 16%;}">-      Right Aligned-    </th>-    <th align="left" style="{width: 33%;}">-      Default aligned-    </th>-  </tr>-  <tr>-    <td align="center">-      First-    </td>-    <td align="left">-      row-    </td>-    <td align="right">-      12.0-    </td>-    <td align="left">-      Example of a row that spans multiple lines.-    </td>-  </tr>-  <tr>-    <td align="center">-      Second-    </td>-    <td align="left">-      row-    </td>-    <td align="right">-      5.0-    </td>-    <td align="left">-      Here's another one. Note the blank line between rows.-    </td>-  </tr>+  <col width="15%" />+  <col width="13%" />+  <col width="16%" />+  <col width="33%" />+  <thead>+    <tr>+      <th align="center">+        Centered Header+      </th>+      <th align="left">+        Left Aligned+      </th>+      <th align="right">+        Right Aligned+      </th>+      <th align="left">+        Default aligned+      </th>+    </tr>+  </thead>+  <tbody>+    <tr>+      <td align="center">+        First+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        12.0+      </td>+      <td align="left">+        Example of a row that spans multiple lines.+      </td>+    </tr>+    <tr>+      <td align="center">+        Second+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        5.0+      </td>+      <td align="left">+        Here's another one. Note the blank line between rows.+      </td>+    </tr>+  </tbody> </table> <para>   Multiline table without caption: </para> <informaltable>-  <tr>-    <th align="center" style="{width: 15%;}">-      Centered Header-    </th>-    <th align="left" style="{width: 13%;}">-      Left Aligned-    </th>-    <th align="right" style="{width: 16%;}">-      Right Aligned-    </th>-    <th align="left" style="{width: 33%;}">-      Default aligned-    </th>-  </tr>-  <tr>-    <td align="center">-      First-    </td>-    <td align="left">-      row-    </td>-    <td align="right">-      12.0-    </td>-    <td align="left">-      Example of a row that spans multiple lines.-    </td>-  </tr>-  <tr>-    <td align="center">-      Second-    </td>-    <td align="left">-      row-    </td>-    <td align="right">-      5.0-    </td>-    <td align="left">-      Here's another one. Note the blank line between rows.-    </td>-  </tr>+  <col width="15%" />+  <col width="13%" />+  <col width="16%" />+  <col width="33%" />+  <thead>+    <tr>+      <th align="center">+        Centered Header+      </th>+      <th align="left">+        Left Aligned+      </th>+      <th align="right">+        Right Aligned+      </th>+      <th align="left">+        Default aligned+      </th>+    </tr>+  </thead>+  <tbody>+    <tr>+      <td align="center">+        First+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        12.0+      </td>+      <td align="left">+        Example of a row that spans multiple lines.+      </td>+    </tr>+    <tr>+      <td align="center">+        Second+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        5.0+      </td>+      <td align="left">+        Here's another one. Note the blank line between rows.+      </td>+    </tr>+  </tbody>+</informaltable>+<para>+  Table without column headers:+</para>+<informaltable>+  <tbody>+    <tr>+      <td align="right">+        12+      </td>+      <td align="left">+        12+      </td>+      <td align="center">+        12+      </td>+      <td align="right">+        12+      </td>+    </tr>+    <tr>+      <td align="right">+        123+      </td>+      <td align="left">+        123+      </td>+      <td align="center">+        123+      </td>+      <td align="right">+        123+      </td>+    </tr>+    <tr>+      <td align="right">+        1+      </td>+      <td align="left">+        1+      </td>+      <td align="center">+        1+      </td>+      <td align="right">+        1+      </td>+    </tr>+  </tbody>+</informaltable>+<para>+  Multiline table without column headers:+</para>+<informaltable>+  <col width="15%" />+  <col width="13%" />+  <col width="16%" />+  <col width="33%" />+  <tbody>+    <tr>+      <td align="center">+        First+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        12.0+      </td>+      <td align="left">+        Example of a row that spans multiple lines.+      </td>+    </tr>+    <tr>+      <td align="center">+        Second+      </td>+      <td align="left">+        row+      </td>+      <td align="right">+        5.0+      </td>+      <td align="left">+        Here's another one. Note the blank line between rows.+      </td>+    </tr>+  </tbody> </informaltable>
tests/tables.html view
@@ -3,205 +3,299 @@ ><table ><caption   >Demonstration of simple table syntax.</caption+  ><thead   ><tr class="header"-  ><th align="right"-    >Right</th-    ><th align="left"-    >Left</th-    ><th align="center"-    >Center</th-    ><th align="left"-    >Default</th-    ></tr-  ><tr class="odd"-  ><td align="right"-    >12</td-    ><td align="left"-    >12</td-    ><td align="center"-    >12</td-    ><td align="left"-    >12</td-    ></tr-  ><tr class="even"-  ><td align="right"-    >123</td-    ><td align="left"-    >123</td-    ><td align="center"-    >123</td-    ><td align="left"-    >123</td-    ></tr+    ><th align="right"+      >Right</th+      ><th align="left"+      >Left</th+      ><th align="center"+      >Center</th+      ><th align="left"+      >Default</th+      ></tr+    ></thead+  ><tbody   ><tr class="odd"-  ><td align="right"-    >1</td-    ><td align="left"-    >1</td-    ><td align="center"-    >1</td-    ><td align="left"-    >1</td-    ></tr+    ><td align="right"+      >12</td+      ><td align="left"+      >12</td+      ><td align="center"+      >12</td+      ><td align="left"+      >12</td+      ></tr+    ><tr class="even"+    ><td align="right"+      >123</td+      ><td align="left"+      >123</td+      ><td align="center"+      >123</td+      ><td align="left"+      >123</td+      ></tr+    ><tr class="odd"+    ><td align="right"+      >1</td+      ><td align="left"+      >1</td+      ><td align="center"+      >1</td+      ><td align="left"+      >1</td+      ></tr+    ></tbody   ></table ><p >Simple table without caption:</p ><table-><tr class="header"-  ><th align="right"-    >Right</th-    ><th align="left"-    >Left</th-    ><th align="center"-    >Center</th-    ><th align="left"-    >Default</th-    ></tr-  ><tr class="odd"-  ><td align="right"-    >12</td-    ><td align="left"-    >12</td-    ><td align="center"-    >12</td-    ><td align="left"-    >12</td-    ></tr-  ><tr class="even"-  ><td align="right"-    >123</td-    ><td align="left"-    >123</td-    ><td align="center"-    >123</td-    ><td align="left"-    >123</td-    ></tr+><thead+  ><tr class="header"+    ><th align="right"+      >Right</th+      ><th align="left"+      >Left</th+      ><th align="center"+      >Center</th+      ><th align="left"+      >Default</th+      ></tr+    ></thead+  ><tbody   ><tr class="odd"-  ><td align="right"-    >1</td-    ><td align="left"-    >1</td-    ><td align="center"-    >1</td-    ><td align="left"-    >1</td-    ></tr+    ><td align="right"+      >12</td+      ><td align="left"+      >12</td+      ><td align="center"+      >12</td+      ><td align="left"+      >12</td+      ></tr+    ><tr class="even"+    ><td align="right"+      >123</td+      ><td align="left"+      >123</td+      ><td align="center"+      >123</td+      ><td align="left"+      >123</td+      ></tr+    ><tr class="odd"+    ><td align="right"+      >1</td+      ><td align="left"+      >1</td+      ><td align="center"+      >1</td+      ><td align="left"+      >1</td+      ></tr+    ></tbody   ></table ><p >Simple table indented two spaces:</p ><table ><caption   >Demonstration of simple table syntax.</caption+  ><thead   ><tr class="header"-  ><th align="right"-    >Right</th-    ><th align="left"-    >Left</th-    ><th align="center"-    >Center</th-    ><th align="left"-    >Default</th-    ></tr-  ><tr class="odd"-  ><td align="right"-    >12</td-    ><td align="left"-    >12</td-    ><td align="center"-    >12</td-    ><td align="left"-    >12</td-    ></tr-  ><tr class="even"-  ><td align="right"-    >123</td-    ><td align="left"-    >123</td-    ><td align="center"-    >123</td-    ><td align="left"-    >123</td-    ></tr+    ><th align="right"+      >Right</th+      ><th align="left"+      >Left</th+      ><th align="center"+      >Center</th+      ><th align="left"+      >Default</th+      ></tr+    ></thead+  ><tbody   ><tr class="odd"-  ><td align="right"-    >1</td-    ><td align="left"-    >1</td-    ><td align="center"-    >1</td-    ><td align="left"-    >1</td-    ></tr+    ><td align="right"+      >12</td+      ><td align="left"+      >12</td+      ><td align="center"+      >12</td+      ><td align="left"+      >12</td+      ></tr+    ><tr class="even"+    ><td align="right"+      >123</td+      ><td align="left"+      >123</td+      ><td align="center"+      >123</td+      ><td align="left"+      >123</td+      ></tr+    ><tr class="odd"+    ><td align="right"+      >1</td+      ><td align="left"+      >1</td+      ><td align="center"+      >1</td+      ><td align="left"+      >1</td+      ></tr+    ></tbody   ></table ><p >Multiline table with caption:</p ><table ><caption   >Here's the caption. It may span multiple lines.</caption+  ><col width="15%"+   /><col width="13%"+   /><col width="16%"+   /><col width="33%"+   /><thead   ><tr class="header"-  ><th align="center" style="width: 15%;"-    >Centered Header</th-    ><th align="left" style="width: 13%;"-    >Left Aligned</th-    ><th align="right" style="width: 16%;"-    >Right Aligned</th-    ><th align="left" style="width: 33%;"-    >Default aligned</th-    ></tr+    ><th align="center"+      >Centered Header</th+      ><th align="left"+      >Left Aligned</th+      ><th align="right"+      >Right Aligned</th+      ><th align="left"+      >Default aligned</th+      ></tr+    ></thead+  ><tbody   ><tr class="odd"-  ><td align="center"-    >First</td-    ><td align="left"-    >row</td-    ><td align="right"-    >12.0</td-    ><td align="left"-    >Example of a row that spans multiple lines.</td-    ></tr-  ><tr class="even"-  ><td align="center"-    >Second</td-    ><td align="left"-    >row</td-    ><td align="right"-    >5.0</td-    ><td align="left"-    >Here's another one. Note the blank line between rows.</td-    ></tr+    ><td align="center"+      >First</td+      ><td align="left"+      >row</td+      ><td align="right"+      >12.0</td+      ><td align="left"+      >Example of a row that spans multiple lines.</td+      ></tr+    ><tr class="even"+    ><td align="center"+      >Second</td+      ><td align="left"+      >row</td+      ><td align="right"+      >5.0</td+      ><td align="left"+      >Here's another one. Note the blank line between rows.</td+      ></tr+    ></tbody   ></table ><p >Multiline table without caption:</p ><table-><tr class="header"-  ><th align="center" style="width: 15%;"-    >Centered Header</th-    ><th align="left" style="width: 13%;"-    >Left Aligned</th-    ><th align="right" style="width: 16%;"-    >Right Aligned</th-    ><th align="left" style="width: 33%;"-    >Default aligned</th-    ></tr+><col width="15%"+   /><col width="13%"+   /><col width="16%"+   /><col width="33%"+   /><thead+  ><tr class="header"+    ><th align="center"+      >Centered Header</th+      ><th align="left"+      >Left Aligned</th+      ><th align="right"+      >Right Aligned</th+      ><th align="left"+      >Default aligned</th+      ></tr+    ></thead+  ><tbody   ><tr class="odd"-  ><td align="center"-    >First</td-    ><td align="left"-    >row</td+    ><td align="center"+      >First</td+      ><td align="left"+      >row</td+      ><td align="right"+      >12.0</td+      ><td align="left"+      >Example of a row that spans multiple lines.</td+      ></tr+    ><tr class="even"+    ><td align="center"+      >Second</td+      ><td align="left"+      >row</td+      ><td align="right"+      >5.0</td+      ><td align="left"+      >Here's another one. Note the blank line between rows.</td+      ></tr+    ></tbody+  ></table+><p+>Table without column headers:</p+><table+><tbody+  ><tr class="odd"     ><td align="right"-    >12.0</td-    ><td align="left"-    >Example of a row that spans multiple lines.</td-    ></tr-  ><tr class="even"-  ><td align="center"-    >Second</td-    ><td align="left"-    >row</td+      >12</td+      ><td align="left"+      >12</td+      ><td align="center"+      >12</td+      ><td align="right"+      >12</td+      ></tr+    ><tr class="even"     ><td align="right"-    >5.0</td-    ><td align="left"-    >Here's another one. Note the blank line between rows.</td-    ></tr+      >123</td+      ><td align="left"+      >123</td+      ><td align="center"+      >123</td+      ><td align="right"+      >123</td+      ></tr+    ><tr class="odd"+    ><td align="right"+      >1</td+      ><td align="left"+      >1</td+      ><td align="center"+      >1</td+      ><td align="right"+      >1</td+      ></tr+    ></tbody+  ></table+><p+>Multiline table without column headers:</p+><table+><col width="15%"+   /><col width="13%"+   /><col width="16%"+   /><col width="33%"+   /><tbody+  ><tr class="odd"+    ><td align="center"+      >First</td+      ><td align="left"+      >row</td+      ><td align="right"+      >12.0</td+      ><td align="left"+      >Example of a row that spans multiple lines.</td+      ></tr+    ><tr class="even"+    ><td align="center"+      >Second</td+      ><td align="left"+      >row</td+      ><td align="right"+      >5.0</td+      ><td align="left"+      >Here's another one. Note the blank line between rows.</td+      ></tr+    ></tbody   ></table >
tests/tables.latex view
@@ -137,3 +137,42 @@ \end{tabular} \end{center} +Table without column headers:++\begin{center}+\begin{tabular}{rlcr}+12+ & 12+ & 12+ & 12+\\+123+ & 123+ & 123+ & 123+\\+1+ & 1+ & 1+ & 1+\\+\end{tabular}+\end{center}++Multiline table without column headers:++\begin{center}+\begin{tabular}{>{\PBS\centering\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.14\columnwidth}>{\PBS\raggedleft\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.34\columnwidth}}+First+ & row+ & 12.0+ & Example of a row that spans multiple lines.+\\+Second+ & row+ & 5.0+ & Here's another one. Note the blank line between rows.+\\+\end{tabular}+\end{center}+
tests/tables.man view
@@ -205,3 +205,63 @@ Note the blank line between rows. T} .TE+.PP+Table without column headers:+.PP+.TS+tab(@);+r l c r.+T{+12+T}@T{+12+T}@T{+12+T}@T{+12+T}+T{+123+T}@T{+123+T}@T{+123+T}@T{+123+T}+T{+1+T}@T{+1+T}@T{+1+T}@T{+1+T}+.TE+.PP+Multiline table without column headers:+.PP+.TS+tab(@);+cw(10.50n) lw(9.63n) rw(11.38n) lw(23.63n).+T{+First+T}@T{+row+T}@T{+12.0+T}@T{+Example of a row that spans multiple lines.+T}+T{+Second+T}@T{+row+T}@T{+5.0+T}@T{+Here\[aq]s another one.+Note the blank line between rows.+T}+.TE
tests/tables.markdown view
@@ -56,5 +56,24 @@                                       rows.   -------------------------------------------------------------- +Table without column headers:++  ----- ----- ----- -----+     12 12     12      12+    123 123    123    123+      1 1       1       1+  ----- ----- ----- -----++Multiline table without column headers:++  ----------- ---------- ------------ --------------------------+     First    row                12.0 Example of a row that+                                      spans multiple lines.+  +    Second    row                 5.0 Here's another one. Note+                                      the blank line between+                                      rows.+  ----------- ---------- ------------ --------------------------+  
tests/tables.mediawiki view
@@ -1,123 +1,212 @@ Simple table with caption:  <table>-<caption>Demonstration of simple table syntax.</caption><tr>+<caption>Demonstration of simple table syntax.</caption>+<thead>+<tr class="header"> <th align="right">Right</th> <th align="left">Left</th> <th align="center">Center</th> <th align="left">Default</th>-</tr><tr>+</tr>+</thead>+<tbody>+<tr class="odd"> <td align="right">12</td> <td align="left">12</td> <td align="center">12</td> <td align="left">12</td> </tr>-<tr>+<tr class="even"> <td align="right">123</td> <td align="left">123</td> <td align="center">123</td> <td align="left">123</td> </tr>-<tr>+<tr class="odd"> <td align="right">1</td> <td align="left">1</td> <td align="center">1</td> <td align="left">1</td> </tr>+</tbody> </table>+ Simple table without caption:  <table>-<tr>+<thead>+<tr class="header"> <th align="right">Right</th> <th align="left">Left</th> <th align="center">Center</th> <th align="left">Default</th>-</tr><tr>+</tr>+</thead>+<tbody>+<tr class="odd"> <td align="right">12</td> <td align="left">12</td> <td align="center">12</td> <td align="left">12</td> </tr>-<tr>+<tr class="even"> <td align="right">123</td> <td align="left">123</td> <td align="center">123</td> <td align="left">123</td> </tr>-<tr>+<tr class="odd"> <td align="right">1</td> <td align="left">1</td> <td align="center">1</td> <td align="left">1</td> </tr>+</tbody> </table>+ Simple table indented two spaces:  <table>-<caption>Demonstration of simple table syntax.</caption><tr>+<caption>Demonstration of simple table syntax.</caption>+<thead>+<tr class="header"> <th align="right">Right</th> <th align="left">Left</th> <th align="center">Center</th> <th align="left">Default</th>-</tr><tr>+</tr>+</thead>+<tbody>+<tr class="odd"> <td align="right">12</td> <td align="left">12</td> <td align="center">12</td> <td align="left">12</td> </tr>-<tr>+<tr class="even"> <td align="right">123</td> <td align="left">123</td> <td align="center">123</td> <td align="left">123</td> </tr>-<tr>+<tr class="odd"> <td align="right">1</td> <td align="left">1</td> <td align="center">1</td> <td align="left">1</td> </tr>+</tbody> </table>+ Multiline table with caption:  <table>-<caption>Here's the caption. It may span multiple lines.</caption><tr>-<th align="center" style="width: 15%;">Centered Header</th>-<th align="left" style="width: 13%;">Left Aligned</th>-<th align="right" style="width: 16%;">Right Aligned</th>-<th align="left" style="width: 33%;">Default aligned</th>-</tr><tr>+<caption>Here's the caption. It may span multiple lines.</caption>+<col width="15%" />+<col width="13%" />+<col width="16%" />+<col width="33%" />+<thead>+<tr class="header">+<th align="center">Centered Header</th>+<th align="left">Left Aligned</th>+<th align="right">Right Aligned</th>+<th align="left">Default aligned</th>+</tr>+</thead>+<tbody>+<tr class="odd"> <td align="center">First</td> <td align="left">row</td> <td align="right">12.0</td> <td align="left">Example of a row that spans multiple lines.</td> </tr>-<tr>+<tr class="even"> <td align="center">Second</td> <td align="left">row</td> <td align="right">5.0</td> <td align="left">Here's another one. Note the blank line between rows.</td> </tr>+</tbody> </table>+ Multiline table without caption:  <table>-<tr>-<th align="center" style="width: 15%;">Centered Header</th>-<th align="left" style="width: 13%;">Left Aligned</th>-<th align="right" style="width: 16%;">Right Aligned</th>-<th align="left" style="width: 33%;">Default aligned</th>-</tr><tr>+<col width="15%" />+<col width="13%" />+<col width="16%" />+<col width="33%" />+<thead>+<tr class="header">+<th align="center">Centered Header</th>+<th align="left">Left Aligned</th>+<th align="right">Right Aligned</th>+<th align="left">Default aligned</th>+</tr>+</thead>+<tbody>+<tr class="odd"> <td align="center">First</td> <td align="left">row</td> <td align="right">12.0</td> <td align="left">Example of a row that spans multiple lines.</td> </tr>-<tr>+<tr class="even"> <td align="center">Second</td> <td align="left">row</td> <td align="right">5.0</td> <td align="left">Here's another one. Note the blank line between rows.</td> </tr>+</tbody> </table>++Table without column headers:++<table>+<tbody>+<tr class="odd">+<td align="right">12</td>+<td align="left">12</td>+<td align="center">12</td>+<td align="right">12</td>+</tr>+<tr class="even">+<td align="right">123</td>+<td align="left">123</td>+<td align="center">123</td>+<td align="right">123</td>+</tr>+<tr class="odd">+<td align="right">1</td>+<td align="left">1</td>+<td align="center">1</td>+<td align="right">1</td>+</tr>+</tbody>+</table>++Multiline table without column headers:++<table>+<col width="15%" />+<col width="13%" />+<col width="16%" />+<col width="33%" />+<tbody>+<tr class="odd">+<td align="center">First</td>+<td align="left">row</td>+<td align="right">12.0</td>+<td align="left">Example of a row that spans multiple lines.</td>+</tr>+<tr class="even">+<td align="center">Second</td>+<td align="left">row</td>+<td align="right">5.0</td>+<td align="left">Here's another one. Note the blank line between rows.</td>+</tr>+</tbody>+</table>+
tests/tables.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [] [] [])+Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) [ Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"] , Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]   [ [ Plain [Str "Right"] ]@@ -73,6 +73,38 @@   , [ Plain [Str "Left",Space,Str "Aligned"] ]   , [ Plain [Str "Right",Space,Str "Aligned"] ]   , [ Plain [Str "Default",Space,Str "aligned"] ] ] [+  [ [ Plain [Str "First"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "12",Str ".",Str "0"] ]+  , [ Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines",Str "."] ] ],+  [ [ Plain [Str "Second"] ]+  , [ Plain [Str "row"] ]+  , [ Plain [Str "5",Str ".",Str "0"] ]+  , [ Plain [Str "Here",Str "'",Str "s",Space,Str "another",Space,Str "one",Str ".",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows",Str "."] ] ] ]+, Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]+, Table [] [AlignRight,AlignLeft,AlignCenter,AlignRight] [0.0,0.0,0.0,0.0]+  [   []+  ,   []+  ,   []+  ,   [] ] [+  [ [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ]+  , [ Plain [Str "12"] ] ],+  [ [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ]+  , [ Plain [Str "123"] ] ],+  [ [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ]+  , [ Plain [Str "1"] ] ] ]+, Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]+, Table [] [AlignCenter,AlignLeft,AlignRight,AlignDefault] [0.15,0.1375,0.1625,0.3375]+  [   []+  ,   []+  ,   []+  ,   [] ] [   [ [ Plain [Str "First"] ]   , [ Plain [Str "row"] ]   , [ Plain [Str "12",Str ".",Str "0"] ]
tests/tables.opendocument view
@@ -298,3 +298,87 @@     </table:table-cell>   </table:table-row> </table:table>+<text:p text:style-name="Text_20_body">Table without column headers:</text:p>+<table:table table:name="Table6" table:style-name="Table6">+  <table:table-column table:style-name="Table6.A" />+  <table:table-column table:style-name="Table6.B" />+  <table:table-column table:style-name="Table6.C" />+  <table:table-column table:style-name="Table6.D" />+  <table:table-row>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P24">12</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">12</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P25">12</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P26">12</text:p>+    </table:table-cell>+  </table:table-row>+  <table:table-row>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P24">123</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">123</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P25">123</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P26">123</text:p>+    </table:table-cell>+  </table:table-row>+  <table:table-row>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P24">1</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">1</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P25">1</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table6.A1" office:value-type="string">+      <text:p text:style-name="P26">1</text:p>+    </table:table-cell>+  </table:table-row>+</table:table>+<text:p text:style-name="Text_20_body">Multiline table without column headers:</text:p>+<table:table table:name="Table7" table:style-name="Table7">+  <table:table-column table:style-name="Table7.A" />+  <table:table-column table:style-name="Table7.B" />+  <table:table-column table:style-name="Table7.C" />+  <table:table-column table:style-name="Table7.D" />+  <table:table-row>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="P29">First</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">row</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="P30">12.0</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">Example of a row that spans multiple lines.</text:p>+    </table:table-cell>+  </table:table-row>+  <table:table-row>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="P29">Second</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">row</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="P30">5.0</text:p>+    </table:table-cell>+    <table:table-cell table:style-name="Table7.A1" office:value-type="string">+      <text:p text:style-name="Table_20_Contents">Here's another one. Note the blank line between rows.</text:p>+    </table:table-cell>+  </table:table-row>+</table:table>
+ tests/tables.plain view
@@ -0,0 +1,79 @@+Simple table with caption:++    Right Left    Center  Default+  ------- ------ -------- ---------+       12 12        12    12+      123 123      123    123+        1 1         1     1+  +  Table: Demonstration of simple table syntax.++Simple table without caption:++    Right Left    Center  Default+  ------- ------ -------- ---------+       12 12        12    12+      123 123      123    123+        1 1         1     1++Simple table indented two spaces:++    Right Left    Center  Default+  ------- ------ -------- ---------+       12 12        12    12+      123 123      123    123+        1 1         1     1+  +  Table: Demonstration of simple table syntax.++Multiline table with caption:++  --------------------------------------------------------------+   Centered   Left              Right Default aligned+    Header    Aligned         Aligned+  ----------- ---------- ------------ --------------------------+     First    row                12.0 Example of a row that+                                      spans multiple lines.+  +    Second    row                 5.0 Here's another one. Note+                                      the blank line between+                                      rows.+  --------------------------------------------------------------+  +  Table: Here's the caption. It may span multiple lines.++Multiline table without caption:++  --------------------------------------------------------------+   Centered   Left              Right Default aligned+    Header    Aligned         Aligned+  ----------- ---------- ------------ --------------------------+     First    row                12.0 Example of a row that+                                      spans multiple lines.+  +    Second    row                 5.0 Here's another one. Note+                                      the blank line between+                                      rows.+  --------------------------------------------------------------++Table without column headers:++  ----- ----- ----- -----+     12 12     12      12+    123 123    123    123+      1 1       1       1+  ----- ----- ----- -----++Multiline table without column headers:++  ----------- ---------- ------------ --------------------------+     First    row                12.0 Example of a row that+                                      spans multiple lines.+  +    Second    row                 5.0 Here's another one. Note+                                      the blank line between+                                      rows.+  ----------- ---------- ------------ --------------------------+++
tests/tables.rst view
@@ -68,4 +68,25 @@ |             |            |              | rows.                      | +-------------+------------+--------------+----------------------------+ +Table without column headers:+++-------+-------+-------+-------++| 12    | 12    | 12    | 12    |++-------+-------+-------+-------++| 123   | 123   | 123   | 123   |++-------+-------+-------+-------++| 1     | 1     | 1     | 1     |++-------+-------+-------+-------+++Multiline table without column headers:+++-------------+------------+--------------+----------------------------++| First       | row        | 12.0         | Example of a row that      |+|             |            |              | spans multiple lines.      |++-------------+------------+--------------+----------------------------++| Second      | row        | 5.0          | Here's another one. Note   |+|             |            |              | the blank line between     |+|             |            |              | rows.                      |++-------------+------------+--------------+----------------------------++ 
tests/tables.rtf view
@@ -278,4 +278,83 @@ } \intbl\row} {\pard \ql \f0 \sa180 \li0 \fi0 \par}+{\pard \ql \f0 \sa180 \li0 \fi0 Table without column headers:\par}+{+\trowd \trgaph120+\cellx2160\cellx4320\cellx6480\cellx8640+\trkeep\intbl+{+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 12\par}+\cell}+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 12\par}+\cell}+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}+\cell}+}+\intbl\row}+{+\trowd \trgaph120+\cellx2160\cellx4320\cellx6480\cellx8640+\trkeep\intbl+{+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 123\par}+\cell}+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 123\par}+\cell}+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}+\cell}+}+\intbl\row}+{+\trowd \trgaph120+\cellx2160\cellx4320\cellx6480\cellx8640+\trkeep\intbl+{+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 1\par}+\cell}+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 1\par}+\cell}+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}+\cell}+}+\intbl\row}+{\pard \ql \f0 \sa180 \li0 \fi0 \par}+{\pard \ql \f0 \sa180 \li0 \fi0 Multiline table without column headers:\par}+{+\trowd \trgaph120+\cellx1296\cellx2484\cellx3888\cellx6804+\trkeep\intbl+{+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 First\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 row\par}+\cell}+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12.0\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 Example of a row that spans multiple lines.\par}+\cell}+}+\intbl\row}+{+\trowd \trgaph120+\cellx1296\cellx2484\cellx3888\cellx6804+\trkeep\intbl+{+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 Second\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 row\par}+\cell}+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 5.0\par}+\cell}+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 Here's another one. Note the blank line between rows.\par}+\cell}+}+\intbl\row}+{\pard \ql \f0 \sa180 \li0 \fi0 \par} 
tests/tables.texinfo view
@@ -122,3 +122,38 @@  @tab Here's another one. Note the blank line between rows. @end multitable +Table without column headers:++@multitable {123} {123} {123} {123} +@item +12+ @tab 12+ @tab 12+ @tab 12+@item +123+ @tab 123+ @tab 123+ @tab 123+@item +1+ @tab 1+ @tab 1+ @tab 1+@end multitable++Multiline table without column headers:++@multitable @columnfractions 0.15 0.14 0.16 0.34 +@item +First+ @tab row+ @tab 12.0+ @tab Example of a row that spans multiple lines.+@item +Second+ @tab row+ @tab 5.0+ @tab Here's another one. Note the blank line between rows.+@end multitable+
tests/tables.txt view
@@ -55,3 +55,21 @@                                     the blank line between rows. --------------------------------------------------------------- +Table without column headers:++-------     ------ ----------   -------+     12     12        12             12+    123     123       123           123+      1     1          1              1+-------     ------ ----------   -------++Multiline table without column headers:++----------  ---------  -----------  ---------------------------+   First    row               12.0  Example of a row that spans+                                    multiple lines.++   Second   row                5.0  Here's another one.  Note+                                    the blank line between rows.+----------  ---------  -----------  ---------------------------+
tests/testsuite.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]] [Str "July",Space,Str "17,",Space,Str "2006"])+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]}) [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] , HorizontalRule , Header 1 [Str "Headers"]
tests/testsuite.txt view
@@ -715,5 +715,5 @@  This paragraph should not be part of the note, as it is not indented. -[^1]: Here is the footnote.  It can go anywhere after the footnote-reference.  It need not be placed at the end of the document.+  [^1]: Here is the footnote.  It can go anywhere after the footnote+  reference.  It need not be placed at the end of the document.
tests/writer.context view
@@ -14,24 +14,6 @@ \setuphead[subsection][style=\tfb] \setuphead[subsubsection][style=\bf] -% define title block commands-\unprotect-\def\doctitle#1{\gdef\@title{#1}}-\def\author#1{\gdef\@author{#1}}-\def\date#1{\gdef\@date{#1}}-\date{\currentdate}  % Default to today unless specified otherwise.-\def\maketitle{%-  \startalignment[center]-    \blank[2*big]-      {\tfd \@title}-    \blank[3*medium]-      {\tfa \@author}-    \blank[2*medium]-      {\tfa \@date}-    \blank[3*medium]-  \stopalignment}-\protect- % define descr (for definition lists) \definedescription[descr][   headstyle=bold,style=normal,align=left,location=hanging,@@ -68,11 +50,16 @@  \protect -\doctitle{Pandoc Test Suite}-\author{John MacFarlane\\Anonymous}-\date{July 17, 2006} \starttext-\maketitle+\startalignment[center]+  \blank[2*big]+  {\tfd Pandoc Test Suite}+  \blank[3*medium]+  {\tfa John MacFarlane\crlf Anonymous}+  \blank[2*medium]+  {\tfa July 17, 2006}+  \blank[3*medium]+\stopalignment  This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.@@ -875,18 +862,9 @@  From \quotation{Voyage dans la Lune} by Georges Melies (1902): -\placefigure-[]-[fig:lalune]-{Voyage dans la Lune}-{\externalfigure[lalune.jpg]}+\placefigure[here,nonumber]{lalune}{\externalfigure[lalune.jpg]} -Here is a movie-\placefigure-[]-[fig:movie]-{}-{\externalfigure[movie.jpg]} icon.+Here is a movie {\externalfigure[movie.jpg]} icon.  \thinrule 
tests/writer.docbook view
@@ -1377,18 +1377,15 @@   <para>     From <quote>Voyage dans la Lune</quote> by Georges Melies (1902):   </para>-  <para>-    <inlinemediaobject>+  <figure>+    <title>lalune</title>+    <mediaobject>       <imageobject>-        <objectinfo>-          <title>-            Voyage dans la Lune-          </title>-        </objectinfo>         <imagedata fileref="lalune.jpg" />       </imageobject>-    </inlinemediaobject>-  </para>+      <textobject><phrase>lalune</phrase></textobject>+    </mediaobject>+  </figure>   <para>     Here is a movie     <inlinemediaobject>
tests/writer.html view
@@ -1156,9 +1156,11 @@   >Images</h1   ><p   >From “Voyage dans la Lune” by Georges Melies (1902):</p-  ><p+  ><div class="figure"   ><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"-     /></p+     /><p class="caption"+    >lalune</p+    ></div   ><p   >Here is a movie <img src="movie.jpg" alt="movie"      /> icon.</p
tests/writer.latex view
@@ -2,15 +2,21 @@ \usepackage{amsmath} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc}-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt} \usepackage{fancyvrb}+% Redefine labelwidth for lists; otherwise, the enumerate package will cause+% markers to extend beyond the left margin.+\makeatletter\AtBeginDocument{%+  \renewcommand{\@listi}+    {\setlength{\labelwidth}{4em}}+}\makeatother \usepackage{enumerate} \usepackage[normalem]{ulem} \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}-\usepackage[breaklinks=true]{hyperref} \usepackage{url} \usepackage{graphicx}+\usepackage[breaklinks=true,unicode=true]{hyperref}+\setlength{\parindent}{0pt}+\setlength{\parskip}{6pt plus 2pt minus 1pt} \setcounter{secnumdepth}{0} \VerbatimFootnotes % allows verbatim text in footnotes @@ -803,7 +809,11 @@  From ``Voyage dans la Lune'' by Georges Melies (1902): +\begin{figure}[htb]+\centering \includegraphics{lalune.jpg}+\caption{lalune}+\end{figure}  Here is a movie \includegraphics{movie.jpg} icon. 
tests/writer.markdown view
@@ -281,42 +281,42 @@ Tight using spaces:  apple-:   red fruit+  ~ red fruit orange-:   orange fruit+  ~ orange fruit banana-:   yellow fruit+  ~ yellow fruit  Tight using tabs:  apple-:   red fruit+  ~ red fruit orange-:   orange fruit+  ~ orange fruit banana-:   yellow fruit+  ~ yellow fruit  Loose:  apple-:   red fruit+  ~ red fruit  orange-:   orange fruit+  ~ orange fruit  banana-:   yellow fruit+  ~ yellow fruit   Multiple blocks with italics:  *apple*-:   red fruit+  ~ red fruit      contains seeds, crisp, pleasant to taste  *orange*-:   orange fruit+  ~ orange fruit          { orange code block } @@ -326,34 +326,34 @@ Multiple definitions, tight:  apple-:   red fruit-:   computer+  ~ red fruit+  ~ computer orange-:   orange fruit-:   bank+  ~ orange fruit+  ~ bank  Multiple definitions, loose:  apple-:   red fruit+  ~ red fruit -:   computer+  ~ computer  orange-:   orange fruit+  ~ orange fruit -:   bank+  ~ bank   Blank line after term, indented marker, alternate markers:  apple-:   red fruit+  ~ red fruit -:   computer+  ~ computer  orange-:   orange fruit+  ~ orange fruit      1.  sublist     2.  sublist
tests/writer.mediawiki view
@@ -3,32 +3,32 @@  ----- -== Headers ==+= Headers = -=== Level 2 with an [http://{{SERVERNAME}}/url embedded link] ===+== Level 2 with an [[url|embedded link]] == -==== Level 3 with ''emphasis'' ====+=== Level 3 with ''emphasis'' === -===== Level 4 =====+==== Level 4 ==== -====== Level 5 ======+===== Level 5 ===== -== Level 1 ==+= Level 1 = -=== Level 2 with ''emphasis'' ===+== Level 2 with ''emphasis'' == -==== Level 3 ====+=== Level 3 ===  with no blank line -=== Level 2 ===+== Level 2 ==  with no blank line   ----- -== Paragraphs ==+= Paragraphs =  Here&rsquo;s a regular paragraph. @@ -42,7 +42,7 @@  ----- -== Block Quotes ==+= Block Quotes =  E-mail style: @@ -71,7 +71,7 @@  ----- -== Code Blocks ==+= Code Blocks =  Code: @@ -90,9 +90,9 @@  ----- -== Lists ==+= Lists = -=== Unordered ===+== Unordered ==  Asterisks tight: @@ -130,7 +130,7 @@ * Minus 2 * Minus 3 -=== Ordered ===+== Ordered ==  Tight: @@ -164,7 +164,7 @@ <li><p>Item 2.</p></li> <li><p>Item 3.</p></li></ol> -=== Nested ===+== Nested ==  * Tab ** Tab@@ -192,7 +192,7 @@  # Third -=== Tabs and spaces ===+== Tabs and spaces ==  * this is a list item indented with tabs * this is a list item indented with spaces@@ -200,7 +200,7 @@ ** this is an example list item indented with spaces  -=== Fancy list markers ===+== Fancy list markers ==  <ol start="2" style="list-style-type: decimal;"> <li>begins with 2</li>@@ -245,7 +245,7 @@  ----- -== Definition Lists ==+= Definition Lists =  Tight using spaces: @@ -314,7 +314,7 @@ ;# sublist  -== HTML Blocks ==+= HTML Blocks =  Simple block on one line: @@ -424,13 +424,13 @@  ----- -== Inline Markup ==+= Inline Markup =  This is ''emphasized'', and so ''is this''.  This is '''strong''', and so '''is this'''. -An ''[http://{{SERVERNAME}}/url emphasized link]''.+An ''[[url|emphasized link]]''.  '''''This is strong and em.''''' @@ -453,7 +453,7 @@  ----- -== Smart quotes, ellipses, dashes ==+= Smart quotes, ellipses, dashes =  &ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo; @@ -474,7 +474,7 @@  ----- -== LaTeX ==+= LaTeX =  *  * <math>2+2=4</math>@@ -499,7 +499,7 @@  ----- -== Special Characters ==+= Special Characters =  Here is some unicode: @@ -554,64 +554,64 @@  ----- -== Links ==+= Links = -=== Explicit ===+== Explicit == -Just a [http://{{SERVERNAME}}/url/ URL].+Just a [[url/|URL]]. -[http://{{SERVERNAME}}/url/ URL and title].+[[url/|URL and title]]. -[http://{{SERVERNAME}}/url/ URL and title].+[[url/|URL and title]]. -[http://{{SERVERNAME}}/url/ URL and title].+[[url/|URL and title]]. -[http://{{SERVERNAME}}/url/ URL and title]+[[url/|URL and title]] -[http://{{SERVERNAME}}/url/ URL and title]+[[url/|URL and title]] -[http://{{SERVERNAME}}/url/with_underscore with_underscore]+[[url/with_underscore|with_underscore]]  [mailto:nobody@nowhere.net Email link] -[http://{{SERVERNAME}}/ Empty].+[[|Empty]]. -=== Reference ===+== Reference == -Foo [http://{{SERVERNAME}}/url/ bar].+Foo [[url/|bar]]. -Foo [http://{{SERVERNAME}}/url/ bar].+Foo [[url/|bar]]. -Foo [http://{{SERVERNAME}}/url/ bar].+Foo [[url/|bar]]. -With [http://{{SERVERNAME}}/url/ embedded [brackets]].+With [[url/|embedded [brackets]]]. -[http://{{SERVERNAME}}/url/ b] by itself should be a link.+[[url/|b]] by itself should be a link. -Indented [http://{{SERVERNAME}}/url once].+Indented [[url|once]]. -Indented [http://{{SERVERNAME}}/url twice].+Indented [[url|twice]]. -Indented [http://{{SERVERNAME}}/url thrice].+Indented [[url|thrice]].  This should [not][] be a link.  <pre>[not]: /url</pre>-Foo [http://{{SERVERNAME}}/url/ bar].+Foo [[url/|bar]]. -Foo [http://{{SERVERNAME}}/url/ biz].+Foo [[url/|biz]]. -=== With ampersands ===+== With ampersands ==  Here&rsquo;s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL].  Here&rsquo;s a link with an amersand in the link text: [http://att.com/ AT&amp;T]. -Here&rsquo;s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link].+Here&rsquo;s an [[script?foo=1&bar=2|inline link]]. -Here&rsquo;s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link in pointy braces].+Here&rsquo;s an [[script?foo=1&bar=2|inline link in pointy braces]]. -=== Autolinks ===+== Autolinks ==  With an ampersand: http://example.com/?foo=1&bar=2 @@ -629,18 +629,18 @@  ----- -== Images ==+= Images =  From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902): -[[Image:lalune.jpg|Voyage dans la Lune]]+[[Image:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]]  Here is a movie [[Image:movie.jpg|movie]] icon.   ----- -== Footnotes ==+= Footnotes =  Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. </ref> and another.<ref>Here&rsquo;s the long note. This one contains multiple blocks.@@ -659,6 +659,5 @@  This paragraph should not be part of the note, as it is not indented. -== Notes == <references /> 
tests/writer.native view
@@ -1,4 +1,4 @@-Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]] [Str "July",Space,Str "17,",Space,Str "2006"])+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]}) [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] , HorizontalRule , Header 1 [Str "Headers"]
+ tests/writer.plain view
@@ -0,0 +1,698 @@+Pandoc Test Suite+John MacFarlane; Anonymous+July 17, 2006++This is a set of tests for pandoc. Most of them are adapted from+John Gruber's markdown test suite.+++* * * * *++Headers+=======++Level 2 with an embedded link+-----------------------------++Level 3 with emphasis++Level 4++Level 5++Level 1+=======++Level 2 with emphasis+---------------------++Level 3++with no blank line++Level 2+-------++with no blank line+++* * * * *++Paragraphs+==========++Here's a regular paragraph.++In Markdown 1.0.0 and earlier. Version 8. This line turns into a+list item. Because a hard-wrapped line in the middle of a paragraph+looked like a list item.++Here's one with a bullet. * criminey.++There should be a hard line break  +here.+++* * * * *++Block Quotes+============++E-mail style:++  This is a block quote. It is pretty short.++  Code in a block quote:+  +      sub status {+          print "working";+      }+  +  A list:+  +  1.  item one+  2.  item two+  +  Nested block quotes:+  +    nested+  +    nested++This should not be a block quote: 2 > 1.++And a following paragraph.+++* * * * *++Code Blocks+===========++Code:++    ---- (should be four hyphens)+    +    sub status {+        print "working";+    }+    +    this code block is indented by one tab++And:++        this code block is indented by two tabs+    +    These should not be escaped:  \$ \\ \> \[ \{+++* * * * *++Lists+=====++Unordered+---------++Asterisks tight:++-   asterisk 1+-   asterisk 2+-   asterisk 3++Asterisks loose:++-   asterisk 1++-   asterisk 2++-   asterisk 3+++Pluses tight:++-   Plus 1+-   Plus 2+-   Plus 3++Pluses loose:++-   Plus 1++-   Plus 2++-   Plus 3+++Minuses tight:++-   Minus 1+-   Minus 2+-   Minus 3++Minuses loose:++-   Minus 1++-   Minus 2++-   Minus 3+++Ordered+-------++Tight:++1.  First+2.  Second+3.  Third++and:++1.  One+2.  Two+3.  Three++Loose using tabs:++1.  First++2.  Second++3.  Third+++and using spaces:++1.  One++2.  Two++3.  Three+++Multiple paragraphs:++1.  Item 1, graf one.++    Item 1. graf two. The quick brown fox jumped over the lazy dog's+    back.++2.  Item 2.++3.  Item 3.+++Nested+------++-   Tab+    -   Tab+        -   Tab++++Here's another:++1.  First+2.  Second:+    -   Fee+    -   Fie+    -   Foe++3.  Third++Same thing but with paragraphs:++1.  First++2.  Second:++    -   Fee+    -   Fie+    -   Foe++3.  Third+++Tabs and spaces+---------------++-   this is a list item indented with tabs++-   this is a list item indented with spaces++    -   this is an example list item indented with tabs++    -   this is an example list item indented with spaces++++Fancy list markers+------------------++(2) begins with 2+(3) and now 3++    with a continuation++    iv. sublist with roman numerals, starting with 4+    v.  more items+        (A) a subsublist+        (B) a subsublist++++Nesting:++A.  Upper Alpha+    I.  Upper Roman.+        (6) Decimal start with 6+            c)  Lower alpha with paren+++++Autonumbering:++1.  Autonumber.+2.  More.+    1.  Nested.+++Should not be a list item:++M.A. 2007++B. Williams+++* * * * *++Definition Lists+================++Tight using spaces:++apple+    red fruit+orange+    orange fruit+banana+    yellow fruit++Tight using tabs:++apple+    red fruit+orange+    orange fruit+banana+    yellow fruit++Loose:++apple+    red fruit++orange+    orange fruit++banana+    yellow fruit+++Multiple blocks with italics:++apple+    red fruit++    contains seeds, crisp, pleasant to taste++orange+    orange fruit++        { orange code block }++      orange block quote+++Multiple definitions, tight:++apple+    red fruit+    computer+orange+    orange fruit+    bank++Multiple definitions, loose:++apple+    red fruit++    computer++orange+    orange fruit++    bank+++Blank line after term, indented marker, alternate markers:++apple+    red fruit++    computer++orange+    orange fruit++    1.  sublist+    2.  sublist+++HTML Blocks+===========++Simple block on one line:++foo+And nested without indentation:++foo+bar+Interpreted markdown in a table:++This is emphasized+And this is strong+Here's a simple block:++foo+This should be a code block, though:++    <div>+        foo+    </div>++As should this:++    <div>foo</div>++Now, nested:++foo+This should just be an HTML comment:++Multiline:++Code block:++    <!-- Comment -->++Just plain comment, with trailing spaces on the line:++Code:++    <hr />++Hr's:+++* * * * *++Inline Markup+=============++This is emphasized, and so is this.++This is strong, and so is this.++An emphasized link.++This is strong and em.++So is this word.++This is strong and em.++So is this word.++This is code: >, $, \, \$, <html>.++This is strikeout.++Superscripts: abcd ahello ahello there.++Subscripts: H2O, H23O, Hmany of themO.++These should not be superscripts or subscripts, because of the+unescaped spaces: a^b c^d, a~b c~d.+++* * * * *++Smart quotes, ellipses, dashes+==============================++"Hello," said the spider. "'Shelob' is my name."++'A', 'B', and 'C' are letters.++'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'++'He said, "I want to go."' Were you alive in the 70's?++Here is some quoted 'code' and a "quoted link".++Some dashes: one--two -- three--four -- five.++Dashes between numbers: 5-7, 255-66, 1987-1999.++Ellipses...and...and....+++* * * * *++LaTeX+=====++-   +-   2+2=4+-   x \in y+-   \alpha \wedge \omega+-   223+-   p-Tree+-   Here's some display math:+    \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}+-   Here's one that has a line break in it:+    \alpha + \omega \times x^2.++These shouldn't be math:++-   To get the famous equation, write $e = mc^2$.+-   $22,000 is a lot of money. So is $34,000. (It worked if "lot"+    is emphasized.)+-   Shoes ($20) and socks ($5).+-   Escaped $: $73 this should be emphasized 23$.++Here's a LaTeX table:+++++* * * * *++Special Characters+==================++Here is some unicode:++-   I hat: Î+-   o umlaut: ö+-   section: §+-   set membership: ∈+-   copyright: ©++AT&T has an ampersand in their name.++AT&T is another way to write it.++This & that.++4 < 5.++6 > 5.++Backslash: \++Backtick: `++Asterisk: *++Underscore: _++Left brace: {++Right brace: }++Left bracket: [++Right bracket: ]++Left paren: (++Right paren: )++Greater-than: >++Hash: #++Period: .++Bang: !++Plus: +++Minus: -+++* * * * *++Links+=====++Explicit+--------++Just a URL.++URL and title.++URL and title.++URL and title.++URL and title++URL and title++with_underscore++Email link++Empty.++Reference+---------++Foo bar.++Foo bar.++Foo bar.++With embedded [brackets].++b by itself should be a link.++Indented once.++Indented twice.++Indented thrice.++This should [not][] be a link.++    [not]: /url++Foo bar.++Foo biz.++With ampersands+---------------++Here's a link with an ampersand in the URL.++Here's a link with an amersand in the link text: AT&T.++Here's an inline link.++Here's an inline link in pointy braces.++Autolinks+---------++With an ampersand: http://example.com/?foo=1&bar=2++-   In a list?+-   http://example.com/+-   It should.++An e-mail address: nobody@nowhere.net++  Blockquoted: http://example.com/++Auto-links should not occur here: <http://example.com/>++    or here: <http://example.com/>+++* * * * *++Images+======++From "Voyage dans la Lune" by Georges Melies (1902):++++Here is a movie icon.+++* * * * *++Footnotes+=========++Here is a footnote reference,[^1] and another.[^2] This should not+be a footnote reference, because it contains a space.[^my note]+Here is an inline note.[^3]++  Notes can go in quotes.[^4]++1.  And in list items.[^5]++This paragraph should not be part of the note, as it is not+indented.+++[^1]:+    Here is the footnote. It can go anywhere after the footnote+    reference. It need not be placed at the end of the document.++[^2]:+    Here's the long note. This one contains multiple blocks.++    Subsequent blocks are indented to show that they belong to the+    footnote (as with list items).++          { <code> }++    If you want, you can indent every line, but you can also be lazy+    and just indent the first line of each block.++[^3]:+    This is easier to type. Inline notes may contain links and ]+    verbatim characters, as well as [bracketed text].++[^4]:+    In quote.++[^5]:+    In list.++
tests/writer.rst view
@@ -834,7 +834,11 @@  From "Voyage dans la Lune" by Georges Melies (1902): -|lalune|+.. figure:: lalune.jpg+   :align: center+   :alt: Voyage dans la Lune+   +   lalune  Here is a movie |movie| icon. @@ -885,6 +889,5 @@    In list.  -.. |lalune| image:: lalune.jpg .. |movie| image:: movie.jpg 
tests/writer.texinfo view
@@ -977,7 +977,10 @@ @chapter Images From ``Voyage dans la Lune'' by Georges Melies (1902): +@float @image{lalune,,,lalune,jpg}+@caption{lalune}+@end float  Here is a movie @image{movie,,,movie,jpg} icon.