Math and Formulas

The BITS DTD allows math to be encoded in a number of ways: as MathML, as a pointer to an image file, or as a combination of the two. The USGS export takes advantage of both options (MathML and an image file) to ensure both full compliance with accessibility and machine-readability requirements (MathML) and correct display of the formula regardless of platform (image). Users also have the option of using the Math character style in order to indicate inline Math that is not MathType.

Tip

To ensure consistent and correct XML, it is strongly recommended that all formulas and math inserted into the Word document with a math editor be converted to MathType prior to export.

In this section

MathML

eXtyles will easily and correctly produce MathML during XML export when formulas in the Word document are formatted as MathType equations (see Terms and Definitions for information about how to format Equation Where Lists). The following MathType equation will yield the subsequent MathML:

Math XML Sample
<disp-formula id="e19"><alternatives><mml:math id="m19">
 <mml:mrow>
  <mml:mi>M</mml:mi><mml:mo>=</mml:mo><mml:mfrac>
   <mml:mrow>
    <mml:msubsup>
     <mml:mi>v</mml:mi>
     <mml:mi>R</mml:mi>
     <mml:mn>2</mml:mn>
    </mml:msubsup>
    <mml:mo>+</mml:mo><mml:msubsup>
     <mml:mi>U</mml:mi>
     <mml:mrow>
      <mml:mi>o</mml:mi><mml:mi>r</mml:mi><mml:mi>b</mml:mi>
     </mml:mrow>
     <mml:mn>2</mml:mn>
    </mml:msubsup>
   </mml:mrow>
   <mml:mrow>
    <mml:mrow><mml:mo>(</mml:mo>
     <mml:mrow>
      <mml:mi>s</mml:mi><mml:mo>−</mml:mo><mml:mn>1</mml:mn>
     </mml:mrow>
    <mml:mo>)</mml:mo></mml:mrow><mml:mi>g</mml:mi><mml:msub>
     <mml:mi>D</mml:mi>
     <mml:mrow>
      <mml:mn>50</mml:mn>
     </mml:mrow>
    </mml:msub>
   </mml:mrow>
  </mml:mfrac>
 </mml:mrow>
</mml:math><graphic position="anchor" xlink:href="tcm17-1008_m19"/></alternatives><label>(19)</label></disp-formula>

Images

For the same formula, eXtyles will also create an .eps file, and will save it into the same directory as the Word file. This .eps file will be named according to the Object ID value entered into the Document Information dialogue and the number of the formula. In the above example, the .eps file that is generated is named: tcm17-1008_m19.eps.

In the XML, eXtyles adds a pointer to this .eps file so that it can be used for display purposes (e.g., during the typesetting process or for display on the Internet). This pointer takes the form of a <graphic> tag; in this example, <graphic position="anchor" xlink:href="tcm17-1008_m19"/>.

Math Character Style

In cases where math is used inline with body text, and mathType is not used, apply the character style "Math".This character style can be manually applied to inline math that is plain text (not MathType).

The resulting XML will appear as follows:

XML
<p>
This is math.
<named-content content-type="math">1+2=3</named-content> 
This math is inline plain text and not MathType.
</p>

Problems with Math in XML

Commonly encountered problems with the correct export of math include:

1. Equations are not actually math objects. If equations have been inserted into the text as objects other than MathType (for example, as pictures), they will not be exported as math. Depending on your eXtyles configuration, they will be exported as inline graphics or they will be dropped entirely from the XML file.

A common reason for equations appearing as images in the Word file is if a Word 2007/2010 DOCX file containing Word Equation Builder objects has been saved as a Word 2003 DOC file. Because the Equation Builder is not backward compatible with Word 2003, the equations are saved as images instead. To avoid this problem, Equation Builder objects should be converted to MathType equations using the Convert Equations function (see the figure to the right) on the MathType menu/ribbon before saving the file to DOC format from DOCX.

Note that "Word 2007 and later (OMML) equations" must be selected under "Equation types to convert,"and "Convert equations to" must be set to "MathType equations (OLE objects)."

If an author has saved a file containing Equation Builder math as a DOC file without first converting the equations, these equations may be recovered by re-saving the file in DOCX format using Word 2007 or 2010 (Microsoft calls this process "rehydration"). After resaving the file, you should reconfirm that the equations are now editable Equation Builder objects. At this stage, we recommend you convert the equations to MathType using the instructions given earlier.



2. Equation numbers included as part of the equation. eXtyles will automatically parse numbered equation paragraphs, enabling linking of equation citations and generating correct XML. However, this functionality is not available if the equation numbers have been added as part of the equation object itself. The equation numbers must be removed from the equation objects and added as text to the paragraph containing the equation (see the previous example).