Math - 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]

  

Math

  

create a math structure with metadata

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Math(expression)

Math(expression, options)

Parameters

expression

-

anything

Description

• 

The Math command is used by GetMath when extracting math from a canvas.  It packages a math expression up into a record where it can be saved alongside other information relevant to the context of the canvas application, such as the id, position, and annotation.

• 

It can also be useful to use the Math command when constructing a canvas that will later be deployed to Maple Learn, especially when a non-default property is needed to change the behavior and/or look of the math in the Maple Learn canvas.

• 

When constructing a canvas expressions are passed through the Math command as a preprocessing step.  This includes the DataFrame data structure, which is translated into a data-table in the Maple Learn environment.   See Canvas,ElementsAndLayout for a complete list of elements.

• 

When the position option is given, the math will be located at those [x,y] pixel coordinates on the canvas.

• 

When the annotation option is given, the math will have a text message beside it on the canvas.

• 

When the attributes option is used, those attributes will be added to the MathML <math> tag.  Some such attributes can control the behavior and/or display of the expression when dispatched to Maple Learn via the ShareCanvas command.  Most often these attributes are ignored by ShowCanvas.  See the examples section for some examples of properties that are recognized.

• 

When unwrap=true it is expected that the given input expression is a list, and should be extracted as the contents of the list.  This allows the math to be extracted to a sequence.

• 

The background option can be set to a string or ColorTools:-Color object, and specifies the background color of the given math.

• 

The color option can be set to a string or ColorTools:-Color object, and specifies the color of the given math.

• 

The border option can be set to true in order for ShowCanvas to put a box border around the given expression.

• 

The custom option puts a custom attribute on the math expression that is useful when using GetMath in a script to find a particular math expression.

• 

The istext option indicates that this math expression should be considered as text (it will still render as Math, but the Maple Learn interface will put it in a group-text box).

• 

Setting readonly=true option will prevent editing this expression in the Maple Learn interface.

• 

Setting result=false will prevent display and calculation of the result value in the Maple Learn interface.

• 

Setting slider=false will prevent display of a slider when the given expression is an assignment of the form `&coloneq`(name,value)

• 

Setting plot=false will exclude this expression from the shared plot in the Maple Learn interface.

• 

Setting prefix=string, will prepend the given MathML string fragment to the expression

• 

Setting suffix=string, will append the given MathML string fragment to the expression

• 

Setting template=true, will cause an expression given as a list of math and MathML string fragments to be concatenated together

Examples

withDocumentTools:-Canvas&colon;

The Math command simply returns a record detailing properties of the given expression.  A significant property is called "math", and can be accessed via the colon-dash syntax.

mMathx+y

mRecordplot=true&comma;container=group&comma;position=undefined&comma;custom=&comma;dependency=&comma;result=true&comma;xmlns=http://www.w3.org/1998/Math/MathML&comma;gridpos=&comma;mathml=<math plot='true' result='true' hascursor='false' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>&plus;</mo><mi>y</mi></mrow></math>&comma;groupnum=−1&comma;math=x+y&comma;hascursor=false&comma;type=math&comma;box=&comma;border=false&comma;istext=false&comma;annotation=&comma;id=36893628093449377916&comma;readonly=false

(1)

m:-math

x+y

(2)

m:-mathml

<math plot='true' result='true' hascursor='false' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>&plus;</mo><mi>y</mi></mrow></math>

(3)

The ShowCanvas command respects some of the properties, such as annotation and position:

m2Mathx2+y2&comma;position=600&comma;100&colon;

ShowCanvasNewCanvasm2

m3Mathx3+y3&comma;annotation=Example 3&colon;

ShowCanvasNewCanvasm3

Some tricks can be used to format the math, such as using InertForm to prevent automatic simplification.  Here Typesetting:-mspace() is also used to create a blank:

m4Math`%+`1&comma;1=Typesetting:-mspace&comma;readonly=true&colon;

ShowCanvasNewCanvasm4

Incomplete expressions that cannot be represented as a Maple data structure can be written directly in MathML.  Here is an example that leaves the numerator of a fraction blank.

m5Math<math><mfrac><mspace/><mn>2</mn></mfrac></math>&colon;

ShowCanvasNewCanvasm5

Here are some other options, of which some of these control behavior that may only apply to the Maple Learn environment.

cv6NewCanvasGroupTextMath Attributes:&comma;Math`%+`x&comma;1&comma;1&comma;Math`%+`x&comma;1&comma;1&comma;readonly=true&comma;annotation=Read-only&comma;Math`%+`x&comma;1&comma;1&comma;result=false&comma;annotation=Turn off computation result&comma;Math`%+`x&comma;1&comma;plot=false&comma;annotation=Don't plot&comma;Math`%+`x&comma;1&comma;istext=true&comma;annotation=Text&comma;Math`%+`x&comma;1&comma;background=red&comma;annotation=Background color&comma;Math`%+`x&comma;1&comma;color=green&comma;annotation=Font color&colon;

ShareCanvascv6

When fetching a canvas from Maple Learn, the GetMath command calls Math(...) to create record structures.  

urlhttps://learn.maplesoft.com/#/?d=OULPGFDHIFNKDLJJGGMKJKNOARBJLHGRPOOKHKCQHPMFKMOTBFEHCUBUCQFNOGKSAMDOCUEFGMAJMQELFLEQEGOMETNULHFSCUGU&colon;

cvGetCanvasurl&colon;

MGetMathcv&colon;

M3:-math

M3:-id

M3:-annotation

M3:-position

Compatibility

• 

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

• 

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

• 

The DocumentTools[Canvas][Math] command was updated in Maple 2022.

• 

The unwrap, background, color, border, custom, istext, readonly, result, slider and plot options were introduced in Maple 2022.

• 

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

See Also

Annotate

Canvas,ElementsAndLayout

GetCanvas

NewCanvas

Script

ShareCanvas

Text