Infogrid Pacific-The Science of Information


Creating, Managing and Using MathML

MathML can be created and edited directly in the IGP:Writer interface. Tthere are multiple options for various format generation to compensate for the limitations of various reading systems. Modified: 14 December 2013


IGP:Writer has specific Content Blocks for MathML to allow it to be imported, inserted, edited and managed as both HTML5 Inline and Block MathML.

This assists the long-term management of Scientific, Technical, Mathematics and Education content that depend on MathML. 

MathML blocks can be inserted as MathML inline or MathML in blocks. For example the MathML block can be inserted inside an equation-rw block.

MathML blocks are independent and present primarily as a processing target for ID generation, classification, image generation, extraction and reuse.

To insert MathML Into a Block

The MathML Editor allows ASCIIMath and MathML to be directly keyed or pasted into the interface. LaTeX is being evaluated for the near future.

The Block MathML dialog allows you to insert and edit your MathML at ny time. .

If you have your MathML XML ready before creating a MathML block it must be available from a text file encoded as UTF-8.

To create a MathML block
click this Option

  1. Insert your cursor in an empty paragraph in the position you want to insert your MathML block equation.
  2. From the Content Block accordion find the G08 MathML button option.
  3. Double-click the 01 MathML Block button. A MathML editing dialogue will open.
  4. You can create and insert MathML by the following methods:
    1. Key or paste you equation using ASCIIMath directly into the left panel. Then click the Convert button to generate the MathML. Click the Preview button to view the equation.
    2. Key or paste your MathML into the right panel. Then click the Preview button to view the equation in the Preview panel. If this is large the panel will be scrollable.
    3. If your pasted MathML is continuous text, and you need to edit it, click the Pretty Print button. This will process the MathML into an editing friendly presentation.
  5. Click the Insert button to put the MathML into the Writer document and close the dialogue.
  6. When you save the Writer document the MathML will be instantly available in the Reader and Print views.

Note on MathML Namespace

IGP:Writer is an HTML5 framework. You do not need to enter namespace declarations in your MathML. This will be inserted by Formats On Demand packaging as and when required by various formats.

To Insert MathML Inline

  1. Position your cursor in a paragraph at the position you want to insert the MathML. You should place a space on either side of the cursor position.
  2. From the Content Blocks accordion from the Inline Options click the  MathML Inline option.
  3. The MathML dialog will open. You can now paste or key your MathML into the editing dialog. Click the insert button.
  4. The MathML will be immediately inserted into the Writer document and instantly appear on the Writer page.
  5. When you save the Writer document the MathML will be instantly seen in the Reader and Print views.

The Inline MathML editing dialog is feature identical to the block editor and lets you insert and edit your inline MathML at any time.

Importing MathML

If you have MathML in your manuscript this can be imported depending on how it was produced.

There are two main tools used to produce MathML in MS Word documents: MathType and MathMagic. Libre Office equations can also be imported.

Importing from MathType

  1. MathType has an optional DaisyMath plugin.
  2. To use this you must export your MS Word document as DaisyXML with the DaisyMath plugin active. The output is a DaisyXML file.
  3. From Import Manuscript, select the Custom XML Tab, and then from the dropdown Daisy XML.
  4. Upload your document.
  5. Assuming it has been tagged correctly the full document and MathML will be imported, converted to HTML5 and be instantly available for ongoing editing.

To import a MathType generation DaisyXML file select Custom XML and then DAISY XML ZIP.

It is important that your MathML has the display property set correctly (IE. <math display="block"> or <math display="inline">.

If the imported MathML has no display property it will be treated as a block by default. This means any inline equations will appear in the wrong position and may have to be repositions and have the block-type changed. This can be done using the MathML Editor and manually inserting the display="inline property. 

Importing a Manuscript Using MathMagic

We do not currently have a process for importing MathML from a Wordprocessor file created with MathMagic.

Importing a Manuscript from Libre Office

If your manuscript has MathML created using the standard Libre Office equation editor they can be exported to XHTML and imported directly into Writer with the MathML included.

  1. To export a Libre Office manuscript containing MathML from the File menu, click Export.
  2. Select export option: XHTML1.1 + MathML2.0 (.xhtml) (*xhtml).
  3. Choose your save location and click Save.

To import a Libre Office XHTML file, select Custom XML and then HTML.

  1. To import the document into Writer, from the Import Manuscript option select the Custom XML tab and then from the selector HTML.
  2. Select the XHTML document from its location.
  3. Click the Import button.
  4. Your file will now be imported and processed to IGP:FoundationXHTML with MathML block processing.

The Maths editor in Libre Office also does not have the option to set the MathML display property to inline or block. Therefore the importer is guessing on the correct display value based on parent elements. There is a possibility of errors depending on the complexity of your MathML layout.

Because the Libre Office generated MathML inserts blocks into a paragraph the processor interpretes a single MathML block in a <p>  with no other blocks or styles as a block equation.

Processing MathML

Many browsers and reading systems do not support MathML either at all or well. In these cases you may need to convert MathML to images for the final format.

The MathML to image processor available that will convert all MathML to SVG, PNG and JPG images at internet resolution, and PNG at print resolution.

When you select your format packaging options the image substitution model can be selected.

Because MathML documents can contain very large numbers of equations and it takes significant time to generate the images from the MathML this is a stand-alone interface and should be done once before format generation. The format packagers expect images to be available.

To generate MathML images from MathML.

  1. Click the Editing Tools button.
  2. Click the Document Processors button.
  3. Scroll to the bottom of the interface where you will find the processor option MathML Image Processing.
  4. Use the options to select your requirements. You can generate images for Online, Print, the whole document or just the Active Section.

The MathML Image Processing options

The MathML Image Processing generation report on completion

Controlling the Size of Images

You can control the size of the images generated by the image processor.

In the Print and Reader CSS F01 Galley the following processing instruction block is available.

The SVG is generated at the galley font-size applied in the document.

By default the print images are generated as PNGs with background transparency and 300dpi resolution. If you want to increase the size of the images change the default size to your target size.

Print CSS

#mathml-image-inline {
    font-size: 12pt;
#mathml-image-block {
    font-size: 12pt;

 Reader CSS

#mathml-image-inline {
    font-size: 1em;
#mathml-image-block {
    font-size: 1em;

There is some advantage creating MathML images that are 2X larger than the default font size so in reading systems where the user can enlarge the font the presentation quality is maintained. In this case change the 1em statements to 2em and the image generator will create the images accordingly.

   Document Statistics

If you have a book or document containing a lot of MathML you can use the Statistics Report to generate counts of inline and bock equations.

This partial report view is from Max Plank. The Theory of Heat Radiation.

Statistics Reports can be generated from the Book Toolbar in the Management Interface (click the Stats option), or from the document toolbar in IGP:Writer.

General Information on MathML

The HTML5 specification has made MathML a first level element group without the requirement for namespaces. This is carried forward in IGP:FoundationXHTML.

The preferred method for inserting MathML into IGP:FoundationXHTML is as a simple element with no name-space declarations in a defined mathml-rw element.

<span class="mathml-rw" ><math display="inline"> .... </math></span>

<div class="mathml-rw" ><math display="block"> .... </math></div>

See the IGP:FoundationXHTML specification for more information on the purpose of these tagging patterns.

If delivery formats require namespaces (such as XHTML5 for ePub3) the Formats On Demand processor will insert the required statements to ensure the final package is valid for any specific format.

For more background information and tutorials on the MathML production issues see these links.


ASCIIMath Home Page

comments powered by Disqus