# MathParser - parses MathML to LaTeX
Homepage of MathParser, a program that converts MathML to LaTeX
Author: Tilman Walther
Keywords: Mathcad, LaTeX, MathML, convert, conversion, MathML2LaTeX
Date: 2004-01-31

## Index

- Starting MathParser
- Using MathParser
- Advanced Users: Editing MathParser's substitution table and standard header

## Starting MathParser

After downloading the program file, MathParser can usually be started with an double click on the file.
If problems occur with that even though Java is installed on your computer, try a shortcut:

1. Click right on the program file and choose "Create Shortcut"
2. Click right on the new shortcut and choose "Properties"
3. In the new window change on the "General" tab the name of the shortcut from "Shortcut to MathParser..." in "MathParser" and on the "Shortcut" tab the target in "java -jar MathParser052.jar". Then click "OK".

## Using MathParser

1. Enter the input file. You can also use the "Browse..." button to choose the input file.
2. Set the format of the input file. If the input is pure MathML (usually files ending with '.mml'), choose MathML.
   If the MathML code is embedded in HTML (usually files ending with '.html'), choose HTML/MathML.
   If you want to convert a Mathcad file, export it as "HTML/MathML file for IBM techexplorer". In older versions (Mathcad 2001) you will find this file format if you choose "Save as.." from the "File" menu.
   In Mathcad 11 you have to choose "Save as Web Page...". When you save the file, an options screen will appear. Select "Save equation as: MathML" and "Display using: IBM Techexplorer".
   Select Mathcad MathML/HTML as file format in MathParser then.
3. If you want the result of the conversion to be saved directly, choose "File" from the "Output" box and enter the name of the target file.
   If you want to get the conversion result on screen, choose "Window".
4. Choose from the "Options" menu:
   - Mark "Write LaTeX header" if you want a complete LaTeX document to be generated. In this case MathParser uses its standard header. (See also: "Advanced Users: Editing MathParser's substitution table and standard header")
   - Mark "Skip unknown entities" if you do not want unknown MathML keywords to be inserted in the output with the comment 'NOT_FOUND'.
   - You can choose in what way "Formulae" are inserted in the output: Embedded (into the text), set off (every formula in a new paragraph) or enumerated (every formula in a new paragraph with enumeration).
5. Once you have defined all options start the conversion by clicking the "Convert" button.
   When finished the convertion a message will appear or, if you chose "Window" for output, the LaTeX code will be shown in a new window where you can edit and copy the resulting code.

## Advanced Users: Editing MathParser's substitution table and standard header

MathParser needs two text files for MathML conversion: 'substitutions.txt' defines, which LaTeX keyword replaces which MathML keyword, 'header.txt' contains the LaTeX header that is inserted at the beginning of the output if you chose "Write LaTeX header" from the options menu.
Both files can be edited with a simple text editor.
You can download 'substitutions.txt' and 'header.txt' from the MathParser Homepage or extract it from the program file with a ZIP compatible compression utility.

### Editing the files

In 'header.txt' simply write down the LaTeX header for the converted files.
In 'substitutions.txt' you can enter a LaTeX substitution for a MathML element in every line.
There are two kinds of MathML elements to be substituted: Entities end tags. Entities are place holders for special characters and symbols which can be substituted directly. Tags define a logical correlation between blocks.
Enter a substitution for an entity in this way:

    [entity] [tab(s)] [LaTeX substitution]

Example:

    ε			\epsilon

(Substitution for the MathML entity that represents the greek character epsilon)
Tags enclose one or more blocks of data like this: <tag>block(s)</tag>. Since the order of the inner blocks in MathML can differ from the order in LaTeX notation, the substitution has to disclose MathParser the correct sequence of blocks. For this purpose the keyword %BLOCK[block no.]% is used.
Example:

    <mroot>			\sqrt[%BLOCK2%]{%BLOCK1%}

This is the substitution for the MathML element for roots. In MathML the root's exponent follows the radicand while in LaTeX the notation is the other way around. Thus we need to tell MathParser to alter the block order by exchanging BLOCK2 and BLOCK1.

### Applying the edited files to MathParser

To use your edited files with MathParser, just put it into the same directory with the program file. On startup, MathParser seeks for 'substitutions.txt' and 'header.txt' in the program directory. If they are not found the built-in configuration files are used.