API services MathType Web provides the following services: Generate images of formulas with the following formats: PNG, SVG, PDF, EPS, SWF. Convert MathML from/to LaTeX. Generate a textual representation of a formula for accessibility. Convert presentation MathML from/to content MathML. Provide a simple formula calculator. Works with floating point numbers. Not to be confused with Wiris CAS. There are mainly two interfaces to the services: Web service interface based on simple HTTP calls. Direct calls to a library, available as Java and .NET. Licensing note. It is important to read carefully the terms at the MathType store. Rendering images MathType Web can generate images of formulas from Presentation MathML, Content MathML or LaTeX and export them to PNG, SWF, SVG, PDF and EPS. Web service http://domain/context-path/render GET and POST parameters: mml: Presentation MathML or Content MathML that represents the formula. latex: LaTeX code that represents the formula. format: format of the image. Allowed values are png, swf, svg, pdf, and eps. If not specified, png is used. Parameters from this list. Examples: https://www.wiris.net/demo/editor/render?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E&backgroundColor=%23f00 https://www.wiris.net/demo/editor/render?format=svg&latex=2-x Alternative services: http://domain/context-path/render.png\\ http://domain/context-path/render.swf\\ http://domain/context-path/render.svg\\ http://domain/context-path/render.eps\\ http://domain/context-path/render.pdf When calling to render.png, render.swf, render.svg, render.eps, or render.pdf instead of render, format parameter is taken as png, swf, svg, eps, or pdf respectively. Java Detailed information is available in the reference pages: PublicServicesInterface.renderPng PublicServicesInterface.renderSwf PublicServicesInterface.renderSvg PublicServicesInterface.renderEps PublicServicesInterface.renderPdf Example: Properties p = new Properties(); p.setProperty("color", "red"); Properties out = new Properties(); byte[] imageBytes = PublicServices.getInstance().renderPng(null, "2-x", p, out); int width = Integer.parseInt(out.getProperty("width")); .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.renderPng PublicServicesInterface.renderSwf PublicServicesInterface.renderSvg PublicServicesInterface.renderEps PublicServicesInterface.renderPdf Example: Dictionary<string, string> p = new Dictionary<string, string>(); p["color"] = "red"; Dictionary<string, string> out = new Dictionary<string, string>(); byte[] imageBytes = PublicServices.getInstance().renderPng(null, "2-x", p, out); int width = int.Parse(out["width"]); MathML Classic input coverage MathType Web implements MathML 2.0 and 3.0 MathML coverage page Handwriting coverage Handwriting coverage LaTeX to MathML MathType Web provides a service to convert LaTeX code into Presentation MathML. The list of LaTeX commands currently supported by MathType Web, with examples, can be found here. Web service http://domain/context-path/latex2mathml GET and POST parameters: latex: LaTeX code that represents the formula. saveLatex: if defined, the LaTeX code is stored inside the result MathML as an annotation. grammar: the URL of the transformation grammar used to convert from LaTeX to MathML. If not specified, the default grammar is used. Examples: https://www.wiris.net/demo/editor/latex2mathml?latex=2-x https://www.wiris.net/demo/editor/latex2mathml?latex=2-x&saveLatex Java Detailed information is available in the reference page: PublicServicesInterface.latex2mathml Example: String mathml = PublicServices.getInstance().latex2mathml("2-x", false, null); Result: .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.latex2mathml Example: string mathml = PublicServices.getInstance().latex2mathml("2-x", false, null); Result: MathML to LaTeX MathType Web provides a service to convert Presentation MathML into LaTeX code. The list of MathML commands currently supported by MathType Web, with examples, can be found here. Web service http://domain/context-path/mathml2latex GET and POST parameters: mml: Presentation MathML that represents the formula. saveMathML: if defined, the MathML is stored inside the result LaTeX code as a comment. grammar: the URL of the transformation grammar used to convert from MathML to LaTeX. If not specified, the default grammar is used. Examples: https://www.wiris.net/demo/editor/mathml2latex?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E https://www.wiris.net/demo/editor/mathml2latex?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E&saveMathML Java Detailed information is available in the reference page: PublicServicesInterface.mathml2latex Example: String latex = PublicServices.getInstance().mathml2latex("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", false, null); Result: .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.mathml2latex Example: String latex = PublicServices.getInstance().mathml2latex("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", false, null); Result: LaTeX coverage LaTex is a ocean of options; we offer a subset of it. LaTeX coverage page. Content MathML to Presentation MathML MathType Web provides a service to convert Content MathML into Presentation MathML. The list of Content MathML tags currently supported by MathType Web can be found here. Web service http://domain/context-path/content2mathml GET and POST parameters: mml: Content MathML that represents the formula. grammar: the URL of the transformation grammar used to convert from Content MathML to Presentation MathML. If not specified, the default grammar is used. Examples: https://www.wiris.net/demo/editor/content2mathml?mml=%3Cmath%3E%3Capply%3E%3Cminus%3E%3C/minus%3E%3Ccn%3E2%3C/cn%3E%3Cci%3Ex%3C/ci%3E%3C/apply%3E%3C/math%3E Java Detailed information is available in the reference page: PublicServicesInterface.content2mathml Example: String mathml = PublicServices.getInstance().content2mathml("<math><apply><minus></minus><cn>2</cn><ci>x</ci></apply></math>", null); Result: <math><mn>2</mn><mo>-</mo><mi>x</mi></math> .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.content2mathml Example: string mathml = PublicServices.getInstance().content2mathml("<math><apply><minus></minus><cn>2</cn><ci>x</ci></apply></math>", null); Result: <math><mn>2</mn><mo>-</mo><mi>x</mi></math> Presentation MathML to Content MathML MathType Web provides a service to convert Presentation MathML into Content MathML. The list of Presentation MathML tags currently supported by MathType Web can be found here. Web service http://domain/context-path/mathml2content GET and POST parameters: mml: Presentation MathML that represents the formula. grammar: the URL of the transformation grammar used to convert from Presentation MathML to Content MathML. If not specified, the default grammar is used. Examples: https://www.wiris.net/demo/editor/mathml2content?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E Java Detailed information is available in the reference page: PublicServicesInterface.mathml2content Example: String mathml = PublicServices.getInstance().mathml2content <math><mn>2</mn><mo>-</mo><mi>x</mi></math> ", null); Result: <math><apply><minus></minus><cn>2</cn><ci>x</ci></apply></math> .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.mathml2content Example: string mathml = PublicServices.getInstance().mathml2content <math><mn>2</mn><mo>-</mo><mi>x</mi></math> ", null); Result: <math><apply><minus></minus><cn>2</cn><ci>x</ci></apply></math> Accessible text to MathML MathType Web provides a service to convert accessible textual representations into Presentation MathML. Web service http://domain/context-path/accessible2mathml GET and POST parameters: accessible: text represents the formula. lang: language code in ISO 639 format (“en”, “es”, etc). Examples: https://www.wiris.net/demo/editor/accessible2mathml?accessible=2%20minus%20x https://www.wiris.net/demo/editor/accessible2mathml?accessible=2%20menos%20x&lang=es Java Detailed information is available in the reference page: PublicServicesInterface.accessible2mathml Example: String mathml = PublicServices.getInstance().accessible2mathml("2 minus x", "en", null); Result: <math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn><mo>-</mo><mi>x</mi></math> .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.accessible2mathml Example: string mathml = PublicServices.getInstance().accessible2mathml("2 minus x", "en", null); Result: <math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn><mo>-</mo><mi>x</mi></math> MathML to accessible text MathType Web provides a service to convert Presentation MathML into accessible text. Web service http://domain/context-path/mathml2accessible GET and POST parameters: mml: Presentation MathML that represents the formula. lang: language code in ISO 639 format (“en”, “es”, etc). Examples: https://www.wiris.net/demo/editor/mathml2accessible?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E https://www.wiris.net/demo/editor/mathml2accessible?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E&lang=es Java Detailed information is available in the reference page: PublicServicesInterface.mathml2accessible Example: String accessible = PublicServices.getInstance().mathml2accessible("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", "en", null); Result: 2 minus x .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.mathml2accessible Example: string accessible = PublicServices.getInstance().mathml2accessible("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", "en", null); Result: 2 minus x Comparing equations MathType Web provides a service to compare two MathML equations. The resulting equation will have the missing parts from the "before" equation highlighted in red and the added ones in the "after" equation in green. The MathML will also include the "before" and "after" equations as annotations. Web service http://domain/context-path/compare POST parameters before: equation to compare after: equation to compare format: format used by the equations. The only accepted value is 'mathml'. Defaults to 'mathml' if not set. Examples: Given the following MathML equations: before: <math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>+</mo><mfrac><mrow><mn>3</mn><msup><mi>x</mi><mn>2</mn></msup></mrow><mn>2</mn></mfrac></math> after: <math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mrow><mn>3</mn><msup><mi>y</mi><mn>2</mn></msup></mrow><mi mathvariant="normal">π</mi></mfrac><mo>+</mo><mn>1</mn></math> the service will return a combination of both equations styled in red and green as the rules above explain. Evaluating formulas MathType Web can evaluate Presentation MathML or Content MathML to a floating point value. It admits a list of variable values that will be replaced before the evaluation. There is more information about this feature here. The list of Content MathML tags currently supported by MathType Web can be found here. Web service http://domain/context-path/evaluate GET and POST parameters: mml: Presentation MathML or Content MathML that represents the formula. Parameters starting with “var_”, to define variable values. Example: “var_x=4.5”. Examples: https://www.wiris.net/demo/editor/evaluate?mml=%3Cmath%3E%3Cmn%3E2%3C/mn%3E%3Cmo%3E-%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E&var_x=4.5 https://www.wiris.net/demo/editor/evaluate?mml=%3Cmath%3E%3Cmi%3Ey%3C/mi%3E%3Cmo%3E/%3C/mo%3E%3Cmi%3Ex%3C/mi%3E%3C/math%3E&var_x=52&var_y=23 Java Detailed information is available in the reference page: PublicServicesInterface.evaluate Example: Properties variables = new Properties(); variables.setProperty("x", "4.5"); double result = PublicServices.getInstance().evaluate("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", variables, null); Result: -2.5 .NET Detailed information is available in the reference page (although the documentation itself is a Javadoc): PublicServicesInterface.evaluate Example: Dictionary<string, string> variables = new Dictionary<string, string>(); variables["x"] = "4.5"; double result = PublicServices.getInstance().evaluate("<math><mn>2</mn><mo>-</mo><mi>x</mi></math>", variables, null); Result: -2.5 Coverage evaluation the symbols appearing in the toolbar are the only ones that can be evaluated. Some extra simbols like || for absolute value. Error handling All services now accept these request parameters: httpstatus: If true then the service will return HTTP status code 5xx on error. Otherwise, if not defined or false, the service does not label errors; always returns HTTP status code 200. Table of Contents Rendering images LaTeX to MathML MathML to LaTeX LaTeX coverage Content MathML to Presentation MathML Presentation MathML to Content MathML Accessible text to MathML MathML to accessible text Comparing equations Evaluating formulas Error handling