<text>

A text string

<text> is a Text component that defines a string variable for use in evaluations and boolean expressions, or to store a value for future rendering.

Attributes and Properties

Attributes for <text>

Positioning (2)

point. Default value: \(\left( 0, 0 \right)\). Coordinates of the anchor point used to position this component on a graph.

positionFromAnchor

keyword. Where this component sits relative to its anchor point.

ValueDescription
upperRightPlace the component above and to the right of the anchor point.
upperLeftPlace the component above and to the left of the anchor point.
lowerRightPlace the component below and to the right of the anchor point.
lowerLeftPlace the component below and to the left of the anchor point.
topPlace the component directly above the anchor point.
bottomPlace the component directly below the anchor point.
leftPlace the component directly to the left of the anchor point.
rightPlace the component directly to the right of the anchor point.
center (default)Center the component on the anchor point.
Other (3)

boolean. Default value: true. Whether the text can be dragged on a graph.

isLatex

boolean. Default value: false. Whether the text content is treated as LaTeX.

layer

number. Default value: 0. Z-order layer index when shown on a graph.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <text name="t">

Positioning (2)
$t.anchor

point. The coordinates where this component is anchored on the graph.

$t.positionFromAnchor

text. Where this component sits relative to its anchor point.

Other (20)
$t.backgroundColor

text. Human-readable name for this component's background color, derived from the active style and theme.

$t.characters

[ text ]. The text value split into characters (graphemes).

$t.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$t.draggable

boolean. Whether the text can be dragged on a graph.

$t.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$t.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$t.hidden

boolean. Whether this component is hidden from the rendered output.

$t.isLatex

boolean. Whether the text content is treated as LaTeX.

$t.layer

number. Z-order layer index when shown on a graph.

$t.list

[ text ]. The text value split into items at commas.

$t.math

math. The text parsed as a math expression.

$t.number

number. The text parsed as a number.

$t.numCharacters

integer. The number of characters (graphemes) in the text value.

$t.numListItems

integer. The number of comma-separated items when the text is interpreted as a list.

$t.numWords

integer. The number of words in the text value.

$t.text

text. The text rendered as a plain text string.

$t.textColor

text. Human-readable name for this component's text color, derived from the active style and theme.

$t.textStyleDescription

text. Human-readable description of this component's text styling (color and any background color).

$t.value

text. The text value.

$t.words

[ text ]. The text value split into words.

Common to all components (4)
$t.doenetML

text. The DoenetML source code that produced this component.

$t.hide

boolean. Whether to hide this component from the rendered output.

$t.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$t.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Store a <text> for future rendering

<text> values are defined in a <setup> and referenced by name later for rendering.


Example: <text> used in a <boolean>

A <text> values is defined in a <setup> and referenced by name later in a <boolean>.


Example: <text> used on a <graph>

A <text> values is defined on a <graph>. The position of the <text> can be adjusted with the anchor attribute.


Example: <text> adaptable to <math> contexts

<text> values inserted into a <math> will be parsed as a <math> where possible.

Attribute Examples

Attribute Example: anchor

The anchor attribute determines the initial position of a <text> on a <graph>.


Attribute Example: draggable

The draggable attribute determines whether the <text> can be dragged around the <graph>. All graphical objects are draggable by default.