latexlatex1,656字0条评论

LATEX list

20201228, Lists - Overleaf, Online LaTeX Editor

Introduction

List are basic elements in a document, when used correctly they keep concepts organized and structured. This article explains how to create and modify numbered and unnumbered lists in LaTeX.

Lists are actually very simple to create.

List are really easy to create

\begin{itemize}
  \item One entry in the list
  \item Another entry in the list
\end{itemize}

https://b.kunn.cc/
To create a (unordered) list you have to declare the _itemize_ environment and then put the entries inside.


Unordered lists

The unordered (unnumbered) lists are produced by the itemize environment. Each entry must be preceded by the control sequence \item.

\begin{itemize}
  \item The individual entries are indicated with a black dot, a so-called bullet.
  \item The text in the entries may be of any length.
\end{itemize}

https://b.kunn.cc/

By default the individual entries are indicated with a black dot, so-called bullet. The text in the entries may be of any length.


Ordered lists

Ordered list have the same syntax inside a different environment:

\begin{enumerate}
  \item The labels consists of sequential numbers.
  \item The numbers starts at 1 with every call to the enumerate environment.
\end{enumerate}

https://b.kunn.cc/
Ordered list have the same syntax inside a different environment:

The ordered lists are generated by a \enumerate environment and each entry must be preceded by the control sequence \item, which will automatically generate the number labelling the item. The enumerate labels consists of sequential numbers, these numbers starts at 1 with every call to the _enumerate_ environment.


Nested Lists

In LaTeX you can insert a list inside another list. The above lists may be included within one another, either mixed or of one type, to a depth of four levels.

\begin{enumerate}
   \item The labels consists of sequential numbers.
   \begin{itemize}
     \item The individual entries are indicated with a black dot, a so-called bullet.
     \item The text in the entries may be of any length.
   \end{itemize}
   \item The numbers starts at 1 with every call to the enumerate environment.
\end{enumerate}

https://b.kunn.cc/


List styles

As many other LaTeX elements, unordered and ordered list styles can be personalized.

Ordered lists

The numbering styles change depending on the depth of the nested lists:

\begin{enumerate}
   \item First level item
   \item First level item
   \begin{enumerate}
     \item Second level item
     \item Second level item
     \begin{enumerate}
       \item Third level item
       \item Third level item
       \begin{enumerate}
         \item Fourth level item
         \item Fourth level item
       \end{enumerate}
     \end{enumerate}
   \end{enumerate}
 \end{enumerate}

https://b.kunn.cc/

The default numbering scheme is:

These numbers can be changed by redefining the commands that typeset the numbers of various list levels. For example:

\renewcommand{\labelenumii}{\Roman{enumii}}
 \begin{enumerate}
   \item First level item
   \item First level item
   \begin{enumerate}
     \item Second level item
     \item Second level item
     \begin{enumerate}
       \item Third level item
       \item Third level item
       \begin{enumerate}
         \item Fourth level item
         \item Fourth level item
       \end{enumerate}
     \end{enumerate}
 \end{enumerate}
 \end{enumerate}

https://b.kunn.cc/

The command \renewcommand{\labelenumii}{\Roman{enumii}} changes the second level to upper case Roman numeral. It is possible to change the labels of any level, replace _labelenumii_ for one of the listed below.

The command must be placed in the preamble to change the labels globally or right before \begin{enumerate} to change labels only in this list. There are some other styles, see the reference guide for a complete list.

In numbered lists the counter is incremented by \item before it is printed, and starts from 1,a,i,A,I. This can be changed:

\renewcommand{\labelenumii}{\Roman{enumii}}
 \begin{enumerate}
   \item First level item
   \item First level item
   \begin{enumerate}
     \setcounter{enumii}{4}
     \item Second level item
     \item Second level item
       \begin{enumerate}
       \item Third level item
       \item Third level item
         \begin{enumerate}
         \item Fourth level item
         \item Fourth level item
       \end{enumerate}
     \end{enumerate}
   \end{enumerate}
 \end{enumerate}

https://b.kunn.cc/

To change the start number or letter you must use the \setcounter command. In the example, to change the start number of level 2 to V the command \setcounter{enumii}{4} was used.

To set the start number to any other counter change _enumii_ for any of these:

Unordered lists

\begin{itemize}
   \item  First Level
   \begin{itemize}
     \item  Second Level
     \begin{itemize}
       \item  Third Level
       \begin{itemize}
         \item  Fourth Level
       \end{itemize}
     \end{itemize}
   \end{itemize}
 \end{itemize}

https://b.kunn.cc/

The default label scheme for itemized lists is:

These labels can be changed by redefining the commands that typeset them for various list levels. For example, to change Level 1 to black square and Level 2 to white square we'll use:

\renewcommand{\labelitemi}{$\blacksquare$}
 \renewcommand\labelitemii{$\square$}
 \begin{itemize}
   \item  First Level
   \begin{itemize}
     \item  Second Level
     \begin{itemize}
       \item  Third Level
       \begin{itemize}
         \item  Fourth Level
       \end{itemize}
     \end{itemize}
   \end{itemize}
 \end{itemize}

https://b.kunn.cc/

The mathematical symbols used in the previous example belong to the amssymb package, so you have to add \usepackage{amssymb} to your preamble.

To redefine the label use one of the next commands, depending on the level of list mark you intend to change:

You can also change the item label for a specific entry, for example:

\begin{itemize}
  \item  Default item label for entry one
  \item  Default item label for entry two
  \item[$\square$]  Custom item label for entry three
\end{itemize}

https://b.kunn.cc/

All you have to do is pass the desired mark as a parameter inside brackets to the _item_ line.

Reference guide

Available styles for numbered lists:

Code Description
\alph Lowercase letter (a, b, c, ...)
\Alph Uppercase letter (A, B, C, ...)
\arabic Arabic number (1, 2, 3, ...)
\roman Lowercase Roman numeral (i, ii, iii, ...)
\Roman Uppercase Roman numeral (I, II, III, ...)

Further reading

Sample in Overleaf

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}

\begin{document}

List are really easy to create
 
\begin{itemize}
\item One entry in the list
\item Another entry in the list
\end{itemize}

\section{Unordered lists}

\begin{itemize}
\item The individual entries are indicated with a black dot, a so-called bullet.
\item The text in the entries may be of any length.
\end{itemize}

\section{Ordered lists}

\begin{enumerate}
\item The labels consists of sequential numbers.
\item The numbers starts at 1 with every call to the enumerate environment.
\end{enumerate}

\section{Nested Lists}

\begin{enumerate}
 \item The labels consists of sequential numbers.
 \begin{itemize}
 \item The individual entries are indicated with a black dot, a so-called bullet.
 \item The text in the entries may be of any length.
 \end{itemize}
 \item The numbers starts at 1 with every call to the enumerate environment.
\end{enumerate}

\section{Lists styles}

\subsection{Ordered lists}

\begin{enumerate}
 \item First level item
 \item First level item
 \begin{enumerate}
 \item Second level item
 \item Second level item
 \begin{enumerate}
 \item Third level item
 \item Third level item
 \begin{enumerate}
 \item Fourth level item
 \item Fourth level item
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 
 \renewcommand{\labelenumii}{\Roman{enumii}}
 \begin{enumerate}
 \item First level item
 \item First level item
 \begin{enumerate}
 \item Second level item
 \item Second level item
 \begin{enumerate}
 \item Third level item
 \item Third level item
 \begin{enumerate}
 \item Fourth level item
 \item Fourth level item
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 
 \begin{enumerate}
 \item First level item
 \item First level item
 \begin{enumerate}
 \setcounter{enumii}{4}
 \item Second level item
 \item Second level item
 \begin{enumerate}
 \item Third level item
 \item Third level item
 \begin{enumerate}
 \item Fourth level item
 \item Fourth level item
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 \end{enumerate}
 
 \subsection{Unordered lists}
 
 \begin{itemize}
 \item  First Level
 \begin{itemize}
 \item  Second Level
 \begin{itemize}
 \item  Third Level
 \begin{itemize}
 \item  Fourth Level
 \end{itemize}
 \end{itemize}
 \end{itemize}
 \end{itemize}

 \renewcommand{\labelitemi}{$\blacksquare$}
 \renewcommand\labelitemii{$\square$}
 \begin{itemize}
 \item  First Level
 \begin{itemize}
 \item  Second Level
 \begin{itemize}
 \item  Third Level
 \begin{itemize}
 \item  Fourth Level
 \end{itemize}
 \end{itemize}
 \end{itemize}
 \end{itemize}

\begin{itemize}
 \item  Default item label for entry one
 \item  Default item label for entry two
 \item[$\square$]  Custom item label for entry three
\end{itemize}

\end{document}

end

EOF
拾光 time 2020
Comments
Write a Comment