1. Equation
XML. 1
1.1.
Introduction. 1
1.2. Basic
Format 1
1.3. Reading
the equationXml attribute. 2
1.3.1. Word
2003 XML elements which can contain Office Open XML Math elements. 3
1.3.2.
Containment of the oMathPara element 3
1.3.3. Containment
of Math runs and Math functions and objects. 3
1.4. Office
Open XML Math elements which can contain Word 2003 XML elements. 4
1.4.1.
Control Properties. 4
1.4.2. oMath
and Math Arguments. 4
1.4.3. Math
Run. 5
1.5.
Limitations in Word. 5
Word supports a Compatibility Mode in which it disables
functionality not compatible with earlier versions of Word. Versions of Word
prior to Word 2007 do not have native support for displaying Office Open XML
Math. Instances of Office Open XML Math in Word documents are converted to
pictures to preserve their visual fidelity when opened in versions of Word
earlier than Word 2007. To do this, Word adds additional information to those
pictures, using the equationxml attribute present on
the shape element ("[ISO/IEC-29500-4]
§14.1.2.19; shape (Shape Definition)"), to store the Office Open XML Math
which represents the original equation/expression. If the document is removed
from Compatibility Mode, the contents of this attribute are then used to
replace the image with the specified equation/expression.
This document describes the format in which Word 2007, Word
2010, or earlier versions of Word with the Compatibility Pack, store Office
Open XML Math content inside the equationxml
attribute.
The equationXml attribute’s
content is a complete Word 2003 XML document (defined here: http://msdn.microsoft.com/en-us/library/aa272680(office.11).aspx)
containing Office Open XML Math elements ("[ISO/IEC-29500-1]
§22.1"), and properly escaped as needed to be stored within an attribute
value.
This document is subject to the following restrictions:
·
This Word 2003 XML document must not contain any comments,
headers, footers, endnotes, footnotes, or textboxes.
·
This Word 2003 XML document must contains a single paragraph (p element).
That p element must contain a single oMathPara
element ("[ISO/IEC-29500-1] §22.1.2.78; oMathPara") which in
turn must contain a single oMath element ("[ISO/IEC-29500-1]
§22.1.2.77; oMath").
The oMathPara element can contain any valid XML from the
Office Open XML Math namespace, but must not contain any markup from any other
Office Open XML namespace. Instead, it can contain various elements from the
Word 2003 XML namespace (Office
Additional Simple Types).
[Example: The
following string value represents the encoded contents of the equationXml attribute when it contains a mathematic al
expression containing only the character x:
<w:wordDocument xmlns:m=
"http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
><w:body><w:p><m:oMathPara><m:oMath><m:r>
<w:rPr><w:rFonts w:ascii="Cambria Math"
w:h-ansi= "Cambria
Math"/><w:i/></w:rPr><m:t>x</m:t
></m:r></m:oMath></m:oMathPara></w:p
></w:body></w:wordDocument>
end example]
The syntax and semantics of elements from Word 2003 XML and
of Office Open XML Math are those specified in the corresponding file formats,
with the following exceptions:
·
There is a specific list of elements from Word 2003 XML which are
each allowed to contain a specific set of elements from Office Open XML Math (Office
Additional Simple Types).
·
Office Open XML Math elements are not allowed to contain any
markup from any other Office Open XML namespace. Instead, a specific set of
elements from Office Open XML Math are allowed to contain a specific set of
elements from Word 2003 XML (Office
Additional Simple Types).
The contents of the equationXml
attribute, as written by Word 2007, Word 2010, or earlier versions of Word with
the Compatibility Pack, can be read in two different ways to determine the
mathematical equation associated with the image:
1.
To determine the associated equation/expression,
read only the Office Open XML Math elements and ignore all other elements.
2.
To determine the associated equation/expression
including any additional WordprocessingML formatting (the addition of a
bookmark, for example), read all elements.
[Example: The
following XML represents the value of the equationXml
attribute representing a mathematical equation containing a fraction with numerator
x and denominator y where the numerator is formatted red and the denominator is
enclosed in a bookmark with the name “bookmark_name”:
<w:wordDocument
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:m= "http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
><w:body><w:p><m:oMathPara><m:oMath><m:f
><m:fPr><m:ctrlPr><w:rPr><w:rFonts
w:ascii="Cambria Math" w:h-ansi="Cambria
Math"/><w:i/></w:rPr></m:ctrlPr
></m:fPr><m:num><m:r><w:rPr
><w:rFonts w:ascii="Cambria Math"
w:h-ansi="Cambria Math"/><w:i/><w:color
w:val="FF0000"/></w:rPr><m:t>x</m:t
></m:r></m:num><m:den><aml:annotation
aml:id="0" w:type="Word.Bookmark.Start"
w:name="bookmark_name"/><m:r><w:rPr
><w:rFonts w:ascii="Cambria Math"
w:h-ansi="Cambria
Math"/><w:i/></w:rPr><m:t>y</m:t
></m:r><aml:annotation aml:id="0"
w:type="Word.Bookmark.End"/></m:den></m:f
></m:oMath></m:oMathPara></w:p></w:body
></w:wordDocument>
An application might choose to read just the Office Open XML
math elements, in which case it would display the fraction but would lose the
font color applied to the numerator and the bookmark located in the
denominator:

On the other hand, the application might choose to read all
elements in which case it would display the font color and bookmark as well as
the fraction:

end example]
The Word 2003 XML document must contain a single p element which contains a single oMathPara
element ("[ISO/IEC-29500-1] §22.1.2.78; oMathPara").
The Word 2003 XML hlink element
and the AML content element can each contain an
unbounded number of Office Open XML Math elements from the following list,
which includes the Office Open XML Math r element
and all Office Open XML Math functions/objects:
·
acc ("[ISO/IEC-29500-1]
§22.1.2.1; acc")
·
bar("[ISO/IEC-29500-1]
§22.1.2.7; bar")
·
borderBox ("[ISO/IEC-29500-1]
§22.1.2.11; borderBox")
·
box ("[ISO/IEC-29500-1]
§22.1.2.13; box")
·
d ("[ISO/IEC-29500-1]
§22.1.2.24; d")
·
eqArr ("[ISO/IEC-29500-1]
§22.1.2.34; eqArr")
·
f ("[ISO/IEC-29500-1]
§22.1.2.36; f")
·
func ("[ISO/IEC-29500-1]
§22.1.2.39; func")
·
groupChr ("[ISO/IEC-29500-1]
§22.1.2.41; groupChr")
·
limLow ("[ISO/IEC-29500-1]
§22.1.2.54; limLow")
·
limUpp ("[ISO/IEC-29500-1]
§22.1.2.56; limUpp")
·
m ("[ISO/IEC-29500-1]
§22.1.2.60; m")
·
nary ("[ISO/IEC-29500-1]
§22.1.2.70; nary")
·
phant ("[ISO/IEC-29500-1]
§22.1.2.81; phant")
·
r ("[ISO/IEC-29500-1]
§22.1.2.87; r")
·
rad ("[ISO/IEC-29500-1]
§22.1.2.88; rad")
·
sPre ("[ISO/IEC-29500-1]
§22.1.2.99; sPre")
·
sSub ("[ISO/IEC-29500-1]
§22.1.2.101; sSub")
·
sSubSup ("[ISO/IEC-29500-1]
§22.1.2.103; sSubSup")
·
sSup ("[ISO/IEC-29500-1]
§22.1.2.105; sSup")
The ctrlPr element ("[ISO/IEC-29500-1]
§22.1.2.23; ctrlPr") can contain one of the following elements:
·
The AML annotation element
·
The Word 2003 XML rPr element
The oMath element ("[ISO/IEC-29500-1]
§22.1.2.78; oMathPara") and the math argument elements deg ("[ISO/IEC-29500-1]
§22.1.2.26; deg"), den ("[ISO/IEC-29500-1]
§22.1.2.28; den"), e ("[ISO/IEC-29500-1]
§22.1.2.32; e"), fName ("[ISO/IEC-29500-1]
§22.1.2.37; fName"), lim ("[ISO/IEC-29500-1]
§22.1.2.52; lim"), num ("[ISO/IEC-29500-1]
§22.1.2.75; num"), sub ("[ISO/IEC-29500-1]
§22.1.2.112; sub"), and sup ("[ISO/IEC-29500-1]
§22.1.2.114; sup") can each contain an unbounded number of elements from
the following list:
·
XML elements in any namespace not defined by Word 2003 XML (which
can, in turn, hold any valid child element of the oMath
element ("[ISO/IEC-29500-1] §22.1.2.77; oMath"))
·
The AML annotation element
·
The Word 2003 XML hlink element
·
The Word 2003 XML permEnd element
·
The Word 2003 XML permStart element
When included as a child of a math argument element, those
elements must occur after any Office Open XML Math argPr
element ("[ISO/IEC-29500-1] §22.1.2.5; argPr") and before any
Office Open XML Math ctrlPr element ("[ISO/IEC-29500-1]
§22.1.2.23; ctrlPr") which is also a child of that math argument element.
The Office Open XML math run element r ("[ISO/IEC-29500-1]
§22.1.2.87; r") can contain:
·
A single Word 2003 XML rPr element
If the math run contains both an Office Open XML Math rPr element and a Word 2003 XML rPr
element, the Office Open XML Math rPr element must
occur first.
The Office Open XML math r
element can also contain an unbounded number of elements from the following
list:
·
Word 2003 XML fldChar element
·
Word 2003 XML noBreakHyphen element
·
Word 2003 XML pgNum element
·
Word 2003 XML pict element.
Note: Word is unable to recover the contents of the equationxml attribute if it includes a pict element.
·
Word 2003 XML softHyphen element
·
Word 2003 XML sym element
·
Word 2003 XML tab element
Those elements must occur after any rPr
elements.
Word ignores character styles, specified using the Word 2003
XML rStyle element, when converting the contents of
the equationxml attribute to Office Open XML Math.
Word is unable to recover the contents of the equationxml attribute if it includes the Word 2003 XML pict element.
When Word recovers the contents of the equationxml
attribute and the picture with the equationxml
attribute is inside a QUOTE field, Word will lose
any bookmarks represented using AML annotation elements inside the equationxml attribute.