Referenceexercise

<exercise>

<exercise> is a Sectional component that renders an auto-numbered block of content. Inline components such as paragraphs ( <p>) and other components can be nested within an <exercise> to group and order content. Some examples are: another <exercise>, a <section>, a <figure>, or a <problem>.

Attributes and Properties

Attributes for <exercise>
AttributeTypeValues
aggregateScores = "…"boolean"true" "false"
asList = "…"boolean"true" "false"
boxed = "…"boolean"true" "false"
displayDigitsForCreditAchieved = "…"integer
includeAutoName = "…"boolean"true" "false"
includeAutoNameIfNoTitle = "…"boolean"true" "false"
includeAutoNumber = "…"boolean"true" "false"
includeAutoNumberIfNoTitle = "…"boolean"true" "false"
includeParentNumber = "…"boolean"true" "false"
level = "…"
sectionWideCheckWork = "…"boolean"true" "false"
showCorrectness = "…""true" "false"
submitLabel = "…"text
submitLabelNoCorrectness = "…"text
weight = "…"number
Props for <exercise name="e">
PropertyType
$e.aggregateScoresboolean
$e.asListboolean
$e.boxedboolean
$e.creditAchievednumber
$e.disabledboolean
$e.displayDigitsForCreditAchievedinteger
$e.fixedboolean
$e.fixLocationboolean
$e.hiddenboolean
$e.includeAutoNameboolean
$e.includeAutoNameIfNoTitleboolean
$e.includeAutoNumberboolean
$e.includeAutoNumberIfNoTitleboolean
$e.includeParentNumberboolean
$e.openboolean
$e.percentCreditAchievednumber
$e.sectionNumbertext
$e.sectionWideCheckWorkboolean
$e.submitLabeltext
$e.submitLabelNoCorrectnesstext
$e.titletext
$e.weightnumber

Example: <exercise> with default title

Within a DoenetML document, default titles for sectional components are auto-numbered. Each sectional component is on the same counter.


Example: <exercise> with custom title

A custom <exercise> title is creating by providing a <title> tag within the <exercise>.


Example: Nesting sectional components

A hierarchy is created by nesting one or more sectional components within an <exercise>.


Example: Named <exercise> as a parent reference

When reference names are used more than once in the same document, they can be distinguished (when outside their parent component) by attaching the name of the parent component to the reference.

Above, the <exercise> named ex1 is the parent of the <number> named x. Therefore, when referencing this specific instance of the component with that name, you should use $ex1.x as shown.


Attribute Example: includeParentNumber

The includeParentNumber attribute is false by default for the <exercise> component (and true by default for the <section> component).

In order to include the number of the parent sectional component, set includeParentNumber to true.


Attribute Example: includeAutoNumber

The includeAutoNumber attribute is false by default for the <exercise> component. This means that if an exercise contains a nested <title>, it will not render the default numbering (although it will still be counted in the numbering scheme behind the scenes).

In order to display the exercise number in addition to the custom <title>, set the includeAutoNumber attribute to true.


Attribute Example: aggregateScores and sectionWideCheckWork

The aggregateScores and sectionWideCheckWork attributes together combine validation for all <answer> components within the <exercise> under a single “Check Work” button.


Attribute Example: boxed

The boxed attribute changes the default formatting for a sectional component to one that has a border and a shaded banner for the title.


Attribute Example: hide

The hide attribute takes a boolean as input and can be used with any rendered component.