An extension step for XML Calabash that converts a Mathtype Equation (MTEF) to MathML.
XSLT adapted from: https://github.com/jure/mathtype_to_mathml/tree/master/lib/xsl
Written by Sebastian Bulka, le-tex publishing services GmbH
Development was sponsored by
- Carl Hanser Verlag
- VDE Verband der Elektrotechnik Elektronik Informationstechnik e.V.
- STM Document Engineering Private Limited
If you or your organization benefit from this tool, if you are interested in supporting the continuous maintenance, or if you have a feature request: All development costs have not been covered yet; we do welcome more sponsors. If you are interested, please get in touch with @sbulka, @mkraetke, or @gimsieke.
There are different ways to call the xproc-step.
- Call pipeline for one file.
For setting the MATHTYPE_CP variable, see section 'Java classpath' below.
java -cp $MATHTYPE_CP com.xmlcalabash.drivers.Main -c file:///uri/of/transpect-config.xml mathtype-example.xpl file=file:///uri/of/bin-file.bin
Call <tr:mathtype2mml> from your pipeline.
This requires you to have xproc-util available in calabash, to store debug-files.
Call <tr:mathtype2mml-internal> from your pipeline.
No xproc-util needed, but no debug-files stored therefore.
The debug is still available on xproc-ports, if you want to use them yourself.
From other front-end pipelines such as docx2tex
See https://github.com/transpect/docx2tex (note the MathType extension submodule might not be up to date)
Configure tr:mathtype2mml step by passing options to it:
- href (required): file name (not URI) of one file containing a Mathtype Equation
- .bin (OLE object)
- debug: Output debug messages (xsl:message) if set to 'yes'. Default is 'no'.
- debug-dir: If debug is set, also output intermediate results for each internal xsl-step.
- mml-space-handling: How to handle Mathtype-spacing in Mathml. Possible: 'char', 'mspace'. Default: mspace
MathML states that whitespace-characters should be normalized before rendering.
Problems arise because in Mathtype, whitespace is sometimes also used for indentation.
The option for mml-space-handling was introduced so spaces can be converted to will not be normalized.
If 'char' is chosen, the Unicode-characters for spaces are used, wrapped in <mtext>.
Opening the MathML in e.g. your browser, spaces will likely get normalized. If 'mspace' is chosen, every Mathtype-space will be represented by <mspace>.
You can define your preferred width for each different Mathtype-Space.
Insert what you want to see on the mspace/@width, including unit. (e.g. '1pt' for what is called 1pt-space in Mathtype)
Every option has a default width:
- em-width Default: '1em'
- en-width Default: '0.33em'
- standard-width Default: '0.16em'
- thin-width Default: '0.08em'
- hair-width Default: '0.08em'
- zero-width Default: '0em'
You can file an issue on github for inconveniences with your conversion.
This may be asking for help, reporting bugs or requesting features.
Its sufficient to describe your Problem in natural language, e.g:
"In MathML output, the last parenthese is missing."
If possible, please attach the file which contains your formula, so we can investigate what went wrong.
The extension is shipped with a copy of jruby and some ruby gems.
These need to be on your classpath, or java wont find the files.
In addition, calabash and saxon should be included too, to be able to process XProc and XSLT.
Example (from https://github.com/transpect/calabash-frontend/blob/master/calabash.sh):
If you happen to change java sources, you need to set the classpath as describe above for compilation too.
javac -target 1.7 -source 1.7 -cp $MATHTYPE_CP Ole2Xml.java Ole2XmlConverter.java