<example>
<example>
is a Sectional
component which renders an auto-numbered block of content. Inline components such as paragraphs <p>
and other components can be nested within an <example>
to group and order content. Some
examples are: another <example>
, a <section>
, a <figure>
, or a <problem>
.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
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 |
Property | Type |
---|---|
$e.aggregateScores | boolean |
$e.asList | boolean |
$e.boxed | boolean |
$e.creditAchieved | number |
$e.disabled | boolean |
$e.displayDigitsForCreditAchieved | integer |
$e.fixed | boolean |
$e.fixLocation | boolean |
$e.hidden | boolean |
$e.includeAutoName | boolean |
$e.includeAutoNameIfNoTitle | boolean |
$e.includeAutoNumber | boolean |
$e.includeAutoNumberIfNoTitle | boolean |
$e.includeParentNumber | boolean |
$e.open | boolean |
$e.percentCreditAchieved | number |
$e.sectionNumber | text |
$e.sectionWideCheckWork | boolean |
$e.submitLabel | text |
$e.submitLabelNoCorrectness | text |
$e.title | text |
$e.weight | number |
Example: <example>
with default title
Within a DoenetML document, default titles for sectional components are auto-numbered. Each sectional component is on the same counter.
Example: <example>
with custom title
A custom <example>
title is creating by providing
a <title>
tag within the <example>
.
Example: Nesting sectional components
A hierarchy is created by nesting one or more sectional components within an <example>
.
Example: Named <example>
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 <example>
named birdExample
is the
parent of the <text>
named animal
. Therefore, when
referencing this specific instance of the component with that name,
you should use $birdExample.animal
as shown.
Example: includeParentNumber
The includeParentNumber
attribute is false
by default for the <example>
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 <example>
component. This means that if a section 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 example 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 <example>
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.