## Section 29 Advanced Numbering

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 29.1 One

A document leaf.

#### Theorem 29.1 (Cauchy). First Theorem.

No statement.

#### Theorem 29.2 (Bunyakovsky). Second Theorem.

No statement.

### Subsection 29.2 Two

Further subdivided.

#### Subsubsection 29.2.1 Uno

A document leaf.

##### Theorem 29.3 (Schwarz). First Theorem!

No statement.

##### Theorem 29.4 (Inequality). Second Theorem?

No statement.

#### Subsubsection 29.2.2 Dos

A document leaf.

##### Theorem 29.5. First Theorem?

No statement.

##### Theorem 29.6. Second Theorem!

No statement.

### Subsection 29.3 Three

A document leaf.

#### Theorem 29.7. First Theorem.

No statement.

#### Theorem 29.8. Second Theorem.

No statement.

### Subsection 29.4 Four

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

#### Theorem 29.9. Good Numbered Theorem One.

No statement.

#### Theorem 29.10. Good Numbered Theorem Two.

No statement.

#### Subsubsection 29.4.1 Uno

A document leaf.

##### Theorem 29.11. First Theorem.

No statement.

##### Theorem 29.12. Second Theorem.

No statement.

#### Subsubsection 29.4.2 Dos

A document leaf.

##### Theorem 29.13. First Theorem.

No statement.

##### Theorem 29.14. Second Theorem.

No statement.

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^{â€‰1â€‰} for details.

#### Theorem 29.15. Bad Numbered Theorem One.

No statement.

#### Theorem 29.16. Bad Numbered Theorem Two.

No statement.

### Subsection 29.5 Five

A document leaf.

#### Theorem 29.17. First Theorem.

No statement.

#### Theorem 29.18. Second Theorem.

No statement.

### Subsection 29.6 Theorems in This Section

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.

### Subsection 29.7 A Title with ] a Right Bracket

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 `<exercise>`

with a title that could really be a problem.

#### Checkpoint 29.19. A Right Brace } and a Right Bracket].

The right brace is is used as a grouping character in LaTeX so this is just a test of its behavior in titles.

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

.

### Subsection 29.8 A Title with } a Right Brace

And now a right brace in a division title.

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

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 LaTeX practice.

### Subsection 29.10 Just an Exercise

#### Checkpoint 29.20. An Extraneous 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.

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

### Solutions 29.11 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.

#### 29.7 A Title with ] a Right Bracket

##### Checkpoint 29.19. A Right Brace } and a Right Bracket].

`github.com/PreTeXtBook/pretext/issues/139`