DocumentTools/Canvas/Text - Maple Help

DocumentTools[Canvas]

 Text
 create a text structure with metadata

 Calling Sequence Text(caption) Text(caption, options) Text(format, arguments, options)

Parameters

 caption - string format - string containing "%1" arguments - anything

Description

 • The Text command is used by GetMath when extracting math and text from a canvas.  It packages text 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 be useful to use the Text command when constructing a canvas that will later be deployed to Maple Learn.
 • The Text command supports mixed text and math notation.  When given a first argument format string that contains the % character followed by a number, n, the text will display the nth argument in place of %n.

Examples

 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Canvas}\right):$
 > $\mathrm{cv}≔\mathrm{NewCanvas}\left(\left["Text Example",\mathrm{Text}\left("Mix text and %1",\frac{\mathrm{sqrt}\left({x}^{2}-1\right)}{y}\right),\mathrm{Text}\left("Sum %1 and %2",{a}^{2},{b}^{2}\right),\mathrm{Text}\left("The %1",\mathrm{_BOLD}\left("Pythagorean Theorem"\right)\right),\mathrm{Math}\left({a}^{2}+{b}^{2}={c}^{2}\right)\right]\right):$
 > $\mathrm{ShowCanvas}\left(\mathrm{cv}\right)$

Text records are returned from GetMath

 > $\mathrm{url}≔"https://learn.maplesoft.com/beta/index.html#/?d=OULPGFDHIFNKDLJJGGMKJKNOARBJLHGRPOOKHKCQHPMFKMOTBFEHCUBUCQFNOGKSAMDOCUEFGMAJMQELFLEQEGOMETNULHFSCUGU":$
 > $\mathrm{cv}≔\mathrm{GetCanvas}\left(\mathrm{url}\right):$
 > $M≔\mathrm{GetMath}\left(\mathrm{cv},'\mathrm{keeptext}'\right):$
 > $M\left[1\right]:-\mathrm{text}$
 > $M\left[1\right]:-\mathrm{id}$
 > $M\left[1\right]:-\mathrm{position}$

Compatibility

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