Documentation / MathType

  • Demos
  • Visit our website
  • Downloads
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Home
                    • MathType
                    • MathType Integrations
                    • MathType web interface features
                    • MathType web interface features

                    Content MathML

                    Reading time: 2min

                    MathType 7 works natively with the MathML presentation because it captures all the design features that authors may need. MathType 7 can also enter and generate MathML content. Formulas can be imported / exported to content MathML as long as they are well-formed according to a built-in content grammar.

                    For example, these are valid formulas

                    whereas the following are not

                    Content MathML is related to the evaluation of formulas. Check the MathType decimal evaluation.

                    Enabling syntax checker

                    First of all, it is worth it to enable the syntax checker in order to help users eliminate mistakes when writing formulas. The syntax checker highlights any formula that is not well formed, and thus cannot be converted to content MathML.

                    The 3+ is not a well formed formula according to MathType 7

                    Remember, you can embed MathType in any web page. To enable the syntax checking, use this line when initializing MathType 7

                    editor = com.wiris.jsEditor.JsEditor.newInstance({'checkSyntax': 'true'});

                    or any time after the editor is created

                    editor.setParams({'checkSyntax': 'true'})

                    Sending content MathML to the editor

                    The web-based MathType 7 accepts both presentation and content MathML directly. The different rendering engines also accept content MathML (for example, when generating PNG images).

                    Getting content MathML

                    MathType 7 user interface (JavaScript) can only output presentation MathML. To obtain content MathML, a Web service or a direct call using Java or .NET is required to do the conversion from presentation MathML to content MathML.

                    Getting content MathML with Web service

                    A call to the Web service with both GET and POST methods is possible. In general, it is preferable to use the POST method in order to avoid size limitations. The call has the form:

                     www.wiris.net/demo/editor/mathml2content?mml=presentation-mathml

                    where presentation-mathml is the presentation MathML. For example,

                     www.wiris.net/demo/editor/mathml2content?mml=<math><mn>1</mn><mo>-</mo><mn>2</mn></math>

                    will return the following content MathML string in the browser:

                     <math><apply><minus></minus><cn>1</cn><cn>2</cn></apply></math>

                    Getting content MathML with a direct call with Java or .NET

                    To use this method you will need a license to download and run the MathType - server components. These are available for Java and .NET.

                    The source code in Java:

                     PublicServicesInterface ps = PublicServices.getInstance();
                     Properties p = new Properties();
                     String content = ps.mathml2content(
                     "<math><mn>1</mn><mo>+</mo><mn>2</mn></math>",p);
                    

                    For c#:

                     PublicServicesInterface ps = PublicServices.getInstance();
                     Dictionary<string,string> d = new Dictionary<string,string>();
                     string content = ps.mathml2content(
                     "<math><mn>1</mn><mo>+</mo><mn>2</mn></math>",d);
                    

                    You will need to add the WIRISeditor.jar in the classpath (or the WIRISeditor.dll for .NET).

                    Converting from content MathML to presentation MathML

                    The web-based editor accepts content MathML, so in most scenarios you will not need to convert from content MathML to presentation MathML.

                    In case you need to, you can use the service or the method called content2mathml in a similar way to when converting to content MathML.

                     https://www.wiris.net/demo/editor/content2mathml?mml=<math><apply><minus/><cn>1</cn><cn>2</cn></apply></math>

                    returns this string in the browser:

                     <math><mn>1</mn><mo>-</mo><mn>2</mn></math>

                    Was this article helpful?

                    Yes
                    No
                    Give feedback about this article

                    Related Articles

                    • MathType for WordPress
                    • Handwritten input
                    • Formula persistence

                    Content MathML

                    Enabling syntax checker Sending content MathML to the editor Getting content MathML Getting content MathML with Web service Getting content MathML with a direct call with Java or .NET Converting from content MathML to presentation MathML

                    Making people’s STEM work more meaningful

                    MathType

                    • MathType for Office Tools
                    • MathType for Mac
                    • MathType for Microsoft 365
                    • MathType for Google Workspace
                    • MathType for LMS
                    • MathType for XML Editors
                    • Arabic notation
                    • Our products accessibility
                    • MathType is online

                    WirisQuizzes

                    Learning Lemur

                    Solutions for Education

                    • Blackboard Learn
                    • Brightspace by D2L
                    • Canvas
                    • Google Classroom
                    • Moodle
                    • Schoology

                    Solutions for Publishing Houses

                    Solutions for Technical Writers

                    Solutions for Chemistry

                    Integrations

                    • HTML Editors
                    • MathType in WordPress

                    Pricing

                    Company

                    Careers

                    Blog

                    Contact Us

                    Buy Now

                    Plugin Downloads

                    © Wiris 2025

                    • Cookie Settings
                    • Cookie Policy
                    • Terms of Use
                    • Privacy Policy / GDPR
                    • Student Data Privacy
                    • Compliance
                    • Powered by Helpjuice
                    Expand