The data block dcc:formulaType is used to insert formulas and equations into the measurement result area of the DCC.
Please keep in mind that there are two different types of formula in codes. LaTeX and Presentation MathML is used for formulas in intention of presentation. Content MathML is machine-interpretable. As a good practice it is good to use machine interpretable formulas in data fields of the DCC and presentational formulas in text fields of the DCC.
The tree structure of the element type dcc:formulaType has the following appearance:
<xs:complexType name="formulaType">
<xs:annotation>
<xs:documentation>
This data block is used to add formulas and equations to the measurement result section of the DCC.
</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="latex" type="xs:string"/>
<xs:element name="mathml" type="dcc:xmlType"/>
</xs:choice>
<xs:attribute name="id" type="xs:ID" use="optional"/>
<xs:attribute name="refId" type="xs:IDREF" use="optional"/>
<xs:attribute name="refType" type="xs:string" use="optional"/>
</xs:complexType>
See the list of abbreviations here
| Element Element type |
Use | Description |
|---|---|---|
| dcc:latex xs:string |
[O] | This element can be used to store a latex-formatted string. |
| dcc:mathml dcc:xmlType |
[O] | The data block dcc:xmlType is used to insert formulas and equations into the measurement result area of the DCC. |
| Attribute AttributeType |
Use | Description |
|---|---|---|
| id xs:ID |
[O] | This standard DataType of XML is used to represent a unique ID. It is used to uniquely identify the object in the DCC. The data type xs:ID is deliberately used here because it enables validation without any add-ons in various tools. |
| refId xs:IDREF |
[O] | IDREF represents the IDREF attribute type from [XML 1.0 (Second Edition)]. The value space of IDREF is the set of all strings that match the NCName production in [Namespaces in XML]. The lexical space of IDREF is the set of strings that match the NCName production in [Namespaces in XML]. The base type of IDREF is NCName. |
| refType dcc:refTypesType |
[O] | A list of refTypes in XML. |
Formula: (a+b)²
<dcc:formula>
<dcc:mathml>
<ml:math xmlns:ml="http://www.w3.org/1998/Math/MathML" xsi:schemaLocation="http://www.w3.org/1998/Math/MathML https://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd">
<ml:mrow>
<ml:msup>
<ml:mfenced>
<ml:mrow>
<ml:mi>a</ml:mi>
<ml:mo>+</ml:mo>
<ml:mi>b</ml:mi>
</ml:mrow>
</ml:mfenced>
<ml:mn>2</ml:mn>
</ml:msup>
</ml:mrow>
</ml:math>
</dcc:mathml>
</dcc:formula>
The following interactive example demonstrates how to create simple formulae with SymPy in Python.
You can then export them for use in a DCC.
Note that you must adjust the namespace of the MathML elements according to the example above.