-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathenumitem.tex
1964 lines (1645 loc) · 64.1 KB
/
enumitem.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%
% Copyright (C) 2003-2025 Javier Bezos http://www.texnia.com
%
% This file may be distributed and/or modified under the conditions of
% the MIT License. A version can be found at the end of this file.
%
% Repository: https://github.com/jbezos/enumitem
%
\documentclass[a4paper]{ltxguide}
\raggedright
\parskip=.8ex
\advance\oddsidemargin-.5cm
\advance\textwidth1cm
\addtolength{\textheight}{2cm}
\addtolength{\topmargin}{-1.5cm}
\usepackage{xcolor,bera}
\definecolor{notes}{rgb}{.75, .3, .3}%
\makeatletter
\newenvironment{desc}
{\if@nobreak
\vskip-\lastskip
\vspace*{-2.5ex}%
\fi
\decl}
{\enddecl}
\def\@begintheorem#1#2{%
\list{}{}%
\global\advance\@listdepth\m@ne
\item[{\sffamily\bfseries\color{notes}\MakeUppercase{#1}}]}%
\makeatother
\newtheorem{warning}{Warning}
\newtheorem{note}{Note}
\newtheorem{example}{Example}
\makeatother
\usepackage{framed}
\definecolor{shadecolor}{rgb}{0.96,0.96,0.93}
\let\bblxv\verbatim
\let\bblexv\endverbatim
\def\verbatim{\begin{shaded*}\bblxv\vskip-\baselineskip\vskip2.5\parsep}
\def\endverbatim{\bblexv\vskip-2\baselineskip\end{shaded*}}
\newcommand\New[1]{%
\colorbox[rgb]{.87, .9, .83}{New #1}\enspace\ignorespaces}
\usepackage{hyperref}
\title{Customizing lists\\with the\\\textsf{enumitem} package}
\author{Javier Bezos\footnote{For bug reports, comments and
suggestions go to \href{http://www.texnia.com/enumitem.html}%
{\texttt{http://www.texnia.com/enumitem.html}}.}}
\date{Version 3.11\\2025/02/06}
\IfFileExists{enumitem.sty}{\usepackage{enumitem}}{}
\IfFileExists{layouts.sty}{\usepackage{layouts}}{}
\addtolength{\topmargin}{-3pc}
\addtolength{\textwidth}{6pc}
\addtolength{\oddsidemargin}{-2pc}
\addtolength{\textheight}{7pc}
\raggedright
\parindent1.8em
\parskip0pt
\begin{document}
\maketitle
\tableofcontents
\newpage
\vspace*{1cm}
\begin{note}
Changes and new features with relation to version 3.5 are highlighted
with \New{X.X}\hspace{-.5em}. The most recent features could be still
unstable. Please, report any issues you find on
\texttt{https://github.com/jbezos/enumitem/issues}, which is better
than just complaining on an e-mail list or a web forum. Forking
and pull requests are welcome.
\end{note}
\begin{warning}
Version 3.6 introduced two new keys: |left| and |first|. If your
documents define some series with these names, an error is raised.
Just rename them, or set the package option |series=override|.
\end{warning}
\section{Introduction}
This package provides most of the flexibility you may want to customize
the three basic list environments (|enumerate|, |itemize| and
|description|) and to design your own lists, with a |<key>=<value>|
syntax:
\begin{itemize}
\item Fancy labels and fancy refs, including a syntax similar to that
in the \textsf{enumerate} package.
\item Alternative ways for positioning the label, with a new
parameter (|labelindent|) and a tab-like setting (|left|).
\item Settings applied globally or only in one of the three types or
even in a single list (including |\topsep|).
\item Inline lists.
\item Several description styles (which fix some bad spacing, too).
\item |trivlist|s properly formatted.
\item Gathering of lists to be treated like a unit, as well as counter
resuming.
\end{itemize}
In the interface a sort of ``inheritance'' is used. You can set
globally the behavior of lists and then override several parameters of,
say, |enumerate| and then in turn override a few parameters in a
particular instance. The values will be searched in the hierarchy.
The package extends the syntax of the lists to allow an optional
argument where a set of parameters in the form |key=value| are
available. These keys are equivalent to the well known list parameters.
Please, see a \LaTeX{} manual for a description of them. Next sections
explain the extensions provided by \textsf{enumitem}.
\begin{itemize}
\item
Vertical spacing:
\begin{itemize}
\setlength{\itemsep}{0pt}
\item |topsep|
\item |partopsep|
\item |parsep|
\item |itemsep|
\end{itemize}
\item
Horizontal spacing:
\begin{itemize}
\setlength{\itemsep}{0pt}
\item |leftmargin|
\item |rightmargin|
\item |listparindent|
\item |labelwidth|
\item |labelsep|
\item |itemindent|
\end{itemize}
\end{itemize}
\begin{example}
A straightforward example is:
\begin{verbatim}
\begin{itemize}[itemsep=1ex, leftmargin=1cm]
\end{verbatim}
\end{example}
\begin{note}
A way to see how these parameters work is with the |layouts| package
(the manual is named |layman.pdf|).
\ifx\listdiagram\notundefined\else
See figure \ref{f.drawlist}.
\begin{figure}
\centering
\listdiagram
\caption{List parameters}\label{f.drawlist}
\end{figure}
\fi
\end{note}
\section{Quick reference}
Some common settings. See the manual below for details.
\begin{itemize}
\def\verbatim{\begin{shaded*}\bblxv}
\def\endverbatim{\bblexv\vskip-1.6\baselineskip\end{shaded*}}
\item To remove the vertical space altogether in a list:
\begin{verbatim}
\begin{enumerate}[nosep]
\end{verbatim}
\item To remove the vertical space altogether in \textit{all} lists:
\begin{verbatim}
\setlist{nosep}
\end{verbatim}
\item To start the label at the margin and the item text at the
current parindent:
\begin{verbatim}
\begin{enumerate}[left=0pt .. \parindent]
\end{verbatim}
\item To configure the labels like in \textsf{enumerate}: include the
package option |shortlabels| and then, as a first element, write your
label:
\begin{verbatim}
\begin{enumerate}[(1)]
\end{verbatim}
\item To continue the previous list, after a ``pause'':
\begin{verbatim}
\begin{enumerate}[resume*]
\end{verbatim}
\item To use the three basic lists in line: just add the package option
|inline| and then the environments |enumerate*|, |itemize*| and
|description*|.
\item To set a numeric label with parenthesis, but a cross-reference
without them:
\begin{verbatim}
\begin{enumerate}[label=(\arabic*), ref=\arabic*]
\end{verbatim}
\end{itemize}
\section{Keys}
This section describes the keys in displayed lists. Most of them are
available in inline lists, where further keys are available (see
\ref{s.inline}).
\begin{warning}
If the value is completely enclosed in braces, they are stripped off.
If you want the braces, they must be duplicated. This is the default
behavior of \textsf{keyval}, which \textsf{enumitem} just emulates.
\end{warning}
\subsection{Label and cross references format}
\begin{desc}
|label=<commands>|
\end{desc}
Sets the label to be used in the current level. A set of starred
versions of |\alph|, |\Alph|, |\arabic|, |\roman| and |\Roman|, without
argument stand for the current counter in
|enumerate|.\footnote{Actually, the asterisk is currently the argument
but things may change. Consider them as starred variants and follow the
corresponding syntax.} It works with |\value|, too (provided the widest
label is not to be computed or |widest*| is used, see below).
\begin{note}
If you prefer setting labels like the \textsf{enumerate} package, use
``short labels'' (see section \ref{s.short}).
\end{note}
\begin{example}
The following prints \textit{a}), \textit{b}), and so on (this is a
standard style in Spanish, and formerly used by Chicago, too).
\begin{verbatim}
\begin{enumerate}[label=\emph{\alph*})]
\end{verbatim}
\end{example}
\begin{warning}
The value of |label| is a moving argument, and fragile commands must
be protected \textit{except} the counters. Because of that, use of
|\value| is somewhat tricky, because |\the| or |\ifnum|
expects an actual value, which is not the case when |label| is
being processed to replace internally the |*| by the form with
the counter argument. The best solution is usually encapsulating the
logic inside a new ``counter'' with the help of
|\AddEnumerateCounter|.\footnote{Which is admittedly somewhat
convoluted. A better way to accomplish this is on the way.}
\end{warning}
\begin{example}
A fancier example
(which looks ugly, but it is intended only to illustrate what is
possible; requires \textsf{color} and \textsf{pifont}):
\begin{verbatim}
\begin{enumerate}[label=\protect\fcolorbox{blue}{yellow}{\protect\ding{\value*}}]
\end{verbatim}
\end{example}
\begin{desc}
|label*=<commands>|
\end{desc}
Like |label| but its value is appended to the parent label. For
example, the following defines a |legal| list (1., 1.1., 1.1.1., and so
on):
\begin{verbatim}
\newlist{legal}{enumerate}{10}
\setlist[legal]{label*=\arabic*.}
\end{verbatim}
\begin{desc}
|ref=<commands>|
\end{desc}
By default, |label| sets also the form of cross references and
|\the...| (overriding the settings in parent hierarchical
levels), but you can define a different format with this key. For
example, to remove the right parenthesis:
\begin{verbatim}
\begin{enumerate}[label=\emph{\alph*}), ref=\emph{\alph*}]
\end{verbatim}
\begin{note}
In both |label| and |ref|, the counters can be used as usual. So, and
provided the current level is the second one:
\begin{verbatim}
\begin{enumerate}[label=\theenumi.\arabic*.]
\end{verbatim}
or
\begin{verbatim}
\begin{enumerate}[label=\arabic{enumi}.\arabic*.]
\end{verbatim}
\end{note}
\begin{note}
The |label|s are \textit{not} accumulated to form the reference.
If you want, say, something like 1.\textit{a} from 1) as first level
and \textit{a}) as second level, you must set it with |ref|. You may
use |\ref{level1}.\ref{level2}| with appropriate |ref| settings, but as
Robin Fairbairns points out in the \TeX{} FAQ:
\begin{quote}
\dots{} [that] would be both tedious and error-prone. What is more, it
would be undesirable, since you would be constructing a visual
representation which is inflexible (you could not change all the
references to elements of a list at one fell swoop).
\end{quote}
This is sensible and I recommend to follow the advice, but sometimes
you might want something like:
\begin{verbatim}
... subitem \ref{level2} of item \ref{level1} ...
\end{verbatim}
\end{note}
\begin{warning}
The value of |ref| is a moving argument, and fragile commands must be
protected \textit{except} the counters.
\end{warning}
\begin{desc}
|font=<commands>|\qquad|format=<commands>|
\end{desc}
Sets the label font. Useful when the label is changed with the optional
argument of |\item| and in \texttt{description}. The last command in
|<commands>| can take an argument with the item label. In
\texttt{description} class setting are in force, so you may want to begin
with |\normalfont|. A synonym is \texttt{format}. Actually, this key
may be used for any stuff to be executed at each |\item|, just before the
label.
\begin{desc}
|align=left|\qquad |align=right|\qquad |align=parleft|
\end{desc}
How the label is aligned (with relation to the label box edges).
Three values are possible: |left|, the default |right| and
|parleft| (a parbox of width |\labelwidth| with flush left
text). The parameters controlling the label spacing should be
properly set, either by hand or more conveniently with the |*|
settings (see below):
\begin{verbatim}
\begin{enumerate}[label=\Roman*., align=left, leftmargin=*]
\end{verbatim}
When the label box is supposed to have its natural width, use
|left|.
\begin{desc}
|\SetLabelAlign{<value>}{<commands>}|
\end{desc}
New align types can be defined (or the existing ones redefined) with
|\SetLabelAlign|; the predefined values are equivalent
to:
\begin{verbatim}
\SetLabelAlign{right}{\hss\llap{#1}}
\SetLabelAlign{left}{#1\hfil}
\SetLabelAlign{parleft}{\strut\smash{\parbox[t]\labelwidth{\raggedright##1}}}
\end{verbatim}
\begin{example}
Although primarily intended for the alignment, this commands has
other uses (an example is the provided |parleft|). For example, with
the following all labels with |align=right| are set as superscripts:
\begin{verbatim}
\SetLabelAlign{right}{\hss\llap{\textsuperscript{#1}}}
\end{verbatim}
A new name is also possible, of course.
\end{example}
\begin{note}
If the last thing in the definition is a skip (typically |\hfil|), it
is removed sometimes by |description|. If for some reason you want to
avoid this, just add |\null| at the end.
\end{note}
\begin{note}
If you want the internal settings for \texttt{align} and \texttt{font}
be ignored, you can override the \textsf{enumitem} definition of
|\makelabel| in \texttt{before}:
\begin{verbatim}
\begin{description}[before={\renewcommand\makelabel[1]{\ref{##1}}}]
\end{verbatim}
Alternatively, define a macro and use |\let|.
\end{note}
\subsection{Horizontal spacing of labels}
The horizontal space in the left margin of the current level is
distributed in the following way:\footnote{Admittedly, these figures
are not exactly the clearest possible, and I intend to improve them in
a future release.}
\begin{center}
\begin{tabular}{cc}
\fbox{\fbox{\strut \texttt{labelindent}}
\fbox{\strut \texttt{labelwidth}}
\fbox{\strut \texttt{labelsep} $-$ \texttt{itemindent}}}
&
\fbox{\strut\texttt{itemindent}}\\
\texttt{leftmargin}
\end{tabular}
\end{center}
Here |labelindent| is a new parameter introduced by \textsf{enumitem},
described below. The rest are those in standard \LaTeX.
Actually, the layout is more complex because the label box (ie,
|labelwidth|) could stick into the margin, which means |labelindent|
takes a negative value.
\begin{note}
Since |\parindent| is not used as such inside lists, but instead is
set internally to either |\itemindent| or |\listparindent|, when used
as the value of a parameter \textsf{enumitem} returns the global
value, i. e., the value it has outside the outermost list.
\end{note}
\begin{note}
\New{3.6} If you find these parameters baffling, you are not alone. You
can visualize them by writing |\DrawEnumitemLabel| just before the
first item (or in |first|), which draws 4 rules from top to bottom,
|labelindent|, |labelwidth|, |labelsep|, |itemindent| (thin if
positive, thick if negative); the |leftmargin| is marked with two
vertical rules.
\end{note}
\begin{desc}
|labelindent=<length>|\\
|\labelindent|
\end{desc}
This parameter is added in \textsf{enumitem} for the blank space from
the margin of the enclosing list/text to the left edge of the label
box. This means there is a redundancy because one of the parameters
depends on the others, i.e., it has to be computed from the other
values, as described below. By default, the computed value is
|labelindent|, even if explicitly set with some value (it defaults to
0~pt). So, if you are setting it to some value, very likely you want to
set some other parameter to |!| or |*|, because otherwise it is
ignored.
There is a new counter length |\labelindent|.
The five parameters are related in the following way:
\[
|\leftmargin|+|\itemindent| =
|\labelindent|+|\labelwidth|+|\labelsep|
\]
\begin{desc}
|left=<labelindent>|\\
|left=<labelindent> .. <leftmargin>|
\end{desc}
\New{3.6} This is a convenience key to set quickly the most common
layouts for the label. You may regard it as a sort or ``rule'' with two
tab stops: the start of the label and the start of the text (both with
relation to the normal side margin). With only |<labelindent>|, the
left margin (the ``start of text'') is computed with the |labelsep|. It
internally resorts to |widest|, so the restrictions of the letter with
relation to |description| also applies here: you might need change the
computed parameter (eg, |itemindent=*| with |align=left|).
\begin{example}
Typical settings would be:
\begin{verbatim}
\begin{enumerate}[left= 0pt]
\begin{enumerate}[left= 0pt .. \parindent]
\begin{enumerate}[left= \parindent]
\begin{enumerate}[left= \parindent .. 2\parindent]
\begin{enumerate}[left= -\parindent .. 0pt]
\end{verbatim}
\end{example}
\begin{note}
The label width is set to the default widest one. If there are lists
with Arabic numerals $\ge 10$, you may want to set |widest|, too.
\end{note}
\begin{note}
|left=<labelindent>| sets |leftmargin=*|;
|left=<labelindent> .. <leftmargin>| sets |labelsep=*|.
\end{note}
\begin{desc}
|leftmargin=!|\qquad|itemindent=!|\qquad|labelsep=!|
\qquad|labelwidth=!|\qquad|labelindent=!|
\end{desc}
Sets which value is to be computed from the others. The default is
|labelindent=!|, but note some keys set another value (|wide| and
description |style|s). Computations are done after \textit{all} keys
have been read. Explicit values are not lost, and so with the following
hierarchical settings:
\begin{verbatim}
leftmargin=2em
labelindent=1em,leftmargin=!
labelindent=!
\end{verbatim}
|leftmargin| is again 2em and |labelindent| is the computed parameter.
\begin{note}
With |align=right| (the default), |labelindent=!| and |labelwidth=!|
behave similarly in practice.
\end{note}
\begin{desc}
|leftmargin=*|\qquad|itemindent=*|\qquad|labelsep=*|
\qquad|labelwidth=*|\qquad|labelindent=*|
\end{desc}
Like before, but in addition |labelwidth| is first set to the width of
the current label, using the default value of \textit{0} in |\arabic*|,
\textit{viii} in |\roman*|, \textit{m} in |\alph*| and similarly in
uppercase forms (these values can be changed with |widest|, see below).
Examples are:
\begin{verbatim}
\begin{itemize}[label=\textbullet, leftmargin=*]
\begin{enumerate}[label=\roman*), leftmargin=*, widest=iii]
\begin{itemize}[label = \textbullet,
leftmargin = 2pc,
labelsep = *]
\begin{enumerate}[label = \arabic*.,
labelindent = \parindent,
leftmargin = 2\parindent,
labelsep = *]
\end{verbatim}
The most useful are |labelsep=*| and |leftmargin=*|. With the former
the item body begins at a fixed place (namely, |leftmargin|), while
with the latter begins at a variable place depending on the label (but
always the same within a list, of course).
\begin{note}
Unfortunately, \LaTeX{} does not define a default |labelsep| to
be applied to all lists---simply the current value is used. With
\textsf{enumitem} you can set default values for every list, as
described below, and so, if you want to make sure |labelsep| is
under your control, all you need is something like:
\begin{verbatim}
\setlist{labelsep=.5em}
\end{verbatim}
\end{note}
\begin{note}
|labelwidth=*| and |labelwidth=!| are synonymous. Use them with care,
because they may take negative values, which does not make sense (a
warning is shown).
\end{note}
\begin{desc}
|widest=<string>|\qquad|widest*=<integer>|\qquad|widest|
\end{desc}
To be used in conjunction with the \texttt{*}-values, if desired. It
overrides the default value for the widest printed counter. Sometimes,
if lists are not very long, a value of |a| for |\alph| is more sensible
than the default |m|:
\begin{verbatim}
\begin{enumerate}[leftmargin=*, widest=a] % Assume standard 2nd level
\end{verbatim}
With no value, the default is restored. With |widest*|, the string is
built using |<integer>| as the value of the counter (e.g., with
|\roman|,
|widest=viii| and |widest*=8| are the same).
Since |\value| does not return a string but a number, |widest| and the
|*| values cannot be used with it. However, with |widest*|,
being a number, it is allowed.
\New{3.6} It can be used with |itemize| and |description|, too.
However, since the latter does some tricky formatting inside the label
you might need change the computed parameter (eg, |itemindent=*| with
|align=left|).
\begin{desc}
|labelsep*=<length>|
\end{desc}
Remember |labelsep| spans part of |leftmargin| and |itemindent| if the
latter is not zero. This is often somewhat confusing, so a new key is
provided---with \texttt{labelsep*} the value is reckoned from the left
margin (it just sets |\labelsep| and then adds |\itemindent| to it, but
in addition later changes to |itemindent| are taken into account):
\begin{center}
\begin{tabular}{cc}
\fbox{\fbox{\strut \texttt{labelindent}}
\fbox{\strut \texttt{labelwidth}}
\fbox{\strut \texttt{labelsep*}}}
&
\fbox{\strut\texttt{itemindent}}\\
\texttt{leftmargin}
\end{tabular}
\end{center}
\begin{desc}
|labelindent*=<length>|
\end{desc}
Like |labelindent|, but it is reckoned from the left margin in
the current list and not from that in the enclosing list/text.
\begin{example}
A first pattern aligns the label with the surrounding |\parindent|
while the item body is indented depending on the label and a fixed
|labelsep|:
\begin{verbatim}
labelindent = \parindent,
leftmargin = *
\end{verbatim}
A fairly frequent variant is aligning the label with the surrounding
text (remember |labelindent| is |0pt| by default if it is not the
computed parameter):
\begin{verbatim}
leftmargin = *
\end{verbatim}
The former looks better in the first level while the latter seems
preferable in subsequent ones. That can be easily set with
\begin{verbatim}
\setlist{leftmargin=*}
\setlist[1]{labelindent=\parindent} % Only the level 1
\end{verbatim}
\end{example}
\begin{example}
A second pattern aligns the item body with the surrounding
|\parindent|. In this case (remember |labelindent| is the computed
parameter if not set):
\begin{verbatim}
leftmargin = \parindent
\end{verbatim}
\end{example}
\begin{example}
A third pattern would be the label aligned with |\parindent|,
and the item body with |2\parindent|:
\begin{verbatim}
labelindent = \parindent,
leftmargin = 2\parindent,
itemsep = *
\end{verbatim}
Again, a variant would be the label aligned with the surrounding
text, and the item body with |\parindent|:
\begin{verbatim}
leftmargin = \parindent,
itemsep = *
\end{verbatim}
\end{example}
\subsection{Numbering, stopping, and resuming}
\begin{desc}
|start=<integer>|
\end{desc}
Sets the number of the first item.
\begin{desc}
|resume|
\end{desc}
The counter continues from the previous |enumerate|,
instead of being reset to 1.
\begin{verbatim}
\begin{enumerate}
\item First item.
\item Second item.
\end{enumerate}
Text.
\begin{enumerate}[resume]
\item Third item
\end{enumerate}
\end{verbatim}
This is done locally. If you want global resuming, see next section on
series.
\begin{desc}
|resume*|
\end{desc}
Like |resume| but the options from the previous list are used, too.
This option must be restricted to the optional argument in a
environment (this is the only place where it makes sense). It should be
used sparingly---if you are using it often, then very likely you want
to define a new list (see \ref{s.clone}). Further keys are allowed, and
in this case the saved options are overridden by those in the current
list (i.e., the position of \texttt{resume*} does not matters). If
there is a series of a certain list with \texttt{resume*}, options are
taken from the list previous to the first one, except for
\texttt{start}.
\begin{example}
For example:
\begin{verbatim}
\begin{enumerate}[resume*, start=1] % or [start=1, resume*]
\end{verbatim}
uses the keys in the previous \texttt{enumerate}, but restarts the
counter.
\end{example}
\subsection{Series}
\begin{desc}
|series=<series-name>|\\
|<series-name>|\qquad|resume*=<series-name>|
\qquad|resume=<series-name>|
\end{desc}
Another method to continue lists is by means of the key
\texttt{series}, so that they behave like a unit. A list with key
\texttt{series} is considered the starting list and its settings are
stored \textit{globally}, so that they can be used later with
\texttt{resume}/\texttt{resume*}. All these keys take a value with the
series name (which must be different from existing keys):
\begin{itemize}
\item |resume=<series-name>| just continue numbering items in the
series,
\item |resume*=<series>| also applies the settings of the
starting list,
\item |<series>|, i.e., the series name used as a key, is an
alternative to |resume*=<series>|.
\end{itemize}
\begin{example}
Consider:
\begin{verbatim}
\begin{enumerate}[label=\arabic*(a), leftmargin=1cm, series=l_after]
\item A
\item B
\end{enumerate}
\end{verbatim}
You get: 1(a) 2(a). You can continue with:
\begin{verbatim}
\begin{enumerate}[label=\arabic*(b), resume*=l_after]
% or [label=\arabic*(b), l_after]
\item A
\item B
\end{enumerate}
\end{verbatim}
You get: 3(b) 4(b). (But you can use |start=1|, if you like.)
\end{example}
Note you can add further arguments, which are executed after those
saved at the starting list and therefore take precedence over them --
in particular, |resume*| itself takes precedence over a |start| (e.g.,
|start=1|) in the the starting list.
\begin{note}
Every time a series is started, several commands are defined
internally. Thus, to avoid wasting resources use the same name for
non-overlapping series.
\end{note}
\begin{warning}
The package may introduce new keys in the future, so using directly
|<series>| as a key is a potential source of forward
incompatibilities. However, it's safe using a non-letter character
other than hyphen or star in the key name (e.g., |!notes| or
|m_steps|), as well as uppercase letters and digits, because
\textsf{enumitem} will never use them. \New{3.7} If you have defined
some series with an all lowercase name and a new conflicting key has
been introduced, an alternative to changing their names is the
package option |series=override| (the error message is
\texttt{Invalid series name `key'}). With it series names take
precedence over predefined keys -- but use it only when absolutely
necessary.
\end{warning}
\subsection{Penalties}
\begin{desc}
|beginpenalty=<integer>|\qquad
|midpenalty=<integer>|\qquad |endpenalty=<integer>|
\end{desc}
Set the penalty at the beginning of a list, between items and at the
end of the list, respectively. Please, refer to your \LaTeX{} or
\TeX{} manual about how penalties control page breaks. Unlike other
parameters, when a list starts their values are not reset to the
default, thus they apply to the child lists.
\subsection{Injecting code}
\begin{desc}
|before=<code>| \qquad |before*=<code>|
\end{desc}
Execute code before the list starts (more precisely, in the second
argument of the |list| environment used to define them). The
unstarred form sets the code to be executed, overriding any previous
value, while the starred one adds the code to the existing one (in
the setting hierarchy, see below, \textit{not} with relation to the
enclosing list/text). It can contain, say, rules and text, but this
has not been extensively tested. All calculations have been finished,
and you can access and manipulate the list parameters.
\begin{example}
To have both margins (left and right) set to the widest label:
\begin{verbatim}
\setlist{leftmargin=*, before=\setlength{\rightmargin}{\leftmargin}}
\end{verbatim}
\end{example}
\begin{desc}
|after=<code>|\qquad|after*=<code>|
\end{desc}
Same, but just before the list ends.
\begin{desc}
|first=<code>|\qquad|first*=<code>|
\end{desc}
\New{3.6} Same, but as the very first thing in the list body, so that
\begin{verbatim}
\begin{itemize}[first=<code>]
\end{verbatim}
is the same as
\begin{verbatim}
\begin{itemize}
<code>
\end{verbatim}
\begin{example}
With |first| you can define your own environments for displayed
material. A trivial example is:
\begin{verbatim}
\newlist{letter}{itemize}{1}
\setlist[letter]{first=\item[]\itshape, rightmargin=\leftmargin}
\end{verbatim}
Here there is no need for a |label|, because it is not used.
\end{example}
\begin{desc}
|\EnumitemId|
\end{desc}
\New{3.7} To help in some tasks, a unique numeric identifier is
assigned to each list, returned by |\EnumitemId|.
\begin{example}
Here is an example of how to combine a |\label| with |\EnumitemId|,
and |after| to automatically set the width of the list label to the
widest one (provided the ref is the same as the label):\footnote{See
\texttt{https://tex.stackexchange.com/questions/29322/%
how-to-make-enumerate-items-align-at-left-margin}.}
\begin{verbatim}
\SetEnumitemKey{widestlabel}
{labelwidth = \widthof{\ref{enum-\EnumitemId}},
after = \label{enum-\EnumitemId}}
\end{verbatim}
Then just use the key |widestlabel|.
\end{example}
\begin{example}
Reverse counting is also doable, but somewhat trickier, and we need
some ``external'' help. Here is a possible solution, but not the
only one (and very likely not even the best -- for example, |start|
is in fact no-op).
\begin{verbatim}
\newcounter{rev-enumi} \newcounter{rev-enumii}
\newcounter{rev-enumiii} \newcounter{rev-enumiv}
\newcommand\revcounter[1]{%
\setcounter{#1}{\value{#1}-2}%
\stepcounter{rev-#1}%
\gdef\afterrev{%
\refstepcounter{rev-#1}%
\setcounter{rev-#1}{0}}}
\AddEnumerateCounter\revcounter\revcounter{} % the 2nd is dummy
\SetEnumitemKey{revRoman}
{start = \getrefnumber{enum-\EnumitemId}-1,
label = (\Roman*)\revcounter*,
ref = (\Roman*),
after = \afterrev
\label{enum-\EnumitemId}}
\end{verbatim}
\end{example}
\subsection{Description styles}
A key available in |description|.
\begin{desc}
|style=<name>|
\end{desc}
Sets the description \textit{style}. |<name>| can be any of the
following:
\begin{description}
\item[|standard|] Like |description| in standard classes, although
with other classes it could be somewhat different. The label is
boxed. Sets |itemindent=!|.
\item[|unboxed|] Much like the standard |description|, but
the label is not boxed to avoid uneven spacing and unbroken labels if
they are long. Sets |itemindent=!|.
\item [|nextline|] If the label does not fit in the margin, the text
continues in the next line, otherwise it is placed in a box of width
|\leftmargin| $-$ |\labelsep|, i.e., the item body never sticks into
the left margin. Sets |labelwidth=!|.
\item[|sameline|] Like |nextline| but if the label does not
fit in the margin the text continues in the same line. Same as
|style=unboxed,labelwidth=!|.
\item[|multiline|] The label is placed in a parbox whose width is
|leftmargin|, with several lines if necessary. Same as
|style=standard,align=parleft,labelwidth=!|. If you modify it, bear in
mind |align| cannot be set freely (for an internal optimization; in
particular, a horizontal box doesn’t make sense and can raise an
error).
\end{description}
\begin{warning}
\begin{enumerate}
\item Mixing boxed and unboxed labels has not a well-defined behavior.
\item When nesting list all combinations are allowed but not all make
sense.
\item Nesting |nextline| lists is not supported (it works, but its
behavior might change in the future, because the current one is not
what one could expect).
\end{enumerate}
\end{warning}
\subsection{Compact lists}
\begin{desc}
|noitemsep|\qquad|nosep|
\end{desc}
The key |noitemsep| kills the space between items and paragraphs
(i.e., |itemsep=0pt| and |parsep=0pt|), while
|nosep| kills all vertical spacing.\footnote{The key
\texttt{nolistsep}, now deprecated, introduced a thin stretch, which
was not the intended behavior.}
\subsection{``Wide'' lists}
\begin{desc}
|wide|\\
|wide=<parindent>|
\end{desc}
With this convenience key, the leftmargin is null and the label is
part of the text---in other word, the items look like ordinary
paragraphs.\footnote{\texttt{fullwidth} is deprecated.} Here |labelsep|
sets the separation between the label and the first word. It is
equivalent to
\begin{verbatim}
align=left, leftmargin=0pt, labelindent=\parindent,
listparindent=\parindent, labelwidth=0pt, itemindent=!
\end{verbatim}
With |wide=<parindent>| you may set at once another value instead of
|\parindent|. Of course, these keys can be overridden after
|wide|, too; for example, remembering that with left-aligned labels
the text is pushed if the they are wider than |labelwidth|, you
can set |labelwidth=1.5em| for a minimal width, or instead of
|itemindent=!| you may prefer |itemindent=*|, which sets the
minimal width to that of widest label. In level 2 you may prefer
|labelindent=2\parindent|, and so on. You may also want to
combine it with |noitemsep| or |nosep|.
\subsection{\textsf{enumerate}-like labels}
\label{s.short}
\begin{desc}
|shortlabels| (package option)
\end{desc}
With the package option \texttt{shortlabels} you can use an
\textsf{enumerate}-like syntax, where |A|, |a|, |I|,
|i| and |1| stand for |\Alph*|, |\alph*|,