Math Container Component - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Components : Math Container Component

DocumentTools[Components]

  

MathContainer

  

generate XML for a MathContainer Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

MathContainer( expr, opts )

Parameters

expr

-

(optional) algebraic; an expression.

opts

-

(optional) ; one or more keyword options as described below

Options

• 

autofit : truefalse:=false; Indicates whether the component will automatically resize to fit its contents. The default value is false.

• 

attribute string :=; Specifies the value of an attribute that can be seen only in the component properties.  This may be useful for storing non-visible state.

• 

editable truefalse :=true; Specifies whether the math expression can be edited, or if it should be display-only.

• 

fillcolor : {list(nonnegint),symbol,string}:=[255,255,255] ; Specifies the background color of the component. The passed value can be either a named color or a list of three integers each between 0 and 255. A list of nonnegative integers is interpreted as RGB values in a 24bit 3-channel color space. The default value is [255,255,255] which corresponds to white.

• 

height  posint:=200; The height in pixels of the component. The default value is 200.

• 

width  posint:=300; The width in pixels of the component. The default value is 300.

• 

minheight  nonnegint:=0; The minimum height in pixels of the component when autofit = true. The default value is 0.

• 

minwidth  nonnegint:=0; The minimum width in pixels of the component when autofit = true. The default value is 0.

• 

identity : {name,string}; The reference name of the component.

• 

scrolldown  truefalse:=false; Specifies whether the component will automatically scroll down when its contents are set, when autofit = false. The default value is false.

• 

showborders : truefalse:=true; Indicates whether the components borders will be shown. The default value is true.

• 

value : string ; MathML representation of the content expression. This option can only be used if no expression argument expr is passed.

• 

visible : truefalse; Indicates whether the component is visible. The default is true.

Description

• 

The MathContainer command in the Component Constructors package returns an XML function call which represents a Math Expression Component.

• 

The generated XML can be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document can be inserted into the current document using the InsertContent command.

Examples

> 

with⁡DocumentTools:

> 

with⁡DocumentTools:-Components:

> 

with⁡DocumentTools:-Layout:

> 

e≔sqrt⁡x

e≔x

(1)

Executing the MathContainer command produces a function call.

> 

S≔MathContainer⁡e,identity=MathContainer0

S≔_XML_EC-MathContainer⁡id=MathContainer0,pixel-width=300,pixel-height=200,dag=LUkmbXNxcnRHNiQlKnByb3RlY3RlZEcvJSttb2R1bGVuYW1lR0ksVHlwZXNldHRpbmdHNiRGJSUoX3N5c2xpYkc2Iy1JI21pRzYkRiUvRidGKDYjUSJ4NiI=,visible=true,show-border=true,scroll-down=false,autofit=false,minimum-pixel-width=0,minimum-pixel-height=0,fillcolor=[255,255,255]

(2)

By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.

> 

xml≔Worksheet⁡Group⁡Input⁡Textfield⁡S:

That XML representation of a worksheet can be inserted directly.

> 

InsertContent⁡xml:

> 

S≔MathContainer⁡sqrt⁡y,identity=MathContainer0,autofit:

> 

xml≔Worksheet⁡Group⁡Input⁡Textfield⁡S:

The previous example's call to the InsertContent command inserted a component with identity "MathContainer0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "MathContainer0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

The return value of the following call to InsertContent is a table which can be used to reference the substituted identity of the inserted component.

> 

lookup≔InsertContent⁡xml,output=table

lookup≔table⁡MathContainer0=MathContainer1

(3)

> 

lookupMathContainer0

MathContainer1

(4)
> 

GetProperty⁡lookupMathContainer0,expression

y

(5)

The fillcolor can be specified to match that of a parent Table Cell.

> 

exprs≔FunctionAdvisor⁡sin,identities,quiet

exprs≔sin⁡arcsin⁡z=z,sin⁡z=−sin⁡−z,sin⁡z=2⁢sin⁡z2⁢cos⁡z2,sin⁡z=1csc⁡z,sin⁡z=2⁢tan⁡z21+tan⁡z22,sin⁡z=−I2⁢ⅇI⁢z−ⅇ−I⁢z,sin⁡z2=1−cos⁡z2,sin⁡z2=12−cos⁡2⁢z2

(6)
> 

S≔seq⁡MathContainer⁡identity=cat⁡MathContainer,i,autofit,showborders=false,fillcolor=#ddeeff,i=1..numelems⁡exprs:xml≔Worksheet⁡Table⁡alignment=center,width=300,widthmode=pixels,Column⁡,seq⁡Row⁡Cell⁡Textfield⁡s,fillcolor=#ddeeff,s=S:

> 

cmptab≔InsertContent⁡xml,output=table:foritonumelems⁡exprsdoSetProperty⁡cmptabcat⁡MathContainer,i,expression,eval⁡exprs,1ienddo:

> 

Compatibility

• 

The DocumentTools:-Components:-MathContainer command was introduced in Maple 2015.

• 

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

• 

The fillcolor, width, minheight and minwidth options were introduced in Maple 2016.

• 

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

• 

The DocumentTools:-Components:-MathContainer command was updated in Maple 2020.

• 

The scrolldown option was introduced in Maple 2020.

• 

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

• 

The attribute and editable options were introduced in Maple 2024.

• 

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

See Also

Component Code

Component Constructors

DocumentTools

Embedded Components

XMLTools