Skip to main content
\( \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section3Lists

Lists are important in lots of contexts, and the desire to nest lists has led to some very, very complex discussions on the PreTeXt email lists. We'll keep it simple here. There are a variety of places that lists can live, but a good mental model is that a list must be put inside a container that's similar to p. So for example, you can't put your list directly inside a subsection, but instead must wrap the list in a p.

There are two common types of lists: ordered and unordered. (There's also the description list. See the documentation for more information on it.) As in HTML, an ordered list is produced with ol and an unordered list with ul. The items of your list are structured inside li tags.

<p>
    <ol>
        <li>First item.</li>
        <li><p>Second item, showing can wrap content with <c>p</c>.</p></li>
    </ol>
</p>
Listing3.1An ordered list

The code in Listing 3.1 produces the following output:

  1. First item.
  2. Second item, showing can wrap content with p.

<p>
    <ul>
        <li>First item.</li>
        <li>Another item.</li>
    </ul>
</p>
Listing3.2An unordered list

The code in Listing 3.2 produces the following output:

  • First item.
  • Another item.