]> git.lyx.org Git - lyx.git/blob - lib/layouts/enumitem.module
Reformatting, etc, of enumitem.
[lyx.git] / lib / layouts / enumitem.module
1 #\DeclareLyXModule[enumitem.sty]{Customisable Lists (enumitem)}
2 #DescriptionBegin
3 # Control the layout of enumerate, itemize, description, and list/labeling
4 # with an optional argument.
5 # See http://mirror.ctan.org/macros/latex/contrib/enumitem/enumitem.pdf
6 # and example file shipped with LyX.
7 #DescriptionEnd
8 # Author: Günter Milde <milde@users.berlios.de>
9
10 # 2008-12-04 first published version.
11 # 2009-02-02 use name Labeling for "LyX-List/Labeling" list type,
12 #            copy standard layout verbatim for failsave working with 
13 #            both KOMA and non-KOMA document classes.
14 # 2011-01-12 bugfix: set elabeling label font to \normalfont.
15
16 Format 35
17
18 # The package enumitem provides user control over the layout of the three
19 # basic list environments: enumerate, itemize and description. It supersedes
20 # both enumerate and mdwlist (providing well-structured replacements for all
21 # their funtionality), and in addition provides functions to compute the
22 # layout of labels, and to ‘clone’ the standard environments, to create new
23 # environments with counters of their own.
24 #
25 # - fancy labels and fancy refs,
26 # - leftmargin, labelsep and labelwidth automatically set,
27 # - changes applied globally or only in one of the three
28 #   types or even in a single list (including topsep),
29 # - several description styles (which fix some bad spacing, too),
30 # - starting value and counter resuming,
31 # - trivlists properly formatted,
32 # - control on page breaking
33 #
34 # Styling the basic lists is possible 
35 #
36 # a) generally in the LaTeX preamble and 
37 # b) per environment with optional arguments
38 #
39 # See enumitem.pdf_ for details and examples.
40 #
41 # TODO: since version 2.0, enumitem supports "cloning" of lists.
42 #       Producing a labeling as clone of a description allows
43 #       Preamble-Styling specific to this list type.
44
45 AddToPreamble
46         \usepackage{enumitem}           % customizable list environments
47         \newlength{\lyxlabelwidth}      % auxiliary length 
48 EndPreamble
49
50 # Customisable Basic Lists
51 # ------------------------
52
53 # With enumitem, the three standard list environments take an optional
54 # argument. See enumitem.pdf_ for possible values.
55
56 Style Itemize
57         OptionalArgs          1
58 End
59
60 Style Enumerate
61         OptionalArgs          1
62 End
63
64 Style Description
65         OptionalArgs          1
66 End
67
68 # Customisable LyX List
69 # ---------------------
70
71 # We expect this already to be defined, but there may be some classes
72 # that do not include stdlists.inc or do not declare Labeling. So we
73 # have copied the info from stdlists.inc.
74 # To make sure that we are starting fresh, we first clear everything.
75 NoStyle Labeling
76
77 Style Labeling
78         # verbatim insert definition of List environment, 
79         # The KOMA script classes replace List with Labeling, 
80         # this leads to an error with "CopyStyle List"!
81         Category              List
82         Margin                Manual
83         LatexType             List_Environment
84         NextNoindent          1
85         LabelSep              xxx
86         ParSkip               0.4
87         TopSep                0.7
88         BottomSep             0.7
89         ParSep                0.5
90         Align                 Block
91         AlignPossible         Block, Left
92         LabelType             Manual
93         LabelString           "00.00.0000"
94         # en of verbatim copy
95         
96         LatexName             elabeling
97         OptionalArgs          1
98         Preamble
99         % labeling-like list based on enumitem's description list with
100         % mandatory second argument (label-pattern):
101                 \newenvironment{elabeling}[2][]%
102                 {\settowidth{\lyxlabelwidth}{#2}
103                         \begin{description}[font=\normalfont,style=sameline,
104                                 leftmargin=\lyxlabelwidth,#1]}
105                 {\end{description}}
106         EndPreamble
107 End
108
109
110 # List Variants
111 # -------------
112 #
113 # Styles with pre-defined optional arguments for ease of use
114
115 Style Enumerate-Resume
116         CopyStyle             Enumerate
117         LatexParam            [resume]
118         OptionalArgs          0
119         # a blue label to indicate that this is not a WYSIWYG label
120         # because the numbering differs in the output
121         LabelFont
122           Color               blue
123         EndFont
124 End
125
126 # References
127 # ----------
128 #
129 # .. _enumitem.pdf:
130 #    http://dante.ctan.org/CTAN/macros/latex/contrib/enumitem/enumitem.pdf
131