Skip to main content
Logo image

Derivatives and Integrals An Annotated Discourse

Section 32 Advanced Numbering

View Source for section
                                                                                                                                                                                                                                            <section xml:id="advanced-numbering" label="section-advanced-numbering">

                                                                                                                                                                                                                                              <title>Advanced Numbering</title>

                                                                                                                                                                                                                                              <introduction>

                                                                                                                                                                                                                                                <p>
This section demonstrates the numbering
                                                                                                                                                                                                                                                  <idx>numbering</idx>
 patterns used throughout <pretext/>.  There are five subsections.  Two intermediate subsections each have two subsubsections.  This creates a total of seven divisions that are leaves of the document tree.  In each leaf we have placed two numbered theorems, for a total of fourteen.  There is no real content, this is just a demonstration.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <p>
Use values of <c>0</c> through <c>3</c> for the <c>numbering.theorems.level</c> parameter to see how these numbers change accordingly.  It is easiest to compare if you use <c>chunk.level &lt; 2</c> so the theorems all land on the same page if you are previewing in HTML.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                              </introduction>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>One</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-01">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <creator>Cauchy</creator>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <!-- Note: this theorem is cross-referenced exactly once,  --> <!-- as part of a test, so DO NOT cross-reference it again -->

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-02">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <creator>Bunyakovsky</creator>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Two</title>

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
Further subdivided.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-03">

                                                                                                                                                                                                                                                    <title>First Theorem!</title>

                                                                                                                                                                                                                                                    <creator>Schwarz</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-04">

                                                                                                                                                                                                                                                    <title>Second Theorem?</title>

                                                                                                                                                                                                                                                    <creator>Inequality</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-05">

                                                                                                                                                                                                                                                    <title>First Theorem?</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-06">

                                                                                                                                                                                                                                                    <title>Second Theorem!</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Three</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-07">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-08">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Four</title>

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
Further subdivided.  We include two theorems as numbered items in the introduction to test their numbers, which should always be logical.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-good-one">

                                                                                                                                                                                                                                                    <title>Good Numbered Theorem One</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-good-two">

                                                                                                                                                                                                                                                    <title>Good Numbered Theorem Two</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-09">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-10">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-11">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-12">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <conclusion>

                                                                                                                                                                                                                                                  <p>
Conclusion now.  We include two theorems as numbered items in the conclusion to test their numbers, which are sometimes totally illogical and are inconsistent across output formats.  To see the effect, set the level for numbering theorems to <c>3</c>.  See this GitHub <url href="https://github.com/PreTeXtBook/pretext/issues/139" visual="github.com/PreTeXtBook/pretext/issues/139">Issue #139</url> for details.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-bad-one">

                                                                                                                                                                                                                                                    <title>Bad Numbered Theorem One</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-bad-two">

                                                                                                                                                                                                                                                    <title>Bad Numbered Theorem Two</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </conclusion>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Five</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-13">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-14">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection xml:id="subsection-local-theorems">

                                                                                                                                                                                                                                                <title>Theorems in This Section</title>

                                                                                                                                                                                                                                                <p>
We have a lot of theorems in this section, so we illustrate including an automatic list of these here.  We use the <c>elements</c> attribute to limit the list to <c>theorem</c> elements, and we use the <c>scope</c> attribute to limit the list to this <c>section</c>.  You can use an introductory <c>p</c> like this one, or not.  The list gets no title or visual separation, so use the usual subdivision elements to make that happen.  The <c>elements</c> attribute can be a space-delimited list of many different elements.  This list should not include the Fundamental Theorem of Calculus, Theorem<nbsp/><xref ref="theorem-FTC"/>.  See a slightly different example in <xref ref="appendix-results" text="type-global"/>.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <list-of elements="theorem" scope="section"/>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection xml:id="subsection-list-of-definitions" label="subsection-list-of-definitions">

                                                                                                                                                                                                                                                <title>Definitions in This Article</title>

                                                                                                                                                                                                                                                <p>
Here is a similar list, but for <c>definition</c> elements across the whole article.  This list also serves as a regression test.  <xref ref="prefigure-diagrams"/> contains a <prefigure/> diagram whose source uses a <c>definition</c> element of its own, in the <prefigure/> XML namespace.  An earlier version of <tag>list-of</tag> matched descendants by local name only, ignoring namespaces, and so would catch <prefigure/> definitions and then fail to produce numbers for them.  The list below correctly contains only the <pretext/> definitions.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <list-of elements="definition" empty="no"/>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection xml:id="subsection-with-an-exercise">

                                                                                                                                                                                                                                                <title>A Title with ] a Right Bracket</title>

                                                                                                                                                                                                                                                <p>

                                                                                                                                                                                                                                                  <latex/> has trouble with brackets that end up inside optional arguments, so this subsection title is only a check on the defense against that.  And now an <tag>exercise</tag> with a title that could really be a problem.

                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <exercise xml:id="exercise-difficult-title">

                                                                                                                                                                                                                                                  <title>A Right Brace } and a Right Bracket]</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
The right brace is is used as a grouping character in <latex/> so this is just a test of its behavior in titles.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A faux hint to get this exercise to migrate into a <tag>solutions</tag>.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>A Title with } a Right Brace</title>

                                                                                                                                                                                                                                                <p>
And now a right brace in a division title.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>A Title with <m>a]b</m> a Math Right Bracket</title>

                                                                                                                                                                                                                                                <p>
And now a right bracket within math in a division title.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <p>
We do not test a right brace within math, since it should be escaped, as is normal <latex/> practice.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Just an Exercise</title>

                                                                                                                                                                                                                                                <exercise>

                                                                                                                                                                                                                                                  <title>An Extraneous Exercise</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
This exercise is here just as a test of the <tag>solutions</tag> division coming next.  So it is serving a purpose, even if it is not apparent.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A hint, so this exercise looks identical in structure to the one in the previous subsection.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>

                                                                                                                                                                                                                                              </subsection>

                                                                                                                                                                                                                                              <solutions inline="hint" scope="subsection-with-an-exercise">

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
This is a <tag>solutions</tag> division, which will be a peer of the other <tag>subsection</tag> in this <tag>section</tag>. The default behavior is to look to the parent division (a <tag>section</tag> here) and collect all the hints, answers, and solutions from every <tag>exercise</tag> (and friends) inside this containing division.  (There are just two, similar inline <tag>exercise</tag>.)
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <p>
But instead of the default, we employ a <attr>scope</attr> attribute to <em>define</em> the parent division of the exercises whose solutions will be shown.  In this example we specify the  <tag>subsection</tag> that is two back, the one which tests brackets in titles.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                              </solutions>

                                                                                                                                                                                                                                            </section>
This section demonstrates the numbering patterns used throughout PreTeXt. There are five subsections. Two intermediate subsections each have two subsubsections. This creates a total of seven divisions that are leaves of the document tree. In each leaf we have placed two numbered theorems, for a total of fourteen. There is no real content, this is just a demonstration.
Use values of 0 through 3 for the numbering.theorems.level parameter to see how these numbers change accordingly. It is easiest to compare if you use chunk.level < 2 so the theorems all land on the same page if you are previewing in HTML.

Subsection 32.1 One

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>One</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-01">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <creator>Cauchy</creator>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <!-- Note: this theorem is cross-referenced exactly once,  --> <!-- as part of a test, so DO NOT cross-reference it again -->

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-02">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <creator>Bunyakovsky</creator>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>
A document leaf.

Subsection 32.2 Two

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Two</title>

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
Further subdivided.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-03">

                                                                                                                                                                                                                                                    <title>First Theorem!</title>

                                                                                                                                                                                                                                                    <creator>Schwarz</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-04">

                                                                                                                                                                                                                                                    <title>Second Theorem?</title>

                                                                                                                                                                                                                                                    <creator>Inequality</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-05">

                                                                                                                                                                                                                                                    <title>First Theorem?</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-06">

                                                                                                                                                                                                                                                    <title>Second Theorem!</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                              </subsection>
Further subdivided.

Subsubsection 32.2.1 Uno

View Source for subsubsection
                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-03">

                                                                                                                                                                                                                                                    <title>First Theorem!</title>

                                                                                                                                                                                                                                                    <creator>Schwarz</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-04">

                                                                                                                                                                                                                                                    <title>Second Theorem?</title>

                                                                                                                                                                                                                                                    <creator>Inequality</creator>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>
A document leaf.

Subsubsection 32.2.2 Dos

View Source for subsubsection
                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-05">

                                                                                                                                                                                                                                                    <title>First Theorem?</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-06">

                                                                                                                                                                                                                                                    <title>Second Theorem!</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>
A document leaf.

Subsection 32.3 Three

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Three</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-07">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-08">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>
A document leaf.

Subsection 32.4 Four

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Four</title>

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
Further subdivided.  We include two theorems as numbered items in the introduction to test their numbers, which should always be logical.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-good-one">

                                                                                                                                                                                                                                                    <title>Good Numbered Theorem One</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-good-two">

                                                                                                                                                                                                                                                    <title>Good Numbered Theorem Two</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-09">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-10">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-11">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-12">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>

                                                                                                                                                                                                                                                <conclusion>

                                                                                                                                                                                                                                                  <p>
Conclusion now.  We include two theorems as numbered items in the conclusion to test their numbers, which are sometimes totally illogical and are inconsistent across output formats.  To see the effect, set the level for numbering theorems to <c>3</c>.  See this GitHub <url href="https://github.com/PreTeXtBook/pretext/issues/139" visual="github.com/PreTeXtBook/pretext/issues/139">Issue #139</url> for details.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-bad-one">

                                                                                                                                                                                                                                                    <title>Bad Numbered Theorem One</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-bad-two">

                                                                                                                                                                                                                                                    <title>Bad Numbered Theorem Two</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </conclusion>

                                                                                                                                                                                                                                              </subsection>
Further subdivided. We include two theorems as numbered items in the introduction to test their numbers, which should always be logical.

Subsubsection 32.4.1 Uno

View Source for subsubsection
                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Uno</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-09">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-10">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>
A document leaf.

Subsubsection 32.4.2 Dos

View Source for subsubsection
                                                                                                                                                                                                                                                <subsubsection>

                                                                                                                                                                                                                                                  <title>Dos</title>

                                                                                                                                                                                                                                                  <p>
A document leaf.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-11">

                                                                                                                                                                                                                                                    <title>First Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                  <theorem xml:id="theorem-number-12">

                                                                                                                                                                                                                                                    <title>Second Theorem</title>

                                                                                                                                                                                                                                                    <statement>

                                                                                                                                                                                                                                                      <p>
No statement.
                                                                                                                                                                                                                                                      </p>

                                                                                                                                                                                                                                                    </statement>

                                                                                                                                                                                                                                                  </theorem>

                                                                                                                                                                                                                                                </subsubsection>
A document leaf.
Conclusion now. We include two theorems as numbered items in the conclusion to test their numbers, which are sometimes totally illogical and are inconsistent across output formats. To see the effect, set the level for numbering theorems to 3. See this GitHub Issue #139 for details.

Subsection 32.5 Five

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Five</title>

                                                                                                                                                                                                                                                <p>
A document leaf.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-13">

                                                                                                                                                                                                                                                  <title>First Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                                <theorem xml:id="theorem-number-14">

                                                                                                                                                                                                                                                  <title>Second Theorem</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
No statement.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                </theorem>

                                                                                                                                                                                                                                              </subsection>
A document leaf.

Subsection 32.6 Theorems in This Section

View Source for subsection
                                                                                                                                                                                                                                              <subsection xml:id="subsection-local-theorems">

                                                                                                                                                                                                                                                <title>Theorems in This Section</title>

                                                                                                                                                                                                                                                <p>
We have a lot of theorems in this section, so we illustrate including an automatic list of these here.  We use the <c>elements</c> attribute to limit the list to <c>theorem</c> elements, and we use the <c>scope</c> attribute to limit the list to this <c>section</c>.  You can use an introductory <c>p</c> like this one, or not.  The list gets no title or visual separation, so use the usual subdivision elements to make that happen.  The <c>elements</c> attribute can be a space-delimited list of many different elements.  This list should not include the Fundamental Theorem of Calculus, Theorem<nbsp/><xref ref="theorem-FTC"/>.  See a slightly different example in <xref ref="appendix-results" text="type-global"/>.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <list-of elements="theorem" scope="section"/>

                                                                                                                                                                                                                                              </subsection>
We have a lot of theorems in this section, so we illustrate including an automatic list of these here. We use the elements attribute to limit the list to theorem elements, and we use the scope attribute to limit the list to this section. You can use an introductory p like this one, or not. The list gets no title or visual separation, so use the usual subdivision elements to make that happen. The elements attribute can be a space-delimited list of many different elements. This list should not include the Fundamental Theorem of Calculus, TheoremΒ 2.1. See a slightly different example in AppendixΒ F.
Theorem 32.1 First Theorem
Theorem 32.2 Second Theorem
Theorem 32.3 First Theorem!
Theorem 32.4 Second Theorem?
Theorem 32.5 First Theorem?
Theorem 32.6 Second Theorem!
Theorem 32.7 First Theorem
Theorem 32.8 Second Theorem
Theorem 32.9 Good Numbered Theorem One
Theorem 32.10 Good Numbered Theorem Two
Theorem 32.11 First Theorem
Theorem 32.12 Second Theorem
Theorem 32.13 First Theorem
Theorem 32.14 Second Theorem
Theorem 32.15 Bad Numbered Theorem One
Theorem 32.16 Bad Numbered Theorem Two
Theorem 32.17 First Theorem
Theorem 32.18 Second Theorem

Subsection 32.7 Definitions in This Article

View Source for subsection
                                                                                                                                                                                                                                              <subsection xml:id="subsection-list-of-definitions" label="subsection-list-of-definitions">

                                                                                                                                                                                                                                                <title>Definitions in This Article</title>

                                                                                                                                                                                                                                                <p>
Here is a similar list, but for <c>definition</c> elements across the whole article.  This list also serves as a regression test.  <xref ref="prefigure-diagrams"/> contains a <prefigure/> diagram whose source uses a <c>definition</c> element of its own, in the <prefigure/> XML namespace.  An earlier version of <tag>list-of</tag> matched descendants by local name only, ignoring namespaces, and so would catch <prefigure/> definitions and then fail to produce numbers for them.  The list below correctly contains only the <pretext/> definitions.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <list-of elements="definition" empty="no"/>

                                                                                                                                                                                                                                              </subsection>
Here is a similar list, but for definition elements across the whole article. This list also serves as a regression test. 10.2 contains a PreFigure diagram whose source uses a definition element of its own, in the PreFigure XML namespace. An earlier version of <list-of> matched descendants by local name only, ignoring namespaces, and so would catch PreFigure definitions and then fail to produce numbers for them. The list below correctly contains only the PreTeXt definitions.
Definition 38.1 Definition of the Derivative

Subsection 32.8 A Title with ] a Right Bracket

View Source for subsection
                                                                                                                                                                                                                                              <subsection xml:id="subsection-with-an-exercise">

                                                                                                                                                                                                                                                <title>A Title with ] a Right Bracket</title>

                                                                                                                                                                                                                                                <p>

                                                                                                                                                                                                                                                  <latex/> has trouble with brackets that end up inside optional arguments, so this subsection title is only a check on the defense against that.  And now an <tag>exercise</tag> with a title that could really be a problem.

                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <exercise xml:id="exercise-difficult-title">

                                                                                                                                                                                                                                                  <title>A Right Brace } and a Right Bracket]</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
The right brace is is used as a grouping character in <latex/> so this is just a test of its behavior in titles.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A faux hint to get this exercise to migrate into a <tag>solutions</tag>.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>

                                                                                                                                                                                                                                              </subsection>
has trouble with brackets that end up inside optional arguments, so this subsection title is only a check on the defense against that. And now an <exercise> with a title that could really be a problem.

Checkpoint 32.19. A Right Brace } and a Right Bracket].

View Source for exercise
                                                                                                                                                                                                                                                <exercise xml:id="exercise-difficult-title">

                                                                                                                                                                                                                                                  <title>A Right Brace } and a Right Bracket]</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
The right brace is is used as a grouping character in <latex/> so this is just a test of its behavior in titles.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A faux hint to get this exercise to migrate into a <tag>solutions</tag>.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>
The right brace is is used as a grouping character in so this is just a test of its behavior in titles.
Hint.
View Source for hint
                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A faux hint to get this exercise to migrate into a <tag>solutions</tag>.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>
A faux hint to get this exercise to migrate into a <solutions>.

Subsection 32.9 A Title with } a Right Brace

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>A Title with } a Right Brace</title>

                                                                                                                                                                                                                                                <p>
And now a right brace in a division title.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                              </subsection>
And now a right brace in a division title.

Subsection 32.10 A Title with \(a]b\) a Math Right Bracket

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>A Title with <m>a]b</m> a Math Right Bracket</title>

                                                                                                                                                                                                                                                <p>
And now a right bracket within math in a division title.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                                <p>
We do not test a right brace within math, since it should be escaped, as is normal <latex/> practice.
                                                                                                                                                                                                                                                </p>

                                                                                                                                                                                                                                              </subsection>
And now a right bracket within math in a division title.
We do not test a right brace within math, since it should be escaped, as is normal practice.

Subsection 32.11 Just an Exercise

View Source for subsection
                                                                                                                                                                                                                                              <subsection>

                                                                                                                                                                                                                                                <title>Just an Exercise</title>

                                                                                                                                                                                                                                                <exercise>

                                                                                                                                                                                                                                                  <title>An Extraneous Exercise</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
This exercise is here just as a test of the <tag>solutions</tag> division coming next.  So it is serving a purpose, even if it is not apparent.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A hint, so this exercise looks identical in structure to the one in the previous subsection.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>

                                                                                                                                                                                                                                              </subsection>

Checkpoint 32.20. An Extraneous Exercise.

View Source for exercise
                                                                                                                                                                                                                                                <exercise>

                                                                                                                                                                                                                                                  <title>An Extraneous Exercise</title>

                                                                                                                                                                                                                                                  <statement>

                                                                                                                                                                                                                                                    <p>
This exercise is here just as a test of the <tag>solutions</tag> division coming next.  So it is serving a purpose, even if it is not apparent.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </statement>

                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A hint, so this exercise looks identical in structure to the one in the previous subsection.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>

                                                                                                                                                                                                                                                </exercise>
This exercise is here just as a test of the <solutions> division coming next. So it is serving a purpose, even if it is not apparent.
Hint.
View Source for hint
                                                                                                                                                                                                                                                  <hint>

                                                                                                                                                                                                                                                    <p>
A hint, so this exercise looks identical in structure to the one in the previous subsection.
                                                                                                                                                                                                                                                    </p>

                                                                                                                                                                                                                                                  </hint>
A hint, so this exercise looks identical in structure to the one in the previous subsection.

Solutions 32.12 Solutions

View Source for solutions
                                                                                                                                                                                                                                              <solutions inline="hint" scope="subsection-with-an-exercise">

                                                                                                                                                                                                                                                <introduction>

                                                                                                                                                                                                                                                  <p>
This is a <tag>solutions</tag> division, which will be a peer of the other <tag>subsection</tag> in this <tag>section</tag>. The default behavior is to look to the parent division (a <tag>section</tag> here) and collect all the hints, answers, and solutions from every <tag>exercise</tag> (and friends) inside this containing division.  (There are just two, similar inline <tag>exercise</tag>.)
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                  <p>
But instead of the default, we employ a <attr>scope</attr> attribute to <em>define</em> the parent division of the exercises whose solutions will be shown.  In this example we specify the  <tag>subsection</tag> that is two back, the one which tests brackets in titles.
                                                                                                                                                                                                                                                  </p>

                                                                                                                                                                                                                                                </introduction>

                                                                                                                                                                                                                                              </solutions>
This is a <solutions> division, which will be a peer of the other <subsection> in this <section>. The default behavior is to look to the parent division (a <section> here) and collect all the hints, answers, and solutions from every <exercise> (and friends) inside this containing division. (There are just two, similar inline <exercise>.)
But instead of the default, we employ a @scope attribute to define the parent division of the exercises whose solutions will be shown. In this example we specify the <subsection> that is two back, the one which tests brackets in titles.

32.8 A Title with ] a Right Bracket