Wiris

Documentation / MathType

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

    • WirisQuizzes

      • Nubric

        • CalcMe

          • MathPlayer

            • Store FAQ

              • MathFlow

                • BF FAQ

                  • Miscellaneous

                    • Wiris Integrations

                      • Home
                      • MathType
                      • Getting started
                      • MathType for HTML editors
                      • MathType HTML generic integration

                      Embed MathType Hand in a web page

                      Reading time: 1min

                      Use this guide when you want to embed the MathType Hand component into a web page so users can enter mathematical expressions by handwriting and retrieve the recognized MathML.

                      Before you begin

                      Requirements

                      Make sure you have:

                      • A web application where you can include JavaScript.
                      • Access to the MathType Hand script.
                      • A valid MathType license for production use.

                      Applies to

                      MathType for HTML editors · MathType Generic Integration · MathType Hand

                      Steps

                      Create a container

                      Create an HTML element that will host the handwriting canvas.

                      <div id="handContainer"></div>

                      The handwriting canvas automatically fills the dimensions of its parent container. Define the container size using CSS if needed. For example:

                      <div
                        id="handContainer"
                        style="width:500px;height:300px">
                      </div>

                      Load the MathType Hand script

                      Include the MathType Hand JavaScript library.

                      <script src="https://www.wiris.net/demo/hand/hand.js"></script>

                      For production deployments, load the script from your own MathType installation whenever possible.

                      Initialize MathType Hand

                      Create a new Hand instance and insert it into the container.

                      var hand;
                      
                      window.onload = function () {
                      
                        hand = com.wiris.js.JsHand.newInstance();
                      
                        hand.insertInto(
                          document.getElementById("handContainer")
                        );
                      
                      };

                      Retrieve the recognized MathML

                      Call getMathML() to retrieve the recognized expression.

                      const mathml = hand.getMathML();

                      To display an existing formula in the handwriting editor, use:

                      hand.setMathML(mathml);

                      Listen for recognition events (optional)

                      You can listen for handwriting events to react whenever the recognized expression changes.

                      hand.addHandListener({
                      
                        contentChanged: function () {
                      
                          console.log(hand.getMathML());
                      
                        }
                      
                      });

                      Additional events are available through the JavaScript GUI API.

                      Start your application

                      Load or reload the page containing the handwriting editor.

                      Verify it worked

                      Check that:

                      • The handwriting canvas is displayed.
                      • Handwritten expressions are recognized.
                      • getMathML() returns valid MathML.
                      • Previously generated MathML can be loaded again using setMathML().

                      Options and variations

                      Customize the handwriting experience

                      MathType Hand supports several customization parameters, including:

                      • Handwriting color.
                      • Stroke width.
                      • Preview zoom.
                      • Read-only mode.
                      • Recognition constraints.

                      For the complete list of supported parameters, see MathType Hand parameters.

                       

                      Preserve handwriting strokes

                      If you want to preserve the original handwritten input in addition to the recognized MathML, use the handwriting APIs described in the JavaScript GUI API reference.

                      Common errors

                      The handwriting canvas is not displayed

                      Verify that:

                      • The Hand script is loaded correctly.
                      • The container element exists.
                      • The container has a visible size.

                      No MathML is returned

                      Verify that:

                      • Handwriting recognition has completed.
                      • The expression can be recognized.
                      • The Hand instance has been initialized successfully.

                      Recognition quality is lower than expected

                      Consider restricting the recognition domain by configuring symbol and structure constraints.

                      See Configure Hand recognition constraints.

                       

                      Related articles

                      • Configure Hand recognition constraints.
                      • MathType Hand parameters.
                      • JavaScript GUI API reference.

                      Was this article helpful?

                      Give feedback about this article

                      Related Articles

                      • Use MathType with CKEditor 4 via CDN
                      • Using MathType with WordPress
                      • Use MathType with TinyMCE in React

                      Embed MathType Hand in a web page

                      Before you begin Requirements Applies to Steps Create a container Load the MathType Hand script Initialize MathType Hand Retrieve the recognized MathML Listen for recognition events (optional) Start your application Verify it worked Options and variations Customize the handwriting experience Preserve handwriting strokes Common errors The handwriting canvas is not displayed No MathML is returned Recognition quality is lower than expected Related articles

                      Empowering STEM education

                      MathType

                      • Office Tools
                      • LMS
                      • XML
                      • HTML

                      WirisQuizzes

                      Nubric

                      Integrations

                      Solutions

                      • Education
                      • Publishing houses – platforms and interactive
                      • Publishing houses – Print and digital
                      • Technical writers

                      Pricing

                      Downloads

                      Blog

                      • Success stories

                      About us

                      • Careers
                      • Partnership

                      Contact Us

                      Contact Sales

                      European union (European Regional Development Fund) and 1EdTech (TrustEd Apps Certified)
                      • Cookie Policy
                      • Terms of Use
                      • Privacy Policy / GDPR
                      • Student Data Privacy
                      • Compliance
                      • Cookie Settings

                      © Wiris 2026

                      Expand