24. Commands for font formatting and lists

LaTeX provides commands for formatting fonts and creating lists.

Formatting fonts

To make sections of text use the following:

1
2
3
4
5
\B{...}  - bold
\I{...} - italic
\T{...} - monospaced
\TB{...} - monospaced bold
\TB{...} - monospaced italic

To format paragraphs use the following:

1
2
3
4
\textbf{Road Runner} - bold
\textit{ACME} - italics
\emph{ACME} - italics
\underline{Tunnel Ahead} - underlined

Formatting ordered and unordered lists

When making an unordered list, you use itemize. When making an ordered list, you use enumerate.

Use itemizeto create an unordered list as shown below.

1
2
3
4
5
\begin{itemize}
\item \textbf{Body} - The thing that holds the fins in the right place.
\item \textbf{Fins} - The things that steer the tunafish in the sea.
\item
\end{itemize}

Use enumerate to create ordered lists as shown below.

1
2
3
4
5
6
7
8
\begin{enumerate}
\item Get a boat that you can use such as a rowboat or canoe.
\item Get a fishing rod.
\item Find where the tunafish are in the ocean.
\item Open can of tunafish that you remembered to bring with you and place it on the hook on the fishing rod.
\item Cast the line out into the sea and wait until a tunfish bites the hook.
\item Reel in the tunafish into the canoe.
\end{enumerate}

Formatting nested Lists

Use the following commands to create nested lists.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
A Fish contains these parts:

\begin{enumerate}
\item \textbf{Body} - The thing that holds the fins in the right place.
     \begin{itemize}
     \item The fish body is the yummy part that you can eat.
     \item it also has lots of bones and stuff that you cannot eat.
     \item \textbf{Fins} - The things that steer the tunafish in the sea.
        \begin{itemize}
        \item The fins are sometimes sharp so be careful when cutting them off the fish.
        \item Do not eat them. Its all bone and skin.
        \end{itemize}
     \end{itemize}
\end{enumerate}

Resuming a list after paragraphs

I found it rather annoying that LaTeX didn’t have an easy way of dealing with interrupted lists, until I learned this tip on StackOverflow.

Use the package \enumitem and the [resume] option on an enumarate scope to cause the LaTeX typesetter to continue numbering from the previous list.

First, add the enumitem package to the stylesheet for resuming enumeration after intervening text element.

1
\usepackage{enumitem}

Then in the text use [resume] to continue the list, as shown in the following example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\begin{enumerate}
    \item List item
    \item Another list item
\end{enumerate}

A randomly inserted paragraph.

\begin{enumerate}[resume]
    \item Further item
    \item Final item
\end{enumerate}

Paragraph of comments on list items 1 and 2.

\begin{enumerate}[resume]
\item Further item
\item Final item
\end{enumerate}
\end{document}

Click to continue.