create a math structure with metadata
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 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.
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.
m ≔ Math⁡x+y
m≔Record⁡position=undefined,mathml=<math plot='true' result='true' hascursor='false' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow></math>,border=false,math=x+y,dependency=,box=,custom=,container=group,gridpos=,readonly=false,result=true,plot=true,id=36893628171580983388,xmlns=http://www.w3.org/1998/Math/MathML,hascursor=false,istext=false,annotation=,groupnum=−1,type=math
<math plot='true' result='true' hascursor='false' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow></math>
The ShowCanvas command respects some of the properties, such as annotation and position:
m2 ≔ Math⁡x2+y2,position=600,100:
m3 ≔ Math⁡x3+y3,annotation=Example 3:
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:
m4 ≔ Math⁡`%+`⁡1,1=Typesetting:-mspace⁡,readonly=true:
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.
m5 ≔ Math⁡<math><mfrac><mspace/><mn>2</mn></mfrac></math>:
Here are some other options, of which some of these control behavior that may only apply to the Maple Learn environment.
cv6 ≔ NewCanvas⁡Group⁡Text⁡Math Attributes:,Math⁡`%+`⁡x,1,1,Math⁡`%+`⁡x,1,1,readonly=true,annotation=Read-only,Math⁡`%+`⁡x,1,1,result=false,annotation=Turn off computation result,Math⁡`%+`⁡x,1,plot=false,annotation=Don't plot,Math⁡`%+`⁡x,1,istext=true,annotation=Text,Math⁡`%+`⁡x,1,background=red,annotation=Background color,Math⁡`%+`⁡x,1,color=green,annotation=Font color:
When fetching a canvas from Maple Learn, the GetMath command calls Math(...) to create record structures.
url ≔ https://learn.maplesoft.com/#/?d=OULPGFDHIFNKDLJJGGMKJKNOARBJLHGRPOOKHKCQHPMFKMOTBFEHCUBUCQFNOGKSAMDOCUEFGMAJMQELFLEQEGOMETNULHFSCUGU:
cv ≔ GetCanvas⁡url:
M ≔ GetMath⁡cv:
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.
Download Help Document
What kind of issue would you like to report? (Optional)