<mathList>
<mathList> is a Math
component that defines a list of math expressions, each like a <math>.
Some components that accept a <mathList> as an input include functions, repeats, and awards.
When creating a <mathList>, separate items by spaces, not commas.
The component will default to displaying the list with commas.
A comma between entries inside a <mathList> creates a tuple — a single
math — so <mathList>x, y, z</mathList> is a list with the single entry
(x,y,z), while <mathList>x y z</mathList> is a list of three entries.
To split a math that already contains commas into separate entries, use the
mergeMathLists attribute.
Attributes and Properties
Attributes for <mathList>
Highlighted (1)
asListboolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).
Number display (5)
avoidScientificNotationAdded in 0.7.16boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsinteger. Default value: 2. Number of decimal places to display when rendering this number.
displayDigitsinteger. Default value: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 1e-14. Threshold below which numbers are displayed as zero.
padZerosboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Other (7)
functionSymbolstextList. Default value: ["f","g"]. Symbols treated as function names when parsing items.
number. Default value: Infinity. Maximum number of items to retain in the list.
boolean. Whether nested math-list children should be flattened into this list.
parseScientificNotationboolean. Default value: false. Whether to parse expressions like 1e3 as scientific notation.
referencesAreFunctionSymbolsreference. References whose names should be treated as function symbols when parsing items.
splitSymbolsboolean. Default value: true. Whether multi-character symbols are split into a product of variables.
boolean. Default value: false. Whether the order of items in this list should be treated as unordered (e.g. for matching).
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <mathList name="m">
Number display (5)
$m.avoidScientificNotationIn developmentboolean. Whether to render numbers in full decimal form rather than scientific notation.
$m.displayDecimalsIn developmentinteger. Number of decimal places to display when rendering this number.
$m.displayDigitsIn developmentinteger. Number of significant digits to display when rendering this number.
$m.displaySmallAsZeroIn developmentnumber. Threshold below which numbers are displayed as zero.
$m.padZerosIn developmentboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Other (8)
$m.functionSymbolstextList. Symbols treated as function names when parsing items.
$m.maxNumbernumber. Maximum number of items to retain in the list.
$m.mergeMathListsboolean. Whether nested math lists are merged into the parent list.
number. The number of items in the list.
$m.numValuesnumber. The number of values in the list.
$m.parseScientificNotationboolean. Whether to parse expressions like 1e3 as scientific notation.
$m.splitSymbolsboolean. Whether multi-character symbols are split into a product of variables.
$m.unorderedboolean. Whether the order of items in this list should be treated as unordered (e.g. for matching).
Common to all components (8)
$m.disabledIn developmentboolean. Whether this component is disabled and cannot be interacted with.
$m.doenetMLtext. The DoenetML source code that produced this component.
$m.fixedIn developmentboolean. Whether this component's value is fixed and cannot be modified.
$m.fixLocationIn developmentboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$m.hideboolean. Whether to hide this component from the rendered output.
$m.isResponseIn developmentboolean. Whether this component is treated as a response for the purposes of assessment.
$m.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Defining a <mathList> and retrieving a value
The <mathList> component stores a list of math expressions.
To access an individual element in the list, use array notation with the named <mathList>.
Example: A <mathList> from multiple <mathInput/> tags
Combining a number of user-inputs into a <mathList> is a simple matter of
listing the named input references between the opening and closing tags.
Example: A <mathList> for function evaluation
Here, a <mathList> stores multiple input values to be used in the subsequent code for function evaluation.
Example: A <mathList> in a <repeat>
Here, a <mathList> is referenced within the for attribute of
a <repeat>.
Example: A <mathList> in an <award>
A <mathList> is frequently used in an <award> to compare two groups of values.
Comparisons can be ordered or unordered. (Also, specifying whether comparisons are to be ordered
can occur in the <award>, the <answer>, or the <mathList> itself.)
Attribute Examples
Attribute Example: unordered
If a <mathList> is defined with the unordered attribute,
comparisons (for validation in an <award> or a <boolean> for example) are
unordered automatically.
Attribute Example: maxNumber
The maxNumber attribute imposes a limit on the number of maths that can be stored in the list.
Attribute Example: mergeMathLists
If individual maths contained within a <mathList> contain multiple values, those
groupings will be preserved by default. To turn off this default behavior,
use the mergeMathLists attribute.
Attribute Example: Attributes as properties
All of the attributes of the <mathList> component are also available as properties.
Property Examples
Property Example: numComponents
The numComponents property returns the number of items stored
in a <mathList>. Note that the first math listed in the definition
in the example above counts as one item, even when lists are merged,
because it is specified as a tuple (enclosed by parentheses). The second
math in the definition counts as 1 item when lists are not merged, and 3 items if they are merged.
Property Example: latex
The latex property returns the LaTeX code required to render the maths in an array. The
LaTeX code for individual items can be accessed using array notation and then appending the latex property.
Property Example: text
The text property returns the maths in text format in an array. The text for individual
items can be accessed using array notation and then appending the text property.