MathType MTEF v.5

Abstract

This document describes MTEF, the binary equation format used by MathType 4.0 (all platforms). MTEF is embedded in OLE equation objects produced by MathType, as well as in all the file formats in which MathType can save equations. The methods used by MathType to embed this information in such files is described in a separate document. See How MTEF is Stored in Files and Objects.

This file is from August 9, 1999 and was recovered using the Wayback machine. The MathType folks have more recent documentation, but the license restrictions are incompatible with the GPL.

Contents

Introduction

This document is describes the binary equation format used by MathType 4.0 (all platforms). Although MTEF is not the most friendly medium for defining equations, there have been so many requests for this information, we decided to publish it anyway. We must warn the reader that it is not an easy format to understand and, more importantly, MathType is not at all forgiving in its processing of it. This means that if you send MathType MTEF with errors, it might crash. At a minimum, you will get an equation with formatting problems. Also, it is a binary format. This means that you can't use character strings to represent equations and it makes creating MTEF a little harder with programming languages like Visual Basic.

How MathType stores an equation description in an OLE equation object, a file, or on the clipboard is not described here. Please see the document on MathType MTEF Storage for more information on this subject.

This document sometimes refers to MathType's internal names for values (e.g. parmLINESPACE). These are given for reference purposes and are handy for reducing error when such values are communicated by humans.

Header

MTEF version history:

MTEF data exists in the following versions:

0 MathType for the Mac 1.x (this format is not described here)
1 MathType for the Mac 2.x and MathType for Windows 1.x
2 MathType 3.x and Equation Editor 1.x
3 Equation Editor 3.x (this format is not described here)
4 MathType 3.5
5 MathType 4.0

Version 2 differs from version 1 only in the format of the header.

Header record:

The MTEF version 5 header contains:

length in bytes description value
1 MTEF version 5
1 generating platform 0 for Macintosh, 1 for Windows
1 generating product 0 for MathType, 1 for Equation Editor
1 product version 4
1 product subversion 0
length of app key application key null-terminated string identifying the writing application
(e.g. "DSMT4" for the Design Science version of MathType)
1 equation options if bit 0 is set, equation is inline, else display equation
other bits are unused and must be 0

MTEF Byte Stream

This section describes the actual MTEF data following the header.

Records:

MTEF data consists of a series of records. Each record starts with a record type byte and an options byte, then is followed by data specific to the record.

The overall structure of an MTEF stream is:

Once the header has been read, reading of the MTEF stream should be driven by reading the next record type and then acting on it. If a given record depends on data that is not contained within the record itself, such data is defined by records that precede it.

Record types:

The following record types are used:

value symbol description
0 END end of MTEF, pile, line, embellishment list, or template
1 LINE line (slot)
2 CHAR character
3 TMPL template
4 PILE pile (vertical stack of lines)
5 MATRIX matrix
6 EMBELL character embellishment (e.g. hat, prime)
7 RULER ruler (tab-stop location)
8 FONT_STYLE_DEF font/char style definition
9 SIZE general size
10 FULL full size
11 SUB subscript size
12 SUB2 sub-subscript size
13 SYM symbol size
14 SUBSYM sub-symbol size
15 COLOR color
16 COLOR_DEF color definition
17 FONT_DEF font definition
18 EQN_PREFS equation preferences (sizes, styles, spacing)
19 ENCODING_DEF encoding definition
>= 100 FUTURE for future expansion (see below)

If the record type is 100 or greater, it represents a record that will be defined in a future version of MTEF. For now, readers can assume that an unsigned integer follows the record type and is the number of bytes following it in the record (i.e. it doesn't include the record type and length). This makes it easy for software that reads MTEF to skip these records. Although it might be handy if all records had such a length value, it will only be present on future expansion records (i.e. those with record types >= 100).

Object lists:

LINE, CHAR, TMPL, PILE, MATRIX, and RULER records are followed by object lists that define contents of each equation structure. Each object list contains a sequence of records of any type and terminated by an END record. In a special case for LINE records, if there are no objects in the list, the line record will have the mtefOPT_LINE_NULL option set, in which case the object list is omitted entirely (i.e. no END record). Although there are no restrictions made by the MTEF format on what record types may occur in any particular list, the user interface prevents certain things from happening. For example, the object list defining the contents of a pile contains only LINE records.

Definition records:

Some of MTEF's records (FONT_STYLE_DEF, FONT_DEF, COLOR_DEF, and ENCODING_DEF) do not represent equation structure themselves but are referred to by equation structure records. The definition records in an MTEF stream are assigned indices, starting at 1 (except for ENCODING_DEFs, which start at 5), in the order they appear in the stream. Records which refer to these definitions do so using the index value of the definition. Definition records always appear in the stream before their first reference.

Option values:

Each MTEF 5 record starts with a type byte followed by an option byte. This is different from earlier versions of MTEF where the option flags were stored in the upper 4 bits of the type byte.

The option flag values are record-dependent:

value symbol description
Option flag values for all equation structure records:
0x08 mtefOPT_NUDGE  nudge values follow tag
Option flag values for CHAR records:
0x01 mtefOPT_CHAR_EMBELL character is followed by an embellishment list
0x02 mtefOPT_CHAR_FUNC_START character starts a function (sin, cos, etc.)
0x04 mtefOPT_CHAR_ENC_CHAR_8 character is written with an 8-bit encoded value
0x10 mtefOPT_CHAR_ENC_CHAR_16 character is written with an 16-bit encoded value
0x20 mtefOPT_CHAR_ENC_NO_MTCODE character is written without an 16-bit MTCode value
Option flag values for LINE records:
0x01 mtefOPT_LINE_NULL line is a placeholder only (i.e. not displayed)
0x04 mtefOPT_LINE_LSPACE line spacing value follows tag
Option flag values for LINE and PILE records:
0x02 mtefOPT_LP_RULER RULER record follows LINE or PILE record
Option flag values for COLOR_DEF records:
0x01 mtefCOLOR_CMYK color model is CMYK, else RGB
0x02 mtefCOLOR_SPOT color is a spot color, else a process color
0x04 mtefCOLOR_NAME color has a name, else no name

Dimensional units:

All dimensional values are expressed in MathType’s internal units, 32nds of a printer's point (A point is 1/72 inch).

Signed integer values:

Signed values are written as follows:

range of value algorithm
-128 <= value < 127 value = value + 128
written as a single byte
value < -128 or
value >= 127
value = value + 32768
written as 3 bytes:
byte 1: 255
byte 2: low byte of value
byte 3: high byte of value

Unsigned integer values:

Unsigned values are written as follows:

#
range of value algorithm
value < 255 written as a single byte
value >= 255 written as 3 bytes:
byte 1: 255
byte 2: low byte of value
byte 3: high byte of value

Simple 16-bit integer values:

Some values are written as 16-bits even if the value would fit in a byte. In this case, the value is written low byte followed by high byte.

Nudge values:

LINE, CHAR, TMPL, PILE, MATRIX, and EMBELL records may store the result of nudging (small offsets applied by the user). A nudged record has the mtefOPT_NUDGE option (0x8) and the option byte is followed immediately by the nudge offset. The nudge offset consists of either two bytes or six, depending on the amount of offset. If -128 <= dx < +128 and -128 <= dy < +128, then the offsets are stored as two bytes, dx followed by dy, where each value has 128 added to it before it is written. Otherwise, two bytes of 128 are stored, followed by the offsets, dx and dy, stored as 16-bit values, low byte followed by high byte.

Typeface values:

CHAR records contain a typeface value (biased by 128), written as a signed integer. If the value is positive, it represents one of MathType’s styles:

#
value symbol
1 fnTEXT
2 fnFUNCTION
3 fnVARIABLE
4 fnLCGREEK
5 fnUCGREEK
6 fnSYMBOL
7 fnVECTOR
8 fnNUMBER
9 fnUSER1
10 fnUSER2
11 fnMTEXTRA
12 fnTEXT_FE
22 fnEXPAND 
23 fnMARKER 
24 fnSPACE 

If the value is negative, it represents an explicit font as specified by a FONT record.

Typesize values:

Typesize values (sometimes referred to as lsizes) are used in several MTEF records. Not all values may be valid in a particular record. Their meaning is as follows:

value symbol description
0 szFULL full
1 szSUB subscript
2 szSUB2 sub-subscript
3 szSYM symbol
4 szSUBSYM sub-symbol
5 szUSER1 user 1
6 szUSER2 user 2
7 szDELTA delta increment

Character style values:

Character styles are represented by a single byte, bit 0 indicates bold and bit 1 indicates italic. In other words:

0 plain
1 bold
2 italic
3 bold and italic

Horizontal alignment values:

Horizontal alignment values are used in several MTEF records. Not all values may be valid in a particular record. Their meaning is as follows:

1 left justification
2 centered
3 right justification
4 relational operator alignment
5 decimal point alignment

Vertical alignment values:

Vertical alignment values are used in several MTEF records. Not all values may be valid in a particular record. Their meaning is as follows:

0 alignment with baseline of top line
1 alignment with baseline of center line
2 alignment with baseline of bottom line
3 vertical centering
4 alignment with the math axis (center of +,-, brace points, etc.)

Dimension arrays:

In the EQN_PREFS record, sizes and spacing values are both written as dimension arrays. These arrays are used to record the particular settings from the Define Sizes and Define Spacing dialogs used to define the equation. Instead of recording each value as a number, the dimension array captures each value as a character string. This ensures the user always sees the value just as entered, rather than possibly modified by rounding and/or truncation in conversion (e.g. so "2.0 inches" doesn't turn into "1.999 inches").

Each array is written as a single byte count of dimensions in the array, followed by a "nibble stream" containing the dimensions. Each nibble is a 4-bit value, packed 2 per byte. The upper 4 bits of each byte precedes the lower 4 bits. If the array contains an odd number of nibbles, an additional 0 nibble is written to round out the stream to whole bytes.

Each dimension in the array consists of a units nibble (see first table below), followed by a nibble for each character in the value string (see second table below), terminated by a 0xF nibble. The following table shows how each units nibble is interpreted:

0 inches
1 centimeters
2 points
3 picas
4 percentage

The following table shows how each nibble in a value string is interpreted:

0x0-0x9 decimal digit
0xA decimal point
0xB minus sign
0xF end of value string

Record Details

The following details the individual records in MTEF. All values are single bytes unless indicated otherwise.

END record (0):

Consists of:

There is no option byte.

LINE record (1):

Consists of:

The line spacing value, if present, is the distance between the baseline of this line and the line above it.

CHAR record (2):

Consists of:

The character value itself is represented by one or more values. The presence or absence of these value is indicated by options and appear in this order:

16-bit integer MTCode value present unless the mtefOPT_CHAR_ENC_NO_MTCODE option is set
8-bit font position present if the mtefOPT_CHAR_ENC_CHAR_8 option is set
16-bit integer font position present if the mtefOPT_CHAR_ENC_CHAR_16 option is set

The MTCode value defines the character independent of its font. MTCode is a superset of Unicode and is described in MTCode Encoding Tables. The 8-bit and 16-bit font positions are mutually exclusive but may both be absent. This is the position of the character within its font. Some of the common font encodings are given in Font Encoding Tables.

TMPL record (3):

Consists of:

The template selector and variation codes determine the class of the template and various properties of the template, such as which subobjects can be deleted by the user (see Templates). The class of a template determines the order and meaning of each of its subobjects (see Template subobject order).

The variation code may be 1 or 2 bytes long. If the first byte value has the high bit set (0x80), the next byte is read and combined with the first according to this formula:

    variation code = (byte1 & 0x7F)  |  (byte2 << 8)

The template-specific options field is only used for integrals and fence templates:

Fence template option field values (fence alignment):
0 center fence on math axis, place math axis of contents on math axis of containing line (default);
1 center fence on contents, place math axis of contents on math axis of containing line;
2 center fence on contents, center contents on math axis of containing line.
Warning: the expanding integral property is duplicated in the integral templates variation codes (see Limit variations). On reading, MathType only looks at the variation code. 
Integral template option field values:
0 fixed-size integral;
1 the integral expands vertically to fit its contents.

PILE record (4):

Consists of:

MATRIX record (5):

Consists of:

The values for valign, h_just, and v_just are described in PILE above.

The row partition line type list consists of two-bit values for each possible partition line (one more than the number of rows), rounded out to the nearest byte. Each value determines the line style of the corresponding partition line (0 for none, 1 for solid, 2 for dashed, or 3 for dotted). Similarly for the column partition lines.

EMBELL record (6):

Consists of:

The embellishment types are:

value symbol description
2 emb1DOT over single dot
3 emb2DOT over double dot
4 emb3DOT over triple dot
5 emb1PRIME single prime
6 emb2PRIME double prime
7 embBPRIME backwards prime (left of character)
8 embTILDE tilde
9 embHAT hat (circumflex)
10 embNOT diagonal slash through character
11 embRARROW over right arrow
12 embLARROW over left arrow
13 embBARROW over both arrow (left and right)
14 embR1ARROW over right single-barbed arrow
15 embL1ARROW over left single-barbed arrow
16 embMBAR mid-height horizontal bar
17 embOBAR over-bar
18 emb3PRIME triple prime
19 embFROWN over-arc, concave downward
20 embSMILE over-arc, concave upward
21 embX_BARS double diagonal bars
22 embUP_BAR bottom-left to top-right diagonal bar
23 embDOWN_BAR top-left to bottom-right diagonal bar
24 emb4DOT over quad dot
25 embU_1DOT under single dot
26 embU_2DOT under double dot
27 embU_3DOT under triple dot
28 embU_4DOT under quad dot
29 embU_BAR under bar
30 embU_TILDE under tilde (~)
31 embU_FROWN under arc (ends point down)
32 embU_SMILE under arc (ends point up)
33 embU_RARROW under right arrow
34 embU_LARROW under left arrow
35 embU_BARROW under both arrow (left and right)
36 embU_R1ARROW under right arrow (1 barb)
37 embU_L1ARROW under left arrow (1 barb)

RULER record (7):

Consists of:

Each tab stop is described by a tab-stop type (0 for left, 1 for center, 2 for right, 3 for equal, 4 for decimal), followed by a 16-bit integer offset from the left end of the slot or pile with which it is associated.

FONT_STYLE_DEF record (8):

Consists of:

This record associates a character style with a font. See Definition records.

SIZE record (9):

Consists of one of the following cases:

if lsize < 0 (explicit point size):

else if -128 < dsize < +128:

else: (large delta)

Sizes in MathType are represented as a pair of values, lsize and dsize. Lsize stands for "logical size", dsize for "delta size". If it is negative, it is an explicit point size (in 32nds of a point) negated and dsize is ignored. Otherwise, lsize is a typesize value and dsize is a delta from that size:

Simple typesizes, without a delta value, are written using the records described in the next section.

Typesize records (10-14):

Consists of:

These records are just short ways of specifying a simple typesize where dsize is zero. The tag value represents an lsize + 10. So if the tag value is 10, it means equation content following it will be Full size (szFULL), tag value 11 means szSUB, and so on. See typesize.

COLOR records (15):

Consists of:

The appearance of this record in the stream indicates that all following equation records (until the next COLOR record) have the color defined by the indicated COLOR_DEF record.

COLOR_DEF records (16):

Consists of:

This record defines a color (see Definition records). Each color value is written as a 16-bit integer that ranges between 0 and 1000 where 0 is the absence of the color and 1000 is a fully saturated color. So, an RGB color definition for black has all three components at 0.

FONT_DEF records (17):

Consists of:

This record associates an font encoding with a font name. See Definition records.

EQN_PREFS records (18):

Consists of:

When reading arrays, the number of values may be less than or greater than expected. MTEF readers should be driven by the array count. If the array is shorter than expected, assume defaults for the missing values. If the array is longer than expected, the extra values must be skipped to stay in sync with the MTEF stream.

Spacing values are written in the following order:

0 parmLINESPACE Line spacing
1 parmMATRIXROW Matrix row spacing
2 parmMATRIXCOL Matrix column spacing
3 parmSUPHEIGHT Superscript height
4 parmSUBDEPTH Subscript depth
5 parmSUBSUPGAP Sub/superscript gap
6 parmLIMHEIGHT Limit height
7 parmLIMDEPTH Limit depth
8 parmLIMSPACE Limit line spacing
9 parmFRACTHEIGHT Numerator height
10 parmFRACTDEPTH Denominator depth
11 parmFRACTOVER Fraction bar overhang
12 parmFRACTTHICK Fraction bar thickness
13 parmFRACTTHICK2 Sub-fraction bar thickness
14 parmFRACTGAP Slash/diagonal fraction gap
15 parmFENCEOVER Fence overhang
16 parmOPERSPACING Operator spacing (% of normal)
17 parmNONOPERSPACING Non-operator spacing (% of normal)
18 parmCHARWIDTH Character width adjustment
19 parmMINGAP Minimum gap
20 parmVRADGAP Radical gap (vertical)
21 parmHRADGAP Radical gap (horizontal)
22 parmRADWIDTH Radical width (% of normal)
23 parmEMBELLGAP Embellishment gap
24 parmPRIMEHEIGHT Prime Height
25 parmBOX_STROKE_THICK Box stroke thickness
26 parmSTRIKE_THRU_THICK Strike-through thickness
27 parmMATRIX_PART_THICK Matrix partition line thickness
28 parmRAD_THICK Radical stroke thickness
29 parmHORIZ_FENCE_GAP Horizontal fence gap

The style definition array is written as a single byte count followed by that number of style definitions. The order is defined by Typeface values, however only fnTEXT through fnTEXT_FE are written. Each style definition is written as an unsigned integer that is 0 if the style is unused in the equation or is the index of the corresponding FONT_DEF record. If the style is used (not 0), it is followed by a single byte character style.

ENCODING_DEF records (19):

Consists of:

This record defines (see Definition records) a font encoding and is referred to by a FONT_DEF record. In order to reduce the size of the MTEF stream, the following 4 encodings are predefined:

ENCODING_DEF index encoding name
1 MTCode
2 Unknown
3 Symbol
4 MTExtra

This means that the first ENCODING_DEF record in the MTEF stream is considered to have an index of 5. See Expanding MathType's Font and Character Information and MathType's Character Encodings for more information on font encodings.

Templates

This section shows the selector and variation codes for all the templates. The class names can be used to determine the order of subobjects in the list following the template tag (see Template subobject order).

Limit variations:

The following variation codes apply to all templates whose class is BigOpBoxClass or LimBoxClass:

variation bits symbol description
0x0001 tvBO_LOWER lower limit is present
0x0002 tvBO_UPPER upper limit is present
0x0040 tvBO_SUM summation-style limit positions, else integral-style

Template selectors and variations:

Fences (parentheses, etc.):
selector symbol description class
0 tmANGLE angle brackets ParBoxClass
1 tmPAREN parentheses ParBoxClass
2 tmBRACE braces (curly brackets) ParBoxClass
3 tmBRACK square brackets ParBoxClass
4 tmBAR vertical bars ParBoxClass
5 tmDBAR double vertical bars ParBoxClass
6 tmFLOOR floor brackets ParBoxClass
7 tmCEILING ceiling brackets ParBoxClass
8 tmOBRACK open (white) brackets ParBoxClass
variations variation bits symbol description
0x0001 tvFENCE_L left fence is present
0x0002 tvFENCE_R right fence is present
Intervals:
selector symbol description class
9 tmINTERVAL unmatched brackets and parentheses ParBoxClass
variations variation bits symbol description
0x0000 tvINTV_LEFT_LP left fence is left parenthesis
0x0001 tvINTV_LEFT_RP left fence is right parenthesis
0x0002 tvINTV_LEFT_LB left fence is left bracket
0x0003 tvINTV_LEFT_RB left fence is right bracket
0x0000 tvINTV_RIGHT_LP right fence is left parenthesis
0x0010 tvINTV_RIGHT_RP right fence is right parenthesis
0x0020 tvINTV_RIGHT_LB right fence is left bracket
0x0030 tvINTV_RIGHT_RB right fence is right bracket
Radicals (square and nth roots):
selector symbol description class
10 tmROOT radical RootBoxClass
variations variation symbol description
0 tvROOT_SQ square root
1 tvROOT_NTH nth root
Fractions:
selector symbol description class
11 tmFRACT fractions FracBoxClass
variations variation bits symbol description
0x0001 tvFR_SMALL subscript-size slots (piece fraction)
0x0002 tvFR_SLASH fraction bar is a slash
0x0004 tvFR_BASE num. and denom. are baseline aligned
Over and Underbars:
selector symbol description class
12 tmUBAR underbar BarBoxClass
13 tmOBAR overbar BarBoxClass
variations variation bits symbol description
0x0001 tvBAR_DOUBLE bar is doubled, else single
Arrows:
selector symbol description class
14 tmARROW arrow ArroBoxClass
variations variation symbol description
0x0000 tvAR_SINGLE single arrow
0x0001 tvAR_DOUBLE double arrow
0x0002 tvAR_HARPOON harpoon
0x0004 tvAR_TOP top slot is present
0x0008 tvAR_BOTTOM bottom slot is present
0x0010 tvAR_LEFT if single, arrow points left
0x0020 tvAR_RIGHT if single, arrow points right
0x0010 tvAR_LOS if double or harpoon, large over small
0x0020 tvAR_SOL if double or harpoon, small over large
Integrals (see Limit Variations):
selector symbol description class
15 tmINTEG integral BigOpBoxClass
variations variation symbol description
0x0001 tvINT_1 single integral sign
0x0002 tvINT_2 double integral sign
0x0003 tvINT_3 triple integral sign
0x0004 tvINT_LOOP has loop w/o arrows
0x0008 tvINT_CW_LOOP has clockwise loop
0x000C tvINT_CCW_LOOP has counter-clockwise loop
0x0100 tvINT_EXPAND integral signs expand
Sums, products, coproducts, unions, intersections, etc. (see Limit Variations):
selector symbol description class
16 tmSUM sum BigOpBoxClass
17 tmPROD product BigOpBoxClass
18 tmCOPROD coproduct BigOpBoxClass
19 tmUNION union BigOpBoxClass
20 tmINTER intersection BigOpBoxClass
21 tmINTOP integral-style big operator BigOpBoxClass
22 tmSUMOP summation-style big operator BigOpBoxClass
Limits (see Limit Variations):
selector symbol description class
23 tmLIM limits LimBoxClass
variations variation symbol description
0 tvSUBAR single underbar
1 tvDUBAR double underbar
Horizontal braces and brackets:
selector symbol description class
24 tmHBRACE horizontal brace HFenceBoxClass
25 tmHBRACK horizontal bracket HFenceBoxClass
  variation symbol description
0x0001 tvHB_TOP slot is on the top, else on the bottom
Long division:
selector symbol description class
26 tmLDIV long division LDivBoxClass
  variation symbol description
0x0001 tvLD_UPPER upper slot is present
Subscripts and superscripts:
selector symbol description class
27 tmSUB subscript ScrBoxClass
28 tmSUP superscript ScrBoxClass
29 tmSUBSUP subscript and superscript ScrBoxClass
  variation symbol description
0x0001 tvSU_PRECEDES script precedes scripted item,
else follows
Dirac bra-ket notation:
selector symbol description class
30 tmDIRAC bra-ket notation DiracBoxClass
  variation symbol description
0x0001 tvDI_LEFT left part is present
0x0002 tvDI_RIGHT right part is present
Vectors:
selector symbol description class
31 tmVEC vector HatBoxClass
  variation symbol description
0x0001 tvVE_LEFT arrow points left
0x0002 tvVE_RIGHT arrow points right
0x0004 tvVE_UNDER arrow under slot, else over slot
0x0008 tvVE_HARPOON harpoon
Hats, arcs, tilde, joint status:
selector symbol description class
32 tmTILDE tilde over characters HatBoxClass
33 tmHAT hat over characters HatBoxClass
34 tmARC arc over characters HatBoxClass
35 tmJSTATUS joint status construct HatBoxClass
Overstrikes (cross-outs):
selector symbol description class
36 tmSTRIKE overstrike (cross-out) StrikeBoxClass
  variation symbol description
0x0001 tvST_HORIZ line is horizontal, else slashes
0x0002 tvST_UP if slashes, slash from lower-left to upper-right is present
0x0004 tvST_DOWN if slashes, slash from upper-left to lower-right is present
Boxes:
selector symbol description class
37 tmBOX box TBoxBoxClass
  variation symbol description
0x0001 tvBX_ROUND corners are round, else square
0x0002 tvBX_LEFT left side is present
0x0004 tvBX_RIGHT right side is present
0x0008 tvBX_TOP top side is present
0x0010 tvBX_BOTTOM bottom side is present

Template subobject order:

Template subobjects appear in object lists in the order that matches the movement of the insertion point within a template in the MathType user interface. For template classes that have more than one slot, the following list shows the order of subobjects for all templates with that class:

ArroBoxClass: expanding arrows

BigOpBoxClass: integrals, summations, products, etc.

DiracBoxClass: three-part bracket structure

FracBoxClass: fractions with a horizontal bar

HFenceBoxClass horizontal expanding braces

LDivBoxClass long division

LimBoxClass limits

ParBoxClass parenthesized or bracketed slots

RootBoxClass radical sign

ScrBoxClass subscripts and superscripts

SlashBoxClass fractions with a diagonal bar

Example

In order to illustrate MTEF with a concrete example, in this section will examine the MTEF byte stream in detail for the quadratic formula:

quadratic equation

For this equation, MathType 4.0 for Windows generates the following MTEF:

byte position byte value meaning record
0 0x0000 5, 0x05 MTEF version header
1 0x0001 1, 0x01 Windows
2 0x0002 0, 0x00 MathType
3 0x0003 4, 0x04 MT major version
4 0x0004 0, 0x00 MT minor version
5 0x0005 68, 0x44, 'D' application key
6 0x0006 83, 0x53, 'S'
7 0x0007 77, 0x4D, 'M'
8 0x0008 84, 0x54, 'T'
9 0x0009 52, 0x34, '4'
10 0x000A 0, 0x00
11 0x000B 0, 0x00 equation options
12 0x000C 19, 0x13 record type ENCODING_DEF
encoding #5
13 0x000D 87, 0x57, 'W' encoding name
"WinAllBasicCodePages"
14 0x000E 105, 0x69, 'i'
15 0x000F 110, 0x6E, 'n'
16 0x0010 65, 0x41, 'A'
17 0x0011 108, 0x6C, 'l'
18 0x0012 108, 0x6C, 'l'
19 0x0013 66, 0x42, 'B'
20 0x0014 97, 0x61, 'a'
21 0x0015 115, 0x73, 's'
22 0x0016 105, 0x69, 'i'
23 0x0017 99, 0x63, 'c'
24 0x0018 67, 0x43, 'C'
25 0x0019 111, 0x6F, 'o'
26 0x001A 100, 0x64, 'd'
27 0x001B 101, 0x65, 'e'
28 0x001C 80, 0x50, 'P'
29 0x001D 97, 0x61, 'a'
30 0x001E 103, 0x67, 'g'
31 0x001F 101, 0x65, 'e'
32 0x0020 115, 0x73, 's'
33 0x0021 0, 0x00
34 0x0022 17, 0x11 record type FONT_DEF
font def #1
35 0x0023 5, 0x05 index of encoding
WinAllBasicCodePages
36 0x0024 84, 0x54, 'T' font name
"Times New Roman"
37 0x0025 105, 0x69, 'i'
38 0x0026 109, 0x6D, 'm'
39 0x0027 101, 0x65, 'e'
40 0x0028 115, 0x73, 's'
41 0x0029 32, 0x20, ' '
42 0x002A 78, 0x4E, 'N'
43 0x002B 101, 0x65, 'e'
44 0x002C 119, 0x77, 'w'
45 0x002D 32, 0x20, ' '
46 0x002E 82, 0x52, 'R'
47 0x002F 111, 0x6F, 'o'
48 0x0030 109, 0x6D, 'm'
49 0x0031 97, 0x61, 'a'
50 0x0032 110, 0x6E, 'n'
51 0x0033 0, 0x00
52 0x0034 17, 0x11 record type FONT_DEF
font def #2
53 0x0035 3, 0x03 index of encoding
Symbol
54 0x0036 83, 0x53, 'S' font name
"Symbol"
55 0x0037 121, 0x79, 'y'
56 0x0038 109, 0x6D, 'm'
57 0x0039 98, 0x62, 'b'
58 0x003A 111, 0x6F, 'o'
59 0x003B 108, 0x6C, 'l'
60 0x003C 0, 0x00
61 0x003D 17, 0x11 record type FONT_DEF
font def #3
62 0x003E 5, 0x05 index of encoding
WinAllBasicCodePages
63 0x003F 67, 0x43, 'C' font name
"Courier New"
64 0x0040 111, 0x6F, 'o'
65 0x0041 117, 0x75, 'u'
66 0x0042 114, 0x72, 'r'
67 0x0043 105, 0x69, 'i'
68 0x0044 101, 0x65, 'e'
69 0x0045 114, 0x72, 'r'
70 0x0046 32, 0x20, ' '
71 0x0047 78, 0x4E, 'N'
72 0x0048 101, 0x65, 'e'
73 0x0049 119, 0x77, 'w'
74 0x004A 0, 0x00
75 0x004B 17, 0x11 record type FONT_DEF
font def #4
76 0x004C 4, 0x04 index of encoding
MTExtra
77 0x004D 77, 0x4D, 'M' font name
"MT Extra"
78 0x004E 84, 0x54, 'T'
79 0x004F 32, 0x20, ' '
80 0x0050 69, 0x45, 'E'
81 0x0051 120, 0x78, 'x'
82 0x0052 116, 0x74, 't'
83 0x0053 114, 0x72, 'r'
84 0x0054 97, 0x61, 'a'
85 0x0055 0, 0x00
86 0x0056 18, 0x12 record type EQN_PREFS
87 0x0057 0, 0x00 options
88 0x0058 8, 0x08 size array count
89 0x0059 33, 0x21, '!' nibble array containing:
size #1: "12 points"
size #2: "58 %"
size #3: "42 %"
size #4: "150 %"
size #5: "100 %"
size #6: "75 %"
size #7: "150 %"
size #8: "1 point"
90 0x005A 47, 0x2F, '/'
91 0x005B 69, 0x45, 'E'
92 0x005C 143, 0x8F
93 0x005D 68, 0x44, 'D'
94 0x005E 47, 0x2F, '/'
95 0x005F 65, 0x41, 'A'
96 0x0060 80, 0x50, 'P'
97 0x0061 244, 0xF4
98 0x0062 16, 0x10
99 0x0063 15, 0x0F
100 0x0064 71, 0x47, 'G'
101 0x0065 95, 0x5F, '_'
102 0x0066 65, 0x41, 'A'
103 0x0067 80, 0x50, 'P'
104 0x0068 242, 0xF2
105 0x0069 31, 0x1F
106 0x006A 30, 0x1E spacing array count
107 0x006B 65, 0x41, 'A' nibble array containing
30 values
108 0x006C 80, 0x50, 'P'
109 0x006D 244, 0xF4
110 0x006E 21, 0x15
111 0x006F 15, 0x0F
112 0x0070 65, 0x41, 'A'
113 0x0071 0, 0x00
114 0x0072 244, 0xF4
115 0x0073 69, 0x45, 'E'
116 0x0074 244, 0xF4
117 0x0075 37, 0x25, '%'
118 0x0076 244, 0xF4
119 0x0077 143, 0x8F
120 0x0078 66, 0x42, 'B'
121 0x0079 95, 0x5F, '_'
122 0x007A 65, 0x41, 'A'
123 0x007B 0, 0x00
124 0x007C 244, 0xF4
125 0x007D 16, 0x10
126 0x007E 15, 0x0F
127 0x007F 67, 0x43, 'C'
128 0x0080 95, 0x5F, '_'
129 0x0081 65, 0x41, 'A'
130 0x0082 0, 0x00
131 0x0083 244, 0xF4
132 0x0084 143, 0x8F
133 0x0085 69, 0x45, 'E'
134 0x0086 244, 0xF4
135 0x0087 42, 0x2A, '*'
136 0x0088 95, 0x5F, '_'
137 0x0089 72, 0x48, 'H'
138 0x008A 244, 0xF4
139 0x008B 143, 0x8F
140 0x008C 65, 0x41, 'A'
141 0x008D 0, 0x00
142 0x008E 244, 0xF4
143 0x008F 16, 0x10
144 0x0090 15, 0x0F
145 0x0091 64, 0x40, '@'
146 0x0092 244, 0xF4
147 0x0093 143, 0x8F
148 0x0094 65, 0x41, 'A'
149 0x0095 127, 0x7F
150 0x0096 72, 0x48, 'H'
151 0x0097 244, 0xF4
152 0x0098 16, 0x10
153 0x0099 15, 0x0F
154 0x009A 65, 0x41, 'A'
155 0x009B 42, 0x2A, '*'
156 0x009C 95, 0x5F, '_'
157 0x009D 68, 0x44, 'D'
158 0x009E 95, 0x5F, '_'
159 0x009F 69, 0x45, 'E'
160 0x00A0 244, 0xF4
161 0x00A1 95, 0x5F, '_'
162 0x00A2 69, 0x45, 'E'
163 0x00A3 244, 0xF4
164 0x00A4 95, 0x5F, '_'
165 0x00A5 65, 0x41, 'A'
166 0x00A6 15, 0x0F
167 0x00A7 12, 0x0C style array count
168 0x00A8 1, 0x01 style #1:
font def #1, plain
169 0x00A9 0, 0x00
170 0x00AA 1, 0x01 style #2:
font def #1, plain
171 0x00AB 0, 0x00
172 0x00AC 1, 0x01 style #3:
font def #1, italic
173 0x00AD 2, 0x02
174 0x00AE 2, 0x02 style #4:
font def #2, italic
175 0x00AF 2, 0x02
176 0x00B0 2, 0x02 style #5:
font def #2, plain
177 0x00B1 0, 0x00
178 0x00B2 2, 0x02 style #6:
font def #2, plain
179 0x00B3 0, 0x00
180 0x00B4 1, 0x01 style #7:
font def #1, bold
181 0x00B5 1, 0x01
182 0x00B6 1, 0x01 style #8:
font def #1, plain
183 0x00B7 0, 0x00
184 0x00B8 3, 0x03 style #9:
font def #3, plain
185 0x00B9 0, 0x00
186 0x00BA 1, 0x01 style #10:
font def #1, plain
187 0x00BB 0, 0x00
188 0x00BC 4, 0x04 style #11:
font def #4, plain
189 0x00BD 0, 0x00
190 0x00BE 0, 0x00 style #12: (not used)
191 0x00BF 10, 0x0A record type SIZE_FULL
192 0x00C0 1, 0x01 record type LINE
193 0x00C1 0, 0x00 options
194 0x00C2 3, 0x03 record type TMPL
fraction
195 0x00C3 0, 0x00 options
196 0x00C4 11, 0x0B selector: tmFRACT
197 0x00C5 0, 0x00 variation: none
198 0x00C6 0, 0x00 template-specific options
199 0x00C7 1, 0x01 record type LINE
numerator
200 0x00C8 0, 0x00 options
201 0x00C9 2, 0x02 record type CHAR
- (minus sign)
202 0x00CA 4, 0x04 options: mtefOPT_CHAR_ENC_CHAR_8
203 0x00CB 134, 0x86 typeface: 134 - 128 = 6 (Symbol style)
204 0x00CC 18, 0x12 MTCode value: 0x2212 (minus sign)
205 0x00CD 34, 0x22, '"'
206 0x00CE 45, 0x2D, '-' font-encoded value: 0x2D (minus sign)
207 0x00CF 2, 0x02 record type CHAR
b
208 0x00D0 0, 0x00 options
209 0x00D1 131, 0x83 typeface: 131 - 128 = 3 (Variable style)
210 0x00D2 98, 0x62, 'b' MTCode value: 0x0062 ('b')
211 0x00D3 0, 0x00
212 0x00D4 2, 0x02 record type CHAR
plus-minus sign
213 0x00D5 4, 0x04 options: mtefOPT_CHAR_ENC_CHAR_8
214 0x00D6 134, 0x86 typeface: 134 - 128 = 6 (Symbol style)
215 0x00D7 177, 0xB1 MTCode value: 0x00B1 (plus-minus sign)
216 0x00D8 0, 0x00
217 0x00D9 177, 0xB1 font-encoded value: 0xB1 (plus-minus sign)
218 0x00DA 3, 0x03 record type TMPL
square root
219 0x00DB 0, 0x00 options
220 0x00DC 10, 0x0A selector: tmROOT
221 0x00DD 0, 0x00 variations: tvROOT_SQ (square root)
222 0x00DE 0, 0x00 template-specific options
223 0x00DF 1, 0x01 record type LINE
radicand
224 0x00E0 0, 0x00 options
225 0x00E1 2, 0x02 record type CHAR
b
226 0x00E2 0, 0x00 options
227 0x00E3 131, 0x83 typeface: 131 - 128 = 3 (Variable style)
228 0x00E4 98, 0x62, 'b' MTCode value: 0x0062 ('b')
229 0x00E5 0, 0x00
230 0x00E6 3, 0x03 record type TMPL
superscript
231 0x00E7 0, 0x00 options
232 0x00E8 28, 0x1C selector: tmSUP
233 0x00E9 0, 0x00 variations: none
234 0x00EA 0, 0x00 template-specific options
235 0x00EB 11, 0x0B record type SIZE_SUB
236 0x00EC 1, 0x01 record type LINE
missing superscript
237 0x00ED 1, 0x01 options: mtefOPT_LINE_NULL
238 0x00EE 1, 0x01 record type LINE
subscript
239 0x00EF 0, 0x00 options
240 0x00F0 2, 0x02 record type CHAR
2
241 0x00F1 0, 0x00 options
242 0x00F2 136, 0x88 typeface: 136 - 128 = 8 (Number style)
243 0x00F3 50, 0x32, '2' MTCode value: 0x0032 ('2')
244 0x00F4 0, 0x00
245 0x00F5 0, 0x00 record type END of subscript line
246 0x00F6 0, 0x00 record type END of subscript template
247 0x00F7 10, 0x0A record type SIZE_FULL
248 0x00F8 2, 0x02 record type CHAR
- (minus sign)
249 0x00F9 4, 0x04

options: mtefOPT_CHAR_ENC_CHAR_8

250 0x00FA 134, 0x86 typeface: 134 - 128 = 6 (Symbol style)
251 0x00FB 18, 0x12 MTCode value: 0x2212 (minus sign)
252 0x00FC 34, 0x22, '"'
253 0x00FD 45, 0x2D, '-' font-encoded value: 0x2D (minus sign)
254 0x00FE 2, 0x02 record type CHAR
4
255 0x00FF 0, 0x00 options
256 0x0100 136, 0x88 typeface: 136 - 128 = 8 (Number style)
257 0x0101 52, 0x34, '4' MTCode value: 0x0034 ('4')
258 0x0102 0, 0x00
259 0x0103 2, 0x02 record type CHAR
a
260 0x0104 0, 0x00 options
261 0x0105 131, 0x83 typeface: 131 - 128 = 3 (Variable style)
262 0x0106 97, 0x61, 'a' MTCode value: 0x0061 ('a')
263 0x0107 0, 0x00
264 0x0108 2, 0x02 record type CHAR
c
265 0x0109 0, 0x00 options
266 0x010A 131, 0x83 typeface: 131 - 128 = 3 (Variable style)
267 0x010B 99, 0x63, 'c' MTCode value: 0x0063 ('c')
268 0x010C 0, 0x00
269 0x010D 0, 0x00 record type END of radicand line
270 0x010E 11, 0x0B record type SIZE_SUB
271 0x010F 1, 0x01 record type LINE
missing radicand
272 0x0110 1, 0x01 options: mtefOPT_LINE_NULL
273 0x0111 0, 0x00 record type END of radical template
274 0x0112 0, 0x00 record type END of numerator line
275 0x0113 10, 0x0A record type SIZE_FULL
276 0x0114 1, 0x01 record type LINE
denominator
277 0x0115 0, 0x00 options
278 0x0116 2, 0x02 record type CHAR
2
279 0x0117 0, 0x00 options
280 0x0118 136, 0x88 typeface: 136 - 128 = 8 (Number style)
281 0x0119 50, 0x32, '2' MTCode value: 0x0032 ('2')
282 0x011A 0, 0x00
283 0x011B 2, 0x02 record type CHAR
a
284 0x011C 0, 0x00 options
285 0x011D 131, 0x83 typeface: 131 - 128 = 3 (Variable style)
286 0x011E 97, 0x61, 'a' MTCode value: 0x0061 ('a')
287 0x011F 0, 0x00
288 0x0120 0, 0x00 record type END of denominator line
289 0x0121 0, 0x00 record type END of fraction template
290 0x0122 0, 0x00 record type END of equation line
291 0x0123 0, 0x00 record type END of equation
Get RTF to LaTeX converter at SourceForge