Skip to content

ymittal/asciimath

Repository files navigation

PreTeXt AsciiMath to LaTeX

This project is an extension to the PreTeXt MathBook XML project. It provides a convenient way for PreTeXt authors to convert AsciiMath to LaTeX.

Please install Python 2.7 and xsltproc before continuing.

Getting started

Clone this repository. Then, clone mathbook repository to access PreTeXt source, including a sample book and article.

$ git clone https://github.com/ymittal/asciimath
$ cd asciimath
$ git clone https://github.com/rbeezer/mathbook
$ virtualenv .env && source .env/bin/activate   # (optional) setup virtualenv
$ pip install -r requirements.txt               # setup pip dependencies
$ chmod +x pretext.sh

Run this command to convert AsciiMath markup, written as <m>`asciimath goes here</m> in <XML>, to LaTeX. It also runs xsltproc with any arguments specified after ./pretext.sh.

$ ./pretext.sh -o <output_dir> <STYLESHEET> <XML>

Check this for xsltproc documentation.

Example

This command converts AsciiMath markup in files in samples folder, stores new XML files to samples-latex folder and generates HTML files into generated-html folder using xsltproc.

$ ./pretext.sh -o generated-html/ mathbook/xsl/mathbook-html.xsl samples/asciimath.xml

Notes

  • All files in samples remain unchanged lest the pretext.sh script unexpectedly modify the source XML.
  • AsciiMath to LaTeX conversion is done only on files with .xml, .ptx extensions in samples. Other files are copied to samples-latex as is.

Sample XML file with AsciiMath

To check the AsciiMath to LaTeX conversion on a single XML file, run

$ python replace.py --xml samples/asciimath.xml

Contact

Please feel free to contact Yash Mittal or create an issue if you have questions regarding this project.

About

AsciiMath to LaTeX converter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published