简体   繁体   中英

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!

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.

您还可以使用\\addtocounter{enumi}{2} (例如,在您的特定情况下)跳过2个项目。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM