DocumentTools/Canvas/Math - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : DocumentTools/Canvas/Math

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

position=[posint,posint]

-

(optional) absolute position of math

annotation=string

-

(optional) annotation

attributes=list(equation)

-

(optional) Maple-Learn math attributes

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 behaviour and/or look of the math in the Learn canvas.

• 

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 behaviour 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.

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

mRecordtype=math&comma;mathml=<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>&plus;</mo><mi>y</mi></mrow></math>&comma;math=x+y&comma;id=36893627797188378748&comma;readonly=false&comma;position=undefined&comma;gridpos&comma;box=&comma;annotation=&comma;dependency=&comma;istext=false&comma;container=group

(1)

m:-math

x+y

(2)

m:-mathml

<math 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, like annnotation 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 can't 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

Other properties control behaviour only in the Maple Learn environment.  Some of these are as follows:

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

ShareCanvascv6

When fetching a canvas from MapleLearn, 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.

See Also

Annotate

GetCanvas

Math

NewCanvas

Script

ShareCanvas

ShareCanvas

Text