Use ol to make an ordered list, and ul to make an unordered (bulleted) list. In both cases, use li for each entry. If an entry contains more than one paragraph, then each must be wrapped in p.
This section contains nested lists, to demonstrate how they get assigned labels (numbering, symbols). But we begin with two simple lists, demonstrating an ordered list and an unordered list. See the end of section for an example of a description list. Note in the source the optional use of a paragraph (p) for the list items of the list of colors.
First.
Second 1
Footnote in an unstructured list item
.
Third.
Red 2
One of our favorite colors
Green
Yellow
Purple
Next, we have a list with no customization and multiple levels to test the defaults. LaTeX allows a maximum of four levels of ordered/numbered lists, and a total of six levels if some unordered lists are mixed in. Note that to have nested lists you must structure your list items as paragraphs, since a list may only appear within a <p> element.
A title on a top-level item.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 3, first.
Level 3, second.
Level 4, first.
Level 4, second.
Title on xref’ed list item.
Level 4, third.
Level 3, third.
A title on a nested item.
Level 2, third.
Level 1, third.
Items in ordered lists (only) may be be give an xml:id and then may be the target of an xref. We test three here, referencing down into the hierarchy above. Level 1, second: 2. Level 3, second: 2.b.ii. Level 4, third: 2.b.ii.C. Note that if a list item of an ordered list is contained within a list item of an unordered list, then its number will not be defined.
And now a four-level deep unordered list with the default labels supplied by PreTeXt (disc, circle, square, disc). Again, the defalt order for Markdown/Jupyter (disc, square, circle, circle) is different than for LaTeX and HTML (disc, circle, square, disc)
A title on a top-level item.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 3, first.
Level 3, second.
Level 4, first.
Level 4, second.
Level 4, third.
A title on a nested item.
Level 2, third.
Level 2, third.
Level 1, third.
And a total of six levels with a mix of ordered and unordered lists, the most that out-of-the-box-LaTeX is able to handle.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 3, first.
Level 3, second.
Level 4, first.
Level 4, second.
Level 5, first.
Level 5, second.
Level 6, first.
Level 6, second.
Level 6, third.
Level 5, third.
Level 4, third.
Level 3, third.
Level 2, third.
Level 1, third.
Now, nested lists with the defaults replaced by custom choices. First, an ordered list, three deep, upper Roman numerals, then upper-case Latin, then more traditional Arabic numerals on the three elements of the third level. Note the adornments of the labels will be rendered in LaTeX, but not in HTML.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 3, first.
Level 3, second.
Level 3, third.
Level 2, third.
Level 1, third.
A nested unordered list, with labels given as squares on the outer list and nothing (blank) on the inner lists.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 1, third.
A nested ordered list, to test intramural cross-references.
Level 1, first.
Level 1, second.
Level 2, first.
Level 2, second.
Level 1, third. With a cross-reference to second list item, 2.
Level 1, fourth. Whose number should not change when the knowl just prior is opened.
An ordered list may begin at zero by using a numeral zero in the @label attribute, instead of numeral one.
First
Second
Uno
Dos
Tres
Third
The next definition is very poorly worded. It is meant to test leading off with a list (bad form), for which LaTeX normally begins right after the heading.
For every element \(b\text{,}\) there is an element \(c\) (the inverse), such that
\begin{equation*}
b\cdot c=c\cdot b = e\text{.}
\end{equation*}
If these conditions are met for a set \(G\text{,}\) then we say \(G\) is a group.
Exercises and References are specialized subdivisions you can put anywhere. They are implemented as top-level lists, so should share behavior. For example, an exercise may have many parts and when expressed as a list, should have the expected labels.
Similarly, References may have lists in their annotations. Unlikely? But possible.
The next two subdivisions are an Exercises subdivision and a References subdivision, which have lists within an exercise and a bibliographic item (respectively).
This is a short list that ends a subsection, so can be used to address the necessary spacing. We also test two XML elements separated by a space (which should not go missing).
One item.
Twoducks.
Three items. Plus a few more words to check that long entries in a two column list look good.
Four items.
Another long entry that simultaneously tests that long entries look good in a list, and also tests an odd number of entries in a two column list.
There are many places where it makes sense to have a list of mathematical terms, or possibly equations. For example, one might wish to provide a list of derivative formulas. With such lists, the author may wish to have display mathematics, but almost certainly they don’t want it centered. One can work around this by using the LaTeX\displaystyle command. However, it would be nice if a list item containing only math used display mode by default.
A list item containing some text in a paragraph, as well as some inline math: \(\int_a^b x^2\,dx = \frac{x^3}{3}\text{.}\)
A list item with text and math \(\int_a^b x^2\,dx\text{,}\) not in a paragraph.
The above assemblage had some lists in it, just to see what will happen. While we’re at it, we might try adding lists that are in a list.
And now, a list in a paragraph.
A paragraph that begins with text, then some math: \(\sum_{n=1}^\infty\frac{1}{n^2}=\frac{\pi^2}{6}\) And now some more text. The next two list items contain:
Math only, inline.
Math only, with a newline.
Math only, but in a paragraph. Also the next item on this list has math, just to see what happens in a nested list.
Inclusion of any text other than math will kill the automatic display style. For example, this would happen if one were to add punctuation after the math.
\(\int_a^b \frac{\sin(x)}{x}\,dx\text{,}\)
\(\displaystyle \int_a^b \frac{\sin(x)}{x}\,dx\)
List items can have titles. We try that here, along with testing list items structured with paragraphs.
In Subsection 11.4 we were careful about lone bits of math inside list items. The <cd> element is used with indentation, which is likely superfluous inside a list item that is already being indented. Here we test lone <cd> elements inside of list items in various configurations.
Unordered list, one-deep.
Foo Bar Foo
Bar Foo Bar
This list item is a long paragraph with a <cd> in the middle which should be indented some to indicate its participation in the paragraph.
Foo Bar Foo
Bar
Bar Foo Bar
Foo
This list item is a long paragraph with a <cd> in the middle which should be indented some to indicate its participation in the paragraph.
Foo Bar Foo
Bar
Bar Foo Bar
Foo
Intervening paragraph, to illuminate spacing at both the top and bottom of a list. Intervening paragraph, to illuminate spacing at both the top and bottom of a list. Intervening paragraph, to illuminate spacing at both the top and bottom of a list. Intervening paragraph, to illuminate spacing at top and bottom of a list.
Ordered lists, two-deep, mixed.
First item, outer level.
First inner item, cd only
Foo Bar Foo
Bar
Bar Foo Bar
Foo
Second inner item, a paragraph in a list item.
Third inner item, cd only
Foo Bar Foo
Foo Bar Foo
Bar Foo Bar
cd inside second item, outer level
Bar
Bar Foo Bar
Foo
Use dl to make a description list . Inside of those tags, use li for each entry. Then, use title to specify the term being described and p to specify the description.
A “description” list has a short term or phrase that is prominent, followed by a short description. It is modeled on the lists of similar structure in both LaTeX and HTML. It makes for a nice medium-weight way to define terms, somewhere in-between the term tag which just makes a term prominent in a sentence, and a definition, which is set off, has a heading, a number, and a title. Do not try to manage the separation between the title and the description by employing punctuation (but you can include a question-mark or exclamation-point if necessary). For example, do not include a colon to the end of the title. This example is from Bob Plantz.
Central Processing Unit (CPU)
Controls most of the activities of the computer, performs the arithmetic and logical operations, and contains a small amount of very fast memory.
Memory
Provides storage for the instructions for the CPU and the data they manipulate.
Input/Output (I/O)
Communicates with the outside world and with mass storage devices (e.g., disks).
Bus!
A communication pathway with a protocol specifying exactly how the pathway is used. (The punctuation is just for testing.)
A geometric series. The formula is valid if \(|x| < 1\text{.}\)
Some presentations can be assisted by a hint from the author about the lengths of the titles. You can choose to provide a width attribute on a dl element with possible values narrow and medium. The value refers (somewhat confusingly) to the distance between the left margin and the description. The default is medium, which is illustrated above. Conversion to LaTeX ignores the attribute. An example with narrow:
Red
The color of the sun at sunset.
Blue
The color of a clear sky. Also a synonym for “depressed or sad”, the title of a 1971 Joni Mitchell album (and more than a dozen other musical albums), the period of Picasso’s work between 1901 and 1904, and much more!
Aqua
The color of shallow tropical waters. 3
On a sunny day! (Testing footnotes in description lists for LaTeX output.)
Math \(x^2\)
Sorry, not a color but testing titles with math in them.
“i” before “e” except after “c,” unless it sounds like “a” as in “neighbor” and “weigh”
Get feisty about that weird counterfeit rule: seize the day and don’t have a heifer, man.
Avocado
Avocado is the the color with hex code #568203, and also the main ingredient in guacamole.
Magenta
Magenta is a color, and a character in Rocky Horror.
Zymurgist
A scientist who studies the chemical process of fermentation in brewing and distilling. Also the alphabetically last 9-letter word in the English language.
Byzantium
Byzantium is the the color with hex code #702963, and also an ancient Greek city which later became known as Constantinople, and today is called Istanbul.
Convection
Circulating motion in a fluid.
Elementary
No literary detective ever said “Elementary my dear Watson.” In particular, Sherlock Holmes never said that.
Understand
Perceive the intended meaning of.
Washington
A state, a district, the man on the US $1 bill and on the US quarter. Did you ever notice that on the US dime, the value is stated as “one dime”? But how is one to know that a dime is worth 10 cents?
Aquamarine
Aquamarine is a color, and a mineral.
Those who cannot remember the past are condemned to repeat it.
George Santayana wrote those words in 1905. A similar aphorism is misattributed to Winston Churchill. The idea is embodied in the 4th principle: PreTeXt respects the good design practices which have been developed over the past centuries.
A list can be wrapped with a <list> element, so that it earns a number, can be given a title and have an introduction and conclusion. Cross-references to individual list items get a bit involved as they are prefixed with the number of the list and then the number of the item, so conceivably you could get a number like 4.5.3:2.a.ii. The colon is used to indicate the transition from the number of the list within divisions and the numbers coming from the list hierarchy, since it has two small dots.
This next list is used for testing cross-references to it. See Section 20.
This is a paragraph just outside the preceding named list, which references an item within, via the hybrid @text attribute: Item 11.4:B.c.
This is a paragraph with three lists contained within it. For HTML output we have to “inside-out” the lists.
A one item ordered list.
In other words, the text before, after, and between, needs to each be encapsulated as an HTML p element of its own.
A one item unordered list.
Including definition lists.
Define Me
A one item definition list.
That’s all!
A one item list, whose item is a paragraph with two contained ordered lists, separated by text.
A list in a paragraph is a construction in HTML that browsers try to correct, which leads to unpredictable results, so we have to decompose an author’s paragraph with lists into a sequence of HTML paragraphs, interrupted by lists. This subsection is only relevant to HTML output, and only for testing.
This paragraph opens with an ordered list.
Testing the id, and other info that should be at the top of the paragraph.
Now the paragraph continues, and we have an index item here, so we can test cross-references back here.
This exercise should have several parts, and labels should follow the defaults for second-level lists (since the exercise is numbered according to the top-level default).
This exercise (a list item really) has a table first. Default LaTeX aligns it vertically above the exercise number. Placement here tests correcting that alignment.
A small test of cross-references to subsidiary parts of exercises. Exercise 1, third part: 11.9.1.c. Exercise 1, second part, first refinement: 11.9.1.b.i.
References11.10References (with lists in Annotations)