Project | WXT | Basics | Download | Documentation | Samples

Formulas

If you want to present mathemathical formulas in your material, you can do this in many ways:

  1. Images. You may use a program like Open Office or Microsoft Office. Use the Formula editor and make formula objects on a page. You can then freeze a screenshot of the page, clip out the formula and save it as an image.
  2. Images againYou may use one of the many tools, online or offline, that produce imgages from LaTex.
  3. MathML. You may write MathML code directly in your material.
  4. Google. You may write LaTeX code directly in a the src attribute in an img-element and let Google prepare an image of the formula, See Google Chart Formulas [19] . The robustness of this approach depends of course on the stability of the Google tool.
  5. LaTex You may write let WXT convert LaTex to images.
  6. Open Office You may make an Open Office document and let WXT extract the formulas as MatML, see ODTFormulas .
  7. You may use an XML document describing formulas either as LaTex (latex), MathMl (mathml), LaTeX (google) or image (image). See Formulas .
  8. You may define one formula either as matml, latex, google or imagel. See Formula .

The advantages of involving WXT (5,6,7,8) is that you may find and edit your formulas in one (or a limited) places and you may produce lists of used formulas, Formula List

Browsers

Note that browsers haved different capabilities when we get to MathML. You should check this out before deciding how to present math to a wider audience.

WXT is at the moment aimed as HTML5, which means that generated MatML may not work on all browser.

Formula file

Sample

<?xml version="1.0" encoding="UTF-8"?>
<formulas>
 
    <formula id="f1" type="latex">
    <value>\sqrt[3]{x^3 + y^3 \over 2}</value>
    </formula>
 
    <formula id="f21" type="image">
    <subtext>Vector length</subtext>
    <value>vektor1.gif</value>
    </formula>
 
    <formula id="f31" type="mathml">
    <subtext>Simple sum</subtext>
    <value><![CDATA[<math xmlns="http://www.w3.org/1998/Math/MathML">
              <semantics>
                <mrow>
                  <mrow>
                    <mo stretchy="false">∑</mo>
                    <mi>f</mi>
                  </mrow>
                  <mrow>
                    <mo stretchy="false">(</mo>
                    <mi>x</mi>
                    <mo stretchy="false">)</mo>
                  </mrow>
                </mrow>
              </semantics>
            </math>]]>
    </value>
    </formula>
 
</formulas>

Schema for formula files

<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2011 (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="value" type="xs:string"/>
    <xs:element name="subtext" type="xs:string"/>
    <xs:element name="formulas">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="formula" maxOccurs="unbounded"/>
            </xs:sequence>
                        <xs:attribute name="catalog" type="xs:string" use="optional"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="formula">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="subtext" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="value" minOccurs="1" maxOccurs="1"/>
            </xs:sequence>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="image"/>
                        <xs:enumeration value="latex"/>
                        <xs:enumeration value="mathml"/>
                        <xs:enumeration value="google"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="id" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>
</xs:schema>