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.
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.
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
- All files in
samples
remain unchanged lest thepretext.sh
script unexpectedly modify the source XML. - AsciiMath to LaTeX conversion is done only on files with
.xml
,.ptx
extensions insamples
. Other files are copied tosamples-latex
as is.
To check the AsciiMath to LaTeX conversion on a single XML file, run
$ python replace.py --xml samples/asciimath.xml
Please feel free to contact Yash Mittal or create an issue if you have questions regarding this project.