3

Sometimes I'm writing exercises on LaTeX. Suppose I do the following list:

  • Exercise 1.
  • Exercise 2.
  • Exercise 3.

But then I find that the first exercise is not relevant anymore and want to erase it. With what I know about LaTeX until now, I'd have to rewrite 1 in the place of 2 and 2 in the place of 3. Does LaTeX has some kind of increment/variable system to help me with this?

I know about the existence of enumerate. But I'm using description which does not automatically numerates the items. Is it possible to write something inside the [First] that allows me to have automatic numeration just as enumerate?

1 Answers1

11

There's no difficulty to define an enumeration to look like your example:

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label={\textbullet\ Exercise\ \arabic*.}]

\item An item
\item Another one
\item And another one
\end{enumerate}
\end{document}

output of code

If you want all your first level enumerations to look like this, you can set the label globally like this: (the 1 defines the first level).

\setlist[enumerate,1]{label={\textbullet\ Exercise\ \arabic*.}}

Then you don't have to add the code after each \begin{enumerate}.

Alan Munn
  • 218,180
  • Thanks. There is another thing I'm curious about. Can I define a variable in a way that whenever referenced, this variable will increase by 1?

    For example, if my document has: x x x

    It would yield in the rendered version. 1 2 3

    – Red Banana Aug 30 '15 at 01:05
  • 2
    @Voyska Sure. This is what LaTeX counters are for. Perhaps this question will help? LaTeX - Numbering – Alan Munn Aug 30 '15 at 01:08