Math Equations

The JATS and NLM Book DTDs allow 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. How your export has been set up depends on the uses that are going to be made of your XML and the needs of any downstream partners such as compositors and online hosts.

Design Science MathType must be installed for eXtyles to generate MathML or image files of your equation objects.

For example, this MathType equation:

when exported as MathML, gives this XML:

<disp-formula id="e2">
<mml:math id="m1">
<mml:mrow>
<mml:msqrt>
<mml:mrow>
<mml:msup>
<mml:mi>a</mml:mi>
<mml:mn>2</mml:mn>
</mml:msup>
<mml:mo>+</mml:mo><mml:msup>
<mml:mi>b</mml:mi>
<mml:mn>2</mml:mn>
</mml:msup>
</mml:mrow>
</mml:msqrt>
</mml:mrow>
</mml:math>
<label>(2)</label>
</disp-formula>

Note that the values of the <mml:math> id attribute are allocated sequentially on export and do not necessarily correspond to any equation number used in the text [if, in this example, equation (1) had been typed from the keyboard, so that equation (2) was the first MathType object in the document]. Values of the <disp-formula> id attribute are based on the equation numbers. Values of the <disp-formula> id attribute for unnumbered equations are treated similarly to unnumbered figures and tables: the first equation is "e", the second is "e___1", etc.

If the export is instead set to add graphic pointers to equations, the following XML is output:

<graphic position="anchor" xlink:href="9388_007-m1" xmlns:xlink="http://www.w3.org/1999/xlink"/>

where 9388_007 is the document ID, set in the Document Information dialog. Note that, by default, the file extension is not included in the XML (see the previous discussion). The default naming convention for equation images is based on the document ID and "mn", where n is the sequential number of the equation object (note that this is not related to any equation numbers that may or may not be associated with the equation in the text).

If both MathML and pointers to images are required, the output XML looks like this (note that the contents of the equation have been omitted for the sake of brevity) in versions of the Journal Publishing and Book DTDs up to 3.0:

<disp-formula id="e2">
<mml:math id="m1">...</mml:math>
<graphic position="anchor" xlink:href="123-m1" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</disp-formula>

In JATS, the <alternatives> element is available. In this case, the output XML would look like this:

<disp-formula id="e2">
<alternatives>
<mml:math id="m1">...</mml:math>
<graphic position="anchor" xlink:href="123-m1" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</alternatives>
</disp-formula>

The presence of the <alternatives> element makes it easier for rendering engines to determine that only one or other of the two outputs should be used.

eXtyles supports equations added by authors with the Microsoft Equation Builder, the default equation editor in Word 2007 and later versions, and also the older Microsoft Equation 3.0 format (still accessible in Word 2007 and 2010, from the Insert Object menu) and MathType, the "parent" of Microsoft Equation 3.0. Any of these formats will be correctly exported as math according to the configuration of your export filter.

For all equation objects, Design Science MathType must be installed for eXtyles to generate MathML or image files of your equation objects.

Please contact eXtyles-support@inera.com if you have questions about export of math from your documents.

Problems with Math in XML

Commonly encountered problems with the correct export of math include:

Equations are not actually math objects

If equations have been inserted into the text as objects other than those listed previously (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. As 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 following figure) 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.

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).

Equation images not exported

If your NLM XML export generates pointers to image files for math, these image files must also be exported. This can be automated as part of your eXtyles XML export: if you do not have automatic export of math enabled, the images must be exported manually from the MathType menu/ribbon in Word using the Export Equations function.

Notes about Equation Builder Math

Microsoft Equation Builder math cannot be exported as image files; these equations can only be exported as MathML (when MathType is installed). Microsoft’s MathML is not the same as the MathML produced by MathType. For consistency in your XML archive, we recommend that all math be converted to MathType in your workflow.

Should you choose to keep equations in Equation Builder format, be advised that Microsoft makes extensive use of Plane 1 Unicode in Equation Builder; many applications that render MathML do not have full support for Plane 1 Unicode, and end-user systems viewing MathML may not have font sets that include Plane 1 Unicode.

Notes about Export of Equation Images from Word using MathType

MathType has a number of settings that control the export of math equations from Word (see the previous figure). These include:

  1. The folder that the equations are exported to
  2. The format of the equation files (.eps, .gif or .wmf)
  3. The filename pattern that will be used for the exported files

Automatic math export will ensure that these options are set correctly. For manual export, these settings must match the settings used in your XML export so that the image files match the pointers included in the XML.

It is also possible to set other properties for exported GIF files, and such changes may be required by downstream applications such as composition or online hosting. To access these settings, open a MathType object in Word and select Preferences: Web and GIF Preferences. From this menu, you can set:

  1. The resolution of the image (up to 1000 d.p.i.). By default, this is set to the current screen resolution (typically 72 or 96 d.p.i.), which would be fine for online use but would give unsatisfactory results if the images are used for printing. Setting a higher resolution will give better results when the images are printed
  2. The color of the bitmap background. By default, this is set to white. It can be set to transparent, which would be needed if the images are to be printed onto a colored substrate or used online on a colored background.

These settings are stored on a user’s computer, so they need to be set only once for any machine used to export math images. The settings will also be picked up by the eXtyles automated math image export.

© 2021 Atypon Systems. All Rights Reserved.

Icons made by Freepik from Flaticon are licensed under CC 3.0 BY