<m>
<m> is a Display Math
component that renders inline mathematical content. The <m> tag accepts Latex and
DoenetML mathematical content as input.
For displaying mathematics alone on a line by itself, see <me>, <men>
or <md>,<mdn> (for aligned mathematics). See also <math>
for mathematical manipulations using a computer algebra system.
Attributes and Properties
Attributes for <m>
Positioning (2)
anchorpoint. Default value: . Coordinates of the anchor point used to position this component on a graph.
positionFromAnchorkeyword. Where this component sits relative to its anchor point.
| Value | Description |
|---|---|
upperRightAdded in 0.7.10 | Place the component above and to the right of the anchor point. |
upperLeftAdded in 0.7.10 | Place the component above and to the left of the anchor point. |
lowerRightAdded in 0.7.10 | Place the component below and to the right of the anchor point. |
lowerLeftAdded in 0.7.10 | Place the component below and to the left of the anchor point. |
top | Place the component directly above the anchor point. |
bottom | Place the component directly below the anchor point. |
left | Place the component directly to the left of the anchor point. |
right | Place the component directly to the right of the anchor point. |
center (default) | Center the component on the anchor point. |
Other (2)
draggableboolean. Default value: true. Whether the math display can be dragged on a graph.
layernumber. Default value: 0. Z-order layer index when shown on a graph.
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 <m name="m">
Positioning (2)
$m.anchorpoint. The coordinates where this component is anchored on the graph.
$m.positionFromAnchortext. Where this component sits relative to its anchor point.
Other (8)
$m.backgroundColortext. Human-readable name for this component's background color, derived from the active style and theme.
$m.draggableboolean. Whether the math display can be dragged on a graph.
$m.latexlatex. The math content rendered as a LaTeX string.
$m.layernumber. Z-order layer index when shown on a graph.
$m.mathmath. The math content as a math expression.
$m.texttext. The math content rendered as a plain text string.
$m.textColortext. Human-readable name for this component's text color, derived from the active style and theme.
$m.textStyleDescriptiontext. Human-readable description of this component's text styling (color and any background color).
Common to all components (8)
$m.disabledboolean. Whether this component is disabled and cannot be interacted with.
$m.doenetMLtext. The DoenetML source code that produced this component.
$m.fixedboolean. Whether this component's value is fixed and cannot be modified.
$m.fixLocationboolean. 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.isResponseboolean. 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: <m> inside a paragraph
The <m> component is used to format isolated content within a section of
text that has been enclosed within a <p>, or paragraph component.
Example: <m> in combination with <math>
An <m> tag encloses an inline math expression that also contains a
reference to a named <math>.
Example: <m> in combination with mathInput
An <m> tag encloses an inline math expression that also contains a
reference to a named <mathInput/>. The reference shows what the reader
has entered; the input itself stays where it is written, above the expression.
To put the input into the expression instead, write it there — see the next
example.
Example: a <mathInput/> inside <m>
A <mathInput/> written inside an <m> is rendered in place,
inside the typeset expression, so the reader fills in the blank where it
belongs rather than beside the mathematics, and writes the answer as
mathematics — a fraction, a root, an exponent. The expression makes room as
the answer grows, and closes back up as it shrinks. A <textInput/> can
be written there in the same way, when a line of ordinary text will do.
This is the one place an input does not need a <shortDescription> or a
<label>. Everywhere else, an input without one of them is an
accessibility violation, and the document reports it as one. Inside an
expression, the expression itself describes the input to a screen reader —
the input above is described as “x² + blank x + 4 = (x + 2)²” — so nothing is
reported. A <label> given anyway still names the input, but is not
drawn, since there is nowhere inside an equation to put it.
Even so, write a <shortDescription> when the expression does not read
as a sentence with the blank in it. Two cases where it will not: when the
input sits in a subscript or a superscript, which reading aloud does not carry;
and when an expression holds so many blanks that a reader is left counting
which one they are on. Where the expression does read plainly — the example
above, or a blank in a fraction or under a root — it names the input better
than a description would.
Not every input can be placed inside an expression. A non-inline
<choiceInput/> or an expanded <textInput/> is too large to sit
in a line of mathematics, a <textInput/> given a relative width (in %
or em) cannot be added to mathematics, and mathematics drawn on a
<graph> has no room for an input. Those inputs are not shown, and a
warning explains the problem.
Example: a <choiceInput/> inside <m>
An inline <choiceInput/> sits in the expression as a drop-down list,
for a blank whose answer is one of a few possibilities. It is described to a
screen reader as “y = blank x + 1”.
Example: <m> in combination with <answer>
An <m> tag encloses an inline math expression that precedes
an <answer>. Note that an <answer> cannot be defined within
an <m> component.