Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex - skip numbering in an enumerate environment

I would like to skip numbering in a Latex enumerate environment to generate lists as follows:

(1) Item 1..

(2) Item 2..

(5) Item 5..

(6) Item 6..

and so on.

The Latex code is auto-generated, so ideally, I would like to insert "silent" \item-s in the environment, so that they will keep track of the numbering but nothing will appear on the output. However, if I simply add empty \items currently, I get lists like the following:

(1) Item 1

(2) Item 2

(3)

(4)

(5) Item 5

(6) Item 6

While the empty \item-s approach is the most ideal, I'm more than welcome to any other ways of achieving the number-skipping.

Thanks in advance!

like image 769
ARV Avatar asked Aug 30 '10 07:08

ARV


People also ask

How do I skip numbers in LaTeX enumerate?

You can also use \addtocounter{enumi}{2} (for example, in your particular case) to skip 2 items.

What is the difference between enumerate and itemize in LaTeX?

Itemize: This is an environment used for bulleted list basically when the given details or information or to be put in an unordered list. Enumerate: This is an environment used for numbered list. This list is given when the information to be updated should be in a sequence or in a specified order.

What is the difference between enumerate environment and itemize environment in LaTeX?

Using lists in LaTeX is pretty straightforward and doesn't require you do add any additional packages. For unordered lists, LaTeX provides the itemize environment and for ordered lists there is the enumerate environment. The elements within both environments have to be declared beginning with the \item command.


2 Answers

Depending on the level of enumeration, a simple \setcounter{enumi}{5} would suffice. (the number of i's after the enum in the first argument is the level of enumeration.

Another approach would be to call \stepcounter{enumi} as many times as you want to skip items. This makes the number of skipped items independent of the number of items before you skip. EDIT: the last option is the most like inserting "silent item's".

EDIT: its probably best not to hack LaTeX, but use the list environment (see the LaTeX documentation on how to use this). Since your LaTeX code is auto-generated, it should not be hard to generate the labels, and put them in a list environment.

like image 133
Martijn Avatar answered Sep 24 '22 22:09

Martijn


You can also use \addtocounter{enumi}{2} (for example, in your particular case) to skip 2 items.

like image 28
Brent.Longborough Avatar answered Sep 22 '22 22:09

Brent.Longborough