# Converting equations

## Abstract

The purpose of this document is describe how to convert equations from one format to another. It also defines which formats can be converted to which other formats. The .NET sample included in the SDK has code demonstrating most valid combinations of input and output equation format types.

The MathType SDK can convert equations from image files, text files and the clipboard to equations of the same or different format. The following are equation formats that ConvertEquations can convert from:

WMF file

GIF file

EPS file

MathML in a text file

TeX in a text file

Clipboard text

Clipboard Embedded Object (copy a MathType equation to the clipboard from within Microsoft Word)

The following are equation formats that ConvertEquations can convert to:

WMF file

GIF file

EPS file

MathML in a text file*

TeX in a text file*

Base 64 MTEF in a text file

* ConvertEquations will convert to any text equation format that MathType has a translator for.

Any of the input equation formats can be converted to any of the output equation formats, though special processing is required for those formats that do not contain embedded MTEF, which include any textual representation of an equation that does not have embedded MTEF. WMF, GIF and EPS if they contain MathType equations, should contain MTEF. See the conversion matrix table in the API documentation for MTXFormEqn.

## Sample code

The sample code is located in the DotNET folder of the SDK, and contains two sets of classes to manage input and output equations. These classes are primarily concerned with managing the appropriate parameter values for the MTXFormEqn SDK API. The input equations also need to obtain MTEF for those equations that do not have it. The output equations also write text equations to text files, and take a string parameter with the name of the translator to use (this is the translator file name as it appears in the Translators folder in the MathType installation folder).

Once input and output equation objects have been created, the equation can be converted by calling the Convert method on the ConvertEquation class. The Convert method first obtains the equation from a file if needed and then obtains the MTEF, again if needed. The MTXFormEqn API is then called, and the equation is saved to a file as appropriate.

Before running the sample you'll need to either create the folders returned by the two helper methods in the Program class; GetInputFolder and GetOutputFolder, or change these routines to return folders of your preference.

<a><button>Back to MathType SDK intro page</button></a> |