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

DocumentTools[Layout]

 Input
 generate XML for an Input element

 Calling Sequence Input( t )

Parameters

 t - The result from the Textfield constructor, or a sequence of such results

Description

 • The Input command returns an XML function call which represents an Input element of a Worksheet or Document.
 • The generated XML may be used with the results of additional commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document may be inserted into the current document using the InsertContent command.
 • The argument to the Input command is the result of a call to the Textfield constructor.
 • The result of the Input command is suitable as an argument to the Group command, in the sense that an Execution Group  of a worksheet can contain an input region.
 • An input region, represented here by the result of a call to the Input command, can be used in two key ways. One way consists of containing a Textfield comprising paragraphs of text, plots, or tables. Another way consists of containing a Textfield comprising executable statements, and this can be accompanied in an execution group by the result of the Output constructor.

Examples

 > $\mathrm{with}\left(\mathrm{DocumentTools}\right):$
 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Layout}\right):$

Executing the Input command produces a function call.

 > $\mathrm{Inp}≔\mathrm{Input}\left(\mathrm{Textfield}\left("Some text."\right)\right)$
 {\mathrm{Inp}}{≔}{\mathrm{_XML_Input}}{}\left({\mathrm{_XML_Text-field}}{}\left({"alignment"}{=}{"centred"}{,}{"style"}{=}{"Text"}{,}{"layout"}{=}{"Normal"}{,}{"Some text."}\right)\right) (1)

By using additional commands from the Layout Constructors package a nested function call can be produced which represents an entire worksheet.

 > $\mathrm{xml}≔\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Inp}\right)\right):$

That XML representation of a worksheet can be inserted directly.

 > $\mathrm{InsertContent}\left(\mathrm{xml}\right):$

Some text.

Text can also surround inlined typeset 2D Math expressions.

 > $\mathrm{E1}≔\mathrm{Equation}\left('\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i',\mathrm{style}=\mathrm{TwoDimInput}\right):$$\mathrm{E2}≔\mathrm{Equation}\left(\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}i\right),\mathrm{style}=\mathrm{TwoDimInput}\right):$T≔\mathrm{Textfield}\left("The sum of the first n positive integers",\mathrm{E1},"is equal to",\mathrm{E2},\mathrm{alignment}=\mathrm{left}\right):$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(T\right)\right)\right)\right):$

The sum of the first n positive integers $\sum _{i=1}^{n}i$ is equal to $\frac{n\left(n+1\right)}{2}$

A Textfield within an input region can also contain objects such as a plot or a table constructed respectively by the InlinePlot or Table constructors.

 > $P≔\mathrm{InlinePlot}\left(\mathrm{plot}\left(\frac{\mathrm{sin}\left(x\right)}{x}\right),\mathrm{height}=200\right):$$\mathrm{Inp}≔\mathrm{Input}\left(\mathrm{Textfield}\left(P\right)\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Inp}\right)\right)\right):$

The next example illustrates using 2-D Math input with an executable statement, accompanied by the corresponding output.

 > $\mathrm{Ein}≔\mathrm{Equation}\left('\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{i}^{2}\right)',\mathrm{style}=\mathrm{TwoDimInput},\mathrm{executable}=\mathrm{true}\right):$$\mathrm{Eout}≔\mathrm{Equation}\left(\mathrm{factor}\left(\sum _{i=1}^{n}\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{i}^{2}\right),\mathrm{style}=\mathrm{TwoDimOutput}\right):$\mathrm{Tin}≔\mathrm{Textfield}\left(\mathrm{Ein},\mathrm{alignment}=\mathrm{left},\mathrm{prompt}=">",\mathrm{style}=\mathrm{MapleInput}\right):$\mathrm{Tout}≔\mathrm{Textfield}\left(\mathrm{Eout}\right):$$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{Tin}\right),\mathrm{Output}\left(\mathrm{Tout}\right)\right)\right)\right):$
 > $\mathrm{factor}\left(\sum _{i=1}^{n}{i}^{2}\right)$
 $\frac{{n}{}\left({n}{+}{1}\right){}\left({2}{}{n}{+}{1}\right)}{{6}}$ (2)

The next example uses multiple lines of input, which can be a mix of text and math.

 > \mathrm{T1}≔\mathrm{Textfield}\left(\mathrm{alignment}=\mathrm{left},"This is a first line of text."\right):\mathrm{T2}≔\mathrm{Textfield}\left(\mathrm{alignment}=\mathrm{left},"This is a second line of text."\right):\mathrm{T3}≔\mathrm{Textfield}\left(\mathrm{alignment}=\mathrm{left},\mathrm{prompt}=">",\mathrm{style}=\mathrm{MapleInput},"sin\left(x\right);"\right):$\mathrm{InsertContent}\left(\mathrm{Worksheet}\left(\mathrm{Group}\left(\mathrm{Input}\left(\mathrm{T1},\mathrm{T2},\mathrm{T3}\right)\right)\right)\right):$

This is a first line of text.

This is a second line of text.

 > $\mathrm{sin}\left(x\right)$

Compatibility

 • The DocumentTools:-Layout:-Input command was introduced in Maple 2015.
 • For more information on Maple 2015 changes, see Updates in Maple 2015.