GetMath - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools[Canvas]

  

GetMath

  

extract math from a canvas

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

GetMath(canvas)

GetMath(canvas, options)

Parameters

canvas

-

XML canvas string, or table

Description

• 

The GetMath command extracts the content from a canvas inserted by the ShowCanvas command, or Maple Learn canvas constructed by a command, or fetched by the GetCanvas command.

  

Note that ShowCanvas and button actions clicked in an active canvas will set the global variable, _canvas.  If the first argument is omitted, the _canvas global will be used. The returned list will contain Record structures describing the content.  Each Record will have a type field, such that elem[i]:-type will return "math", "text", or other identifier.  For elements that have their type member set to "math", there will be a math member containing the value.  Similarly text elements will have a text member containing the value.

• 

A "canvas" is an interactive section of a Maple document created by the NewCanvas command, or a shared web-based Maple Learn document.  See the Script command for a more complete description.

• 

When the keeptext=true option is given, the text content is returned in addition to the math.  The default is to return only the math content.

• 

When the keepall=true option is given, text and other content such as buttons are returned in addition to the math.  

• 

Empty math structures are normally pruned from the result.  Use the keepempty=true option to retain these.  Their math member will be set to the empty string, "".

• 

When the inert=true option is specified, operators will remain in InertForm style.  This prevents simplification, for example, returning `%+`(1,1) instead of 2.

• 

When the mathmlonly=true option is specified, the record's math field will be set to NULL, but the mathml field will remain populated.

Examples

Process a canvas from Maple Learn

• 

In this section we will fetch a shared canvas from Maple Learn, and process it.  This is similar to the processing that is done when clicking a button in Maple Learn.

withDocumentTools:-Canvas:

urlhttps://learn.maplesoft.com/?d=OULPGFDHIFNKDLJJGGMKJKNOARBJLHGRPOOKHKCQHPMFKMOTBFEHCUBUCQFNOGKSAMDOCUEFGMAJMQELFLEQEGOMETNULHFSCUGU:

cvGetCanvasurl:

seqelemmath,elem=GetMathcv

seqelemmath,elem=GetMathcv,keepempty

seq`if`elemtype=math,elemmath,elemtext,elem=GetMathcv,keeptext

seqelemmath,elem=GetMathcv,inert

Process an Active Canvas

• 

In this section we create and show a canvas, then use the global variable _canvas to access the state.

withDocumentTools:-Canvas:

cvNewCanvasAnother GetMath Example,ScriptButtonCheck Your Page,DoNothing,position=500,50:

ShowCanvascv,input=`%+`1,1,x2

av_canvas:

seqelemmath,elem=GetMathav

seqelemmath,elem=GetMathav,keepempty

seq`if`elemtype=math,elemmath,elemtext,elem=GetMathav,keeptext

seqelemmath,elem=GetMathav,inert

Compatibility

• 

The DocumentTools[Canvas][GetMath] command was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

Annotate

GetCanvas

Math

NewCanvas

Script

ShareCanvas

Text