MathType MTEF v.5 (MathType 4.0 and later) Abstract This document describes MTEF, the binary equation format used by MathType 4.0 and later (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 are described in a separate document. See How MTEF is Stored in Files and Objects. Introduction This document describes the binary equation format used by MathType 4.0 and later (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 errors when such values are communicated by humans. Header MTEF version history: MTEF data exists in the following versions: 0MathType for Mac 1.x (this format is not described here) 1MathType for Mac 2.x and MathType for Windows 1.x 2MathType 3.x and Equation Editor 1.x 3Equation Editor 3.x (this format is not described here) 4MathType 3.5 5MathType 4.0 and later Version 2 differs from version 1 only in the format of the header. Header record: The MTEF version 5 header contains: length in bytes descriptionvalue 1 MTEF version5 1 generating platform0 for Mac, 1 for Windows 1 generating product0 for MathType, 1 for Equation Editor 1 product version4 or later 1 product subversion0 (or ???) length of app key application keynull-terminated string identifying the writing application (e.g. "DSMT4" for the Wiris version of MathType) 1 equation optionsif 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: MTEF header equation preferences (size, style, spacing), preceded by the definition records to which they refer initial SIZE record PILE or LINE record contents of PILE or LINE END record 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: valuesymboldescription 0ENDend of MTEF, pile, line, embellishment list, or template 1LINEline (slot) 2CHARcharacter 3TMPLtemplate 4PILEpile (vertical stack of lines) 5MATRIXmatrix 6EMBELLcharacter embellishment (e.g. hat, prime) 7RULERruler (tab-stop location) 8FONT_STYLE_DEFfont/char style definition 9SIZEgeneral size 10FULLfull size 11SUBsubscript size 12SUB2sub-subscript size 13SYMsymbol size 14SUBSYMsub-symbol size 15COLORcolor 16COLOR_DEFcolor definition 17FONT_DEFfont definition 18EQN_PREFSequation preferences (sizes, styles, spacing) 19ENCODING_DEFencoding definition ≥ 100FUTUREfor 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: valuesymboldescription Option flag values for all equation structure records: 0×08mtefOPT_NUDGEnudge values follow tag Option flag values for CHAR records: 0×01mtefOPT_CHAR_EMBELLcharacter is followed by an embellishment list 0×02mtefOPT_CHAR_FUNC_STARTcharacter starts a function (sin, cos, etc.) 0×04mtefOPT_CHAR_ENC_CHAR_8character is written with an 8-bit encoded value 0×10mtefOPT_CHAR_ENC_CHAR_16character is written with an 16-bit encoded value 0×20mtefOPT_CHAR_ENC_NO_MTCODEcharacter is written without an 16-bit MTCode value Option flag values for LINE records: 0×01mtefOPT_LINE_NULLline is a placeholder only (i.e. not displayed) 0×04mtefOPT_LINE_LSPACEline spacing value follows tag Option flag values for LINE and PILE records: 0×02mtefOPT_LP_RULERRULER record follows LINE or PILE record Option flag values for COLOR_DEF records: 0×01mtefCOLOR_CMYKcolor model is CMYK, else RGB 0×02mtefCOLOR_SPOTcolor is a spot color, else a process color 0×04mtefCOLOR_NAMEcolor 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 valuealgorithm -128 ≤ value < 127 value = value + 128 written as a single byte value < -128 or value ≥ 127value = 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 valuealgorithm value < 255written as a single byte value ≥ 255written 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 (0×8) 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: valuesymbol 1fnTEXT 2fnFUNCTION 3fnVARIABLE 4fnLCGREEK 5fnUCGREEK 6fnSYMBOL 7fnVECTOR 8fnNUMBER 9fnUSER1 10fnUSER2 11fnMTEXTRA 12fnTEXT_FE 22fnEXPAND 23fnMARKER 24fnSPACE 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: valuesymboldescription 0szFULL full 1szSUB subscript 2szSUB2 sub-subscript 3szSYM symbol 4szSUBSYM sub-symbol 5szUSER1 user 1 6szUSER2 user 2 7szDELTA 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: 0plain 1bold 2italic 3bold 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: 1left justification 2centered 3right justification 4relational operator alignment 5decimal 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: 0alignment with baseline of top line 1alignment with baseline of center line 2alignment with baseline of bottom line 3vertical 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 0×F nibble. The following table shows how each units nibble is interpreted: 0inches 1centimeters 2points 3picas 4percentage The following table shows how each nibble in a value string is interpreted: 0×0-0×9decimal digit 0×Adecimal point 0×Bminus sign 0×Fend 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: record type (0) There is no option byte. LINE record (1): Consists of: record type (1) options [nudge] if mtefOPT_NUDGE is set [line spacing] if mtefOPT_LINE_LSPACE is set (16-bit integer) [RULER record] if mtefOPT_LP_RULER is set object list contents of line (a single pile, characters and templates, or nothing) 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: record type (2) options [nudge] if mtefOPT_NUDGE is set [typeface] typeface value (signed integer; see FONT_STYLE_DEF record below) [character] character value (see below) [embellishment list] if mtefOPT_CHAR_EMBELL is set (embellishments) 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 valuepresent unless the mtefOPT_CHAR_ENC_NO_MTCODE option is set 8-bit font positionpresent if the mtefOPT_CHAR_ENC_CHAR_8 option is set 16-bit integer font positionpresent 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: record type (3) options [nudge] if mtefOPT_NUDGE is set [selector] template selector code [variation] template variation code (1 or 2 bytes; see below) [options] template-specific options [subobject list] either a single character (e.g. sigma in a summation) and/or lines 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 (0×80), the next byte is read and combined with the first according to this formula: variation code = (byte1 & 0×7F) | (byte2 << 8) The template-specific options field is only used for integrals and fence templates: Fence template option field values (fence alignment): 0center fence on math axis, place math axis of contents on math axis of containing line (default); 1center fence on contents, place math axis of contents on math axis of containing line; 2center 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: 0fixed-size integral; 1the integral expands vertically to fit its contents. PILE record (4): Consists of: record type (4) options [nudge] if mtefOPT_NUDGE is set [halign] horizontal alignment [valign] vertical alignment [RULER record] if mtefOPT_LP_RULER is set [object list] list of lines contained by the pile MATRIX record (5): Consists of: record type (5) options [nudge] if mtefOPT_NUDGE is set [valign] vertical alignment of matrix within container [h_just] horizontal alignment within columns [v_just] vertical alignment within columns [rows] number of rows [cols] number of columns [row_parts] row partition line types (see below) [col_parts] column partition line types (see below) [object list] list of lines, one for each element of the matrix, in order from left-to-right and top-to-bottom 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: record type (6) options [nudge] if mtefOPT_NUDGE is set [embell] embellishment type The embellishment types are: valuesymboldescription 2emb1DOTover single dot 3emb2DOTover double dot 4emb3DOTover triple dot 5emb1PRIMEsingle prime 6emb2PRIMEdouble prime 7embBPRIMEbackwards prime (left of character) 8embTILDEtilde 9embHAThat (circumflex) 10embNOTdiagonal slash through character 11embRARROWover right arrow 12embLARROWover left arrow 13embBARROWover both arrow (left and right) 14embR1ARROWover right single-barbed arrow 15embL1ARROWover left single-barbed arrow 16embMBARmid-height horizontal bar 17embOBARover-bar 18emb3PRIMEtriple prime 19embFROWNover-arc, concave downward 20embSMILEover-arc, concave upward 21embX_BARSdouble diagonal bars 22embUP_BARbottom-left to top-right diagonal bar 23embDOWN_BARtop-left to bottom-right diagonal bar 24emb4DOTover quad dot 25embU_1DOTunder single dot 26embU_2DOTunder double dot 27embU_3DOTunder triple dot 28embU_4DOTunder quad dot 29embU_BARunder bar 30embU_TILDEunder tilde (~) 31embU_FROWNunder arc (ends point down) 32embU_SMILEunder arc (ends point up) 33embU_RARROWunder right arrow 34embU_LARROWunder left arrow 35embU_BARROWunder both arrow (left and right) 36embU_R1ARROWunder right arrow (1 barb) 37embU_L1ARROWunder left arrow (1 barb) RULER record (7): Consists of: record type (7) [n_stops] number of tab-stops [tab-stop list] tab-stops in order from left-to-right 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: record type (8) [font_def_index] index of mtefFONT_DEF record (unsigned integer) [char_style] character style bits 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): record type (9) 101 -point size (16 bit integer) else if -128 < dsize < +128: record type (9) lsize (typesize) dsize + 128 else: (large delta) record type (9) 100 lsize (typesize) dsize (16 bit integer) 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: record type (10-14) 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: record type (15) [color_def_index] index of corresponding COLOR_DEF record (unsigned integer) 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: record type (16) [options] model is RGB unless mtefCOLOR_CMYK bit is set; type is process unless mtefCOLOR_SPOT bit is set; color is unnamed unless mtefCOLOR_NAME bit is set [color values] if RGB, 3 values (red, green, blue); if CMYK, 4 values (cyan, magenta, yellow, black); see below for details [name] null-terminated color name; appears only if mtefCOLOR_NAME option is set 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: record type (17) [enc_def_index] index of corresponding ENCODING_DEF record (unsigned integer) [name] null-terminated font name This record associates an font encoding with a font name. See Definition records. EQN_PREFS records (18): Consists of: record type (18) [options] none defined in this version of MTEF [sizes] dimension array for typesize definitions [spaces] dimension array for spacing definitions (see below) [styles] array of style definitions (see below) 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: 0parmLINESPACELine spacing 1parmMATRIXROWMatrix row spacing 2parmMATRIXCOLMatrix column spacing 3parmSUPHEIGHTSuperscript height 4parmSUBDEPTHSubscript depth 5parmSUBSUPGAPSub/superscript gap 6parmLIMHEIGHTLimit height 7parmLIMDEPTHLimit depth 8parmLIMSPACELimit line spacing 9parmFRACTHEIGHTNumerator height 10parmFRACTDEPTHDenominator depth 11parmFRACTOVERFraction bar overhang 12parmFRACTTHICKFraction bar thickness 13parmFRACTTHICK2Sub-fraction bar thickness 14parmFRACTGAPSlash/diagonal fraction gap 15parmFENCEOVERFence overhang 16parmOPERSPACINGOperator spacing (% of normal) 17parmNONOPERSPACINGNon-operator spacing (% of normal) 18parmCHARWIDTHCharacter width adjustment 19parmMINGAPMinimum gap 20parmVRADGAPRadical gap (vertical) 21parmHRADGAPRadical gap (horizontal) 22parmRADWIDTHRadical width (% of normal) 23parmEMBELLGAPEmbellishment gap 24parmPRIMEHEIGHTPrime Height 25parmBOX_STROKE_THICKBox stroke thickness 26parmSTRIKE_THRU_THICKStrike-through thickness 27parmMATRIX_PART_THICKMatrix partition line thickness 28parmRAD_THICKRadical stroke thickness 29parmHORIZ_FENCE_GAPHorizontal 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: record type (19) [name] null-terminated encoding name 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 indexencoding name 1MTCode 2Unknown 3Symbol 4MTExtra This means that the first ENCODING_DEF record in the MTEF stream is considered to have an index of 5. See Extending 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 bitssymboldescription 0×0001tvBO_LOWERlower limit is present 0×0002tvBO_UPPERupper limit is present 0×0040tvBO_SUMsummation-style limit positions, else integral-style Template selectors and variations: Fences (parentheses, etc.): selectorsymboldescriptionclass 0tmANGLEangle bracketsParBoxClass 1tmPARENparenthesesParBoxClass 2tmBRACEbraces (curly brackets)ParBoxClass 3tmBRACKsquare bracketsParBoxClass 4tmBARvertical barsParBoxClass 5tmDBARdouble vertical barsParBoxClass 6tmFLOORfloor bracketsParBoxClass 7tmCEILINGceiling bracketsParBoxClass 8tmOBRACKopen (white) bracketsParBoxClass variationsvariation bitssymboldescription 0×0001tvFENCE_Lleft fence is present 0×0002tvFENCE_Rright fence is present Intervals: selectorsymboldescriptionclass 9tmINTERVALunmatched brackets and parenthesesParBoxClass variationsvariation bitssymboldescription 0×0000tvINTV_LEFT_LPleft fence is left parenthesis 0×0001tvINTV_LEFT_RPleft fence is right parenthesis 0×0002tvINTV_LEFT_LBleft fence is left bracket 0×0003tvINTV_LEFT_RBleft fence is right bracket 0×0000tvINTV_RIGHT_LPright fence is left parenthesis 0×0010tvINTV_RIGHT_RPright fence is right parenthesis 0×0020tvINTV_RIGHT_LBright fence is left bracket 0×0030tvINTV_RIGHT_RBright fence is right bracket Radicals (square and nth roots): selectorsymboldescriptionclass 10tmROOTradicalRootBoxClass variationsvariationsymboldescription 0tvROOT_SQsquare root 1tvROOT_NTHnth root Fractions: selectorsymboldescriptionclass 11tmFRACTfractions variationsvariation bitssymboldescription 0×0001tvFR_SMALLsubscript-size slots (piece fraction) 0×0002tvFR_SLASHfraction bar is a slash 0×0004tvFR_BASEnum. and denom. are baseline aligned Over and Underbars: selectorsymboldescriptionclass 12tmUBARunderbarBarBoxClass 13tmOBARoverbarBarBoxClass variationsvariation bitssymboldescription 0×0001tvBAR_DOUBLEbar is doubled, else single Arrows: selectorsymboldescriptionclass 14tmARROWarrowArroBoxClass variationsvariationsymboldescription 0×0000tvAR_SINGLEsingle arrow 0×0001tvAR_DOUBLEdouble arrow 0×0002tvAR_HARPOONharpoon 0×0004tvAR_TOPtop slot is present 0×0008tvAR_BOTTOMbottom slot is present 0×0010tvAR_LEFTif single, arrow points left 0×0020tvAR_RIGHTif single, arrow points right 0×0010tvAR_LOSif double or harpoon, large over small 0×0020tvAR_SOLif double or harpoon, small over large Integrals (see Limit Variations): selectorsymboldescriptionclass 15tmINTEGintegralBigOpBoxClass variationsvariationsymboldescription 0×0001tvINT_1single integral sign 0×0002tvINT_2double integral sign 0×0003tvINT_3triple integral sign 0×0004tvINT_LOOPhas loop w/o arrows 0×0008tvINT_CW_LOOPhas clockwise loop 0×000CtvINT_CCW_LOOPhas counter-clockwise loop 0×0100tvINT_EXPANDintegral signs expand Sums, products, coproducts, unions, intersections, etc. (see Limit Variations): selectorsymboldescriptionclass 16tmSUMsumBigOpBoxClass 17tmPRODproductBigOpBoxClass 18tmCOPRODcoproductBigOpBoxClass 19tmUNIONunionBigOpBoxClass 20tmINTERintersectionBigOpBoxClass 21tmINTOPintegral-style big operatorBigOpBoxClass 22tmSUMOPsummation-style big operatorBigOpBoxClass Limits (see Limit Variations): selectorsymboldescriptionclass 23tmLIMlimitsLimBoxClass variationsvariationsymboldescription 0tvSUBARsingle underbar 1tvDUBARdouble underbar Horizontal braces and brackets: selectorsymboldescriptionclass 24tmHBRACEhorizontal braceHFenceBoxClass 25tmHBRACKhorizontal bracketHFenceBoxClass variationsvariationsymboldescription 0×0001tvHB_TOPslot is on the top, else on the bottom Long division: selectorsymboldescriptionclass 26tmLDIVlong divisionLDivBoxClass variationsvariationsymboldescription 0×0001tvLD_UPPERupper slot is present Subscripts and superscripts: selectorsymboldescriptionclass 27tmSUBsubscriptScrBoxClass 28tmSUPsuperscriptScrBoxClass 29tmSUBSUPsubscript and superscriptScrBoxClass variationsvariationsymboldescription 0×0001tvSU_PRECEDESscript precedes scripted item, else follows Dirac bra-ket notation: selectorsymboldescriptionclass 30tmDIRACbra-ket notationDiracBoxClass variationsvariationsymboldescription 0×0001tvDI_LEFTleft part is present 0×0002tvDI_RIGHTright part is present Vectors: selectorsymboldescriptionclass 31tmVECvectorHatBoxClass variationsvariationsymboldescription 0×0001tvVE_LEFTarrow points left 0×0002tvVE_RIGHTarrow points right 0×0004tvVE_UNDERarrow under slot, else over slot 0×0008tvVE_HARPOONharpoon Hats, arcs, tilde, joint status: selectorsymboldescriptionclass 32tmTILDEtilde over charactersHatBoxClass 33tmHAThat over charactersHatBoxClass 34tmARCarc over charactersHatBoxClass 35tmJSTATUSjoint status constructHatBoxClass Overstrikes (cross-outs): selectorsymboldescriptionclass 36tmSTRIKEoverstrike (cross-out)StrikeBoxClass variationsvariationsymboldescription 0×0001tvST_HORIZline is horizontal, else slashes 0×0002tvST_UPif slashes, slash from lower-left to upper-right is present 0×0004tvST_DOWNif slashes, slash from upper-left to lower-right is present Boxes: selectorsymboldescriptionclass 37tmBOXboxTBoxBoxClass variationsvariationsymboldescription 0×0001tvBX_ROUNDcorners are round, else square 0×0002tvBX_LEFTleft side is present 0×0004tvBX_RIGHTright side is present 0×0008tvBX_TOPtop side is present 0×0010tvBX_BOTTOMbottom 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 main slot arrow character BigOpBoxClass: integrals, summations, products, etc. main slot (summand, integrand) upper slot lower slot large operator character DiracBoxClass: three-part bracket structure left slot right slot left angle bracket (optional) vertical bar right angle bracket (optional) FracBoxClass: fractions with a horizontal bar numerator slot denominator slot HFenceBoxClass horizontal expanding braces main slot small slot brace character LDivBoxClass long division dividend slot quotient slot LimBoxClass limits main slot lower slot upper slot ParBoxClass parenthesized or bracketed slots main slot left fence character (optional) right fence character (optional) RootBoxClass radical sign main slot radicand slot ScrBoxClass subscripts and superscripts subscript slot superscript slot SlashBoxClass fractions with a diagonal bar numerator slot denominator slot 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: For this equation, MathType 7.0 for Windows generates the following MTEF: byte positionbyte valuemeaningrecord 00×00005, 0×05MTEF versionheader 10×00011, 0×01Windows 20×00020, 0×00MathType 30×00037, 0×07MT major version 40×00040, 0×00MT minor version 50×000568, 0×44, 'D'application key 60×000683, 0×53, 'S' 70×000777, 0×4D, 'M' 80×000884, 0×54, 'T' 90×000955, 0×37, '7' 100×000A0, 0×00 110×000B0, 0×00equation options 120×000C19, 0×13record typeENCODING_DEF encoding #5 130×000D87, 0×57, 'W'encoding name "WinAllBasicCodePages" 140×000E105, 0×69, 'i' 150×000F110, 0×6E, 'n' 160×001065, 0×41, 'A' 170×0011108, 0×6C, 'l' 180×0012108, 0×6C, 'l' 190×001366, 0×42, 'B' 200×001497, 0×61, 'a' 210×0015115, 0×73, 's' 220×0016105, 0×69, 'i' 230×001799, 0×63, 'c' 240×001867, 0×43, 'C' 250×0019111, 0×6F, 'o' 260×001A100, 0×64, 'd' 270×001B101, 0×65, 'e' 280×001C80, 0×50, 'P' 290×001D97, 0×61, 'a' 300×001E103, 0×67, 'g' 310×001F101, 0×65, 'e' 320×0020115, 0×73, 's' 330×00210, 0×00 340×002217, 0×11record typeFONT_DEF font def #1 350×00235, 0×05index of encoding WinAllBasicCodePages 360×002484, 0×54, 'T'font name "Times New Roman" 370×0025105, 0×69, 'i' 380×0026109, 0×6D, 'm' 390×0027101, 0×65, 'e' 400×0028115, 0×73, 's' 410×002932, 0×20, ' ' 420×002A78, 0×4E, 'N' 430×002B101, 0×65, 'e' 440×002C119, 0×77, 'w' 450×002D32, 0×20, ' ' 460×002E82, 0×52, 'R' 470×002F111, 0×6F, 'o' 480×0030109, 0×6D, 'm' 490×003197, 0×61, 'a' 500×0032110, 0×6E, 'n' 510×00330, 0×00 520×003417, 0×11record typeFONT_DEF font def #2 530×00353, 0×03index of encoding Symbol 540×003683, 0×53, 'S'font name "Symbol" 550×0037121, 0×79, 'y' 560×0038109, 0×6D, 'm' 570×003998, 0×62, 'b' 580×003A111, 0×6F, 'o' 590×003B108, 0×6C, 'l' 600×003C0, 0×00 610×003D17, 0×11record typeFONT_DEF font def #3 620×003E5, 0×05index of encoding WinAllBasicCodePages 630×003F67, 0×43, 'C'font name "Courier New" 640×0040111, 0×6F, 'o' 650×0041117, 0×75, 'u' 660×0042114, 0×72, 'r' 670×0043105, 0×69, 'i' 680×0044101, 0×65, 'e' 690×0045114, 0×72, 'r' 700×004632, 0×20, ' ' 710×004778, 0×4E, 'N' 720×0048101, 0×65, 'e' 730×0049119, 0×77, 'w' 740×004A0, 0×00 750×004B17, 0×11record typeFONT_DEF font def #4 760×004C4, 0×04index of encoding MTExtra 770×004D77, 0×4D, 'M'font name "MT Extra" 780×004E84, 0×54, 'T' 790×004F32, 0×20, ' ' 800×005069, 0×45, 'E' 810×0051120, 0×78, 'x' 820×0052116, 0×74, 't' 830×0053114, 0×72, 'r' 840×005497, 0×61, 'a' 850×00550, 0×00 860×005618, 0×12record typeEQN_PREFS 870×00570, 0×00options 880×00588, 0×08size array count 890×005933, 0×21, '!'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" 900×005A47, 0×2F, '/' 910×005B69, 0×45, 'E' 920×005C143, 0×8F 930×005D68, 0×44, 'D' 940×005E47, 0×2F, '/' 950×005F65, 0×41, 'A' 960×006080, 0×50, 'P' 970×0061244, 0×F4 980×006216, 0×10 990×006315, 0×0F 1000×006471, 0×47, 'G' 1010×006595, 0×5F, '_' 1020×006665, 0×41, 'A' 1030×006780, 0×50, 'P' 1040×0068242, 0×F2 1050×006931, 0×1F 1060×006A30, 0×1Espacing array count 1070×006B65, 0×41, 'A'nibble array containing 30 values 1080×006C80, 0×50, 'P' 1090×006D244, 0×F4 1100×006E21, 0×15 1110×006F15, 0×0F 1120×007065, 0×41, 'A' 1130×00710, 0×00 1140×0072244, 0×F4 1150×007369, 0×45, 'E' 1160×0074244, 0×F4 1170×007537, 0×25, '%' 1180×0076244, 0×F4 1190×0077143, 0×8F 1200×007866, 0×42, 'B' 1210×007995, 0×5F, '_' 1220×007A65, 0×41, 'A' 1230×007B0, 0×00 1240×007C244, 0×F4 1250×007D16, 0×10 1260×007E15, 0×0F 1270×007F67, 0×43, 'C' 1280×008095, 0×5F, '_' 1290×008165, 0×41, 'A' 1300×00820, 0×00 1310×0083242, 0×F2 1320×008431, 0×1F 1330×008532, 0×20, ' ' 1340×0086165, 0×A5 1350×0087242, 0×F2 1360×008810, 0×0A 1370×008937, 0×25 1380×008A244, 0×F4 1390×008B143, 0×8F 1400×008C65, 0×41, '!' 1410×008D244, 0×F4 1420×008E16, 0×10 1430×008F15, 0×0F 1440×009064, 0×41, 'A' 1450×00910, 0×00 1460×0092244, 0×F4 1470×009315, 0×0F 1480×009472, 0×48, 'H' 1490×0095244, 0×F4 1500×009623, 0×17 1510×0097244, 0×F4 1520×0098143, 0×8F 1530×009964, 0×41, 'A' 1540×009A0, 0×00 1550×009B242, 0×F2 1560×009C26, 0×1A 1570×009D95, 0×5F, '_' 1580×009E68, 0×44, 'D' 1590×009F95, 0×5F, '_' 1600×00A069, 0×45, 'E' 1610×00A1244, 0×F4 1620×00A295, 0×5F, '_' 1630×00A369, 0×45, 'E' 1640×00A4244, 0×F4 1650×00A595, 0×5F, '_' 1660×00A665, 0×41, 'A' 1670×00A715, 0×0F 1680×00A812, 0×0Cstyle array count 1690×00A91, 0×01style #1: font def #1, plain 1700×00AA0, 0×00 1710×00AB1, 0×01style #2: font def #1, plain 1720×00AC0, 0×00 1730×00AD1, 0×01style #3: font def #1, italic 1740×00AE2, 0×02 1750×00AF2, 0×02style #4: font def #2, italic 1760×00B02, 0×02 1770×00B12, 0×02style #5: font def #2, plain 1780×00B20, 0×00 1790×00B32, 0×02style #6: font def #2, plain 1800×00B40, 0×00 1810×00B51, 0×01style #7: font def #1, bold 1820×00B61, 0×01 1830×00B71, 0×01style #8: font def #1, plain 1840×00B80, 0×00 1850×00B93, 0×03style #9: font def #3, plain 1860×00BA0, 0×00 1870×00BB1, 0×01style #10: font def #1, plain 1880×00BC0, 0×00 1890×00BD4, 0×04style #11: font def #4, plain 1900×00BE0, 0×00 1910×00BF0, 0×00style #12: (not used) 1920×00C010, 0×0Arecord typeSIZE_FULL 1930×00C11, 0×01record typeLINE 1940×00C20, 0×00options 1950×00C33, 0×03record typeTMPL fraction 1960×00C40, 0×00options 1970×00C511, 0×0Bselector: tmFRACT 1980×00C60, 0×00variation: none 1990×00C70, 0×00template-specific options 2000×00C81, 0×01record typeLINE numerator 2010×00C90, 0×00options 2020×00CA2, 0×02record typeCHAR – (minus sign) 2030×00CB4, 0×04options: mtefOPT_CHAR_ENC_CHAR_8 2040×00CC134, 0×86typeface: 134 - 128 = 6 (Symbol style) 2050×00CD18, 0×12MTCode value: 0×2212 (minus sign) 2060×00CE34, 0×22, '""""' 2070×00CF45, 0×2D, '-'font-encoded value: 0×2D (minus sign) 2080×00D02, 0×02record typeCHAR b 2090×00D10, 0×00options 2100×00D2131, 0×83typeface: 131 - 128 = 3 (Variable style) 2110×00D398, 0×62, 'b'MTCode value: 0×0062 ('b') 2120×00D40, 0×00 2130×00D52, 0×02record typeCHAR plus-minus sign: ± 2140×00D64, 0×04options: mtefOPT_CHAR_ENC_CHAR_8 2150×00D7134, 0×86typeface: 134 - 128 = 6 (Symbol style) 2160×00D8177, 0×B1MTCode value: 0×00B1 (plus-minus sign) 2170×00D90, 0×00 2180×00DA177, 0×B1font-encoded value: 0×B1 (plus-minus sign) 2190×00DB3, 0×03record typeTMPL square root 2200×00DC0, 0×00options 2210×00DD10, 0×0Aselector: tmROOT 2220×00DE0, 0×00variations: tvROOT_SQ (square root) 2230×00DF0, 0×00template-specific options 2240×00E01, 0×01record typeLINE radicand 2250×00E10, 0×00options 2260×00E22, 0×02record typeCHAR b 2270×00E30, 0×00options 2280×00E4131, 0×83typeface: 131 - 128 = 3 (Variable style) 2290×00E598, 0×62, 'b'MTCode value: 0×0062 ('b') 2300×00E60, 0×00 2310×00E73, 0×03record typeTMPL superscript 2320×00E80, 0×00options 2330×00E928, 0×1Cselector: tmSUP 2340×00EA0, 0×00variations: none 2350×00EB0, 0×00template-specific options 2360×00EC11, 0×0Brecord typeSIZE_SUB 2370×00ED1, 0×01record typeLINE missing superscript 2380×00EE1, 0×01options: mtefOPT_LINE_NULL 2390×00EF1, 0×01record typeLINE subscript 2400×00F00, 0×00options 2410×00F12, 0×02record typeCHAR 2 2420×00F20, 0×00options 2430×00F3136, 0×88typeface: 136 - 128 = 8 (Number style) 2440×00F450, 0×32, '2'MTCode value: 0×0032 ('2') 2450×00F50, 0×00 2460×00F60, 0×00record typeEND of subscript line 2470×00F70, 0×00record typeEND of subscript template 2480×00F810, 0×0Arecord typeSIZE_FULL 2490×00F92, 0×02record typeCHAR – (minus sign) 2500×00FA4, 0×04options: mtefOPT_CHAR_ENC_CHAR_8 2510×00FB134, 0×86typeface: 134 - 128 = 6 (Symbol style) 2520×00FC18, 0×12MTCode value: 0×2212 (minus sign) 2530×00FD34, 0×22, '""""' 2540×00FE45, 0×2D, '-'font-encoded value: 0×2D (minus sign) 2550×00FF38, 0×26 2560×01002, 0×02record typeCHAR 4 2570×01010, 0×00options 2580×0102136, 0×88typeface: 136 - 128 = 8 (Number style) 2590×010352, 0×34, '4'MTCode value: 0×0034 ('4') 2600×01040, 0×00 2610×01052, 0×02record typeCHAR a 2620×01060, 0×00options 2630×0107131, 0×83typeface: 131 - 128 = 3 (Variable style) 2640×010897, 0×61, 'a'MTCode value: 0×0061 ('a') 2650×01090, 0×00 2660×010A2, 0×02record typeCHAR c 2670×010B0, 0×00options 2680×010C131, 0×83typeface: 131 - 128 = 3 (Variable style) 2690×010D99, 0×63, 'c'MTCode value: 0×0063 ('c') 2700×010E 0, 0×00 2710×010F0, 0×00record typeEND of radicand line 2720×011011, 0×0Brecord typeSIZE_SUB 2730×01111, 0×01record typeLINE missing radicand 2740×01121, 0×01options: mtefOPT_LINE_NULL 2750×01130, 0×00record typeEND of radical template 2760×01140, 0×00record typeEND of numerator line 2770×011510, 0×0Arecord typeSIZE_FULL 2780×01161, 0×01record typeLINE denominator 2790×01170, 0×00options 2800×01182, 0×02record typeCHAR 2 2810×01190, 0×00options 2820×011A136, 0×88typeface: 136 - 128 = 8 (Number style) 2830×011B50, 0×32, '2'MTCode value: 0×0032 ('2') 2840×011C0, 0×00 2850×011D2, 0×02record typeCHAR a 2860×011E0, 0×00options 2870×011F131, 0×83typeface: 131 - 128 = 3 (Variable style) 2880×012097, 0×61, 'a'MTCode value: 0×0061 ('a') 2890×01210, 0×00 2900×01220, 0×00record typeEND of denominator line 2910×01230, 0×00record typeEND of fraction template 2920×01240, 0×00record typeEND of equation line 2930×01250, 0×00record typeEND of equation Back to MathType SDK intro page Table of Contents Abstract Introduction Header MTEF Byte Stream Record Details Templates Example