summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shipunov/autolist.sty
blob: d4f32b8a1dcd104dc838d96e048bc3a84c6ac54c (plain)
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
% Authors: A. Shipunova and A. Shipunov, plantago@herba.msu.ru

\ProvidesPackage{autolist}%
        [2010/10/24 v0.4 Various lists]

\ProvidesPackage{autolist}
\RequirePackage{calc}

\newcounter{TMC@a}

\newdimen\Subleftmargini
\newdimen\Subleftmarginii
\newdimen\Subleftmarginiii
\newdimen\Subleftmarginiv
\newdimen\Subleftmarginv
\newdimen\Subleftmarginvi
\newdimen\Subleftmarginvii
\newdimen\Subleftmarginviii
\newdimen\Subleftmarginix
\newdimen\Subleftmarginx

\newcount\@Subnumdepth \@Subnumdepth = 0
\@definecounter{Subnumi}
\@definecounter{Subnumii}
\@definecounter{Subnumiii}
\@definecounter{Subnumiv}
\@definecounter{Subnumv}
\@definecounter{Subnumvi}
\@definecounter{Subnumvii}
\@definecounter{Subnumviii}
\@definecounter{Subnumix}
\@definecounter{Subnumx}

% Lists with up to 10 levels

% "List" analog
\def\Sublist#1#2{\ifnum \@listdepth >9\relax \@toodeep
     \else \global\advance\@listdepth\@ne \fi
  \rightmargin \z@ \listparindent\z@ \itemindent\z@
  \csname @slist\romannumeral\the\@listdepth\endcsname
  \def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax
  \@trivlist
  \parskip\parsep \parindent\listparindent
  \advance\linewidth -\rightmargin \advance\linewidth -\leftmargin
  \advance\@totalleftmargin \leftmargin
  \parshape \@ne \@totalleftmargin \linewidth
  \ignorespaces}
\let\endSublist=\endlist

% Size decrease
\setlength\Subleftmargini  {\parindent}
\setlength\Subleftmarginii {1em}
\setlength\Subleftmarginiii{1em}
\setlength\Subleftmarginiv {1em}
\setlength\Subleftmarginv  {1em}
\setlength\Subleftmarginvi {1em}
\setlength\Subleftmarginvii{1em}
\setlength\Subleftmarginviii{1em}
\setlength\Subleftmarginix {1em}
\setlength\Subleftmarginx  {1em}

\def\@slistI{\leftmargin\Subleftmargini
             \topsep0pt \parsep0pt \itemsep0pt}
\let\@slisti\@slistI
\@slisti
\def\@slistii {\leftmargin\Subleftmarginii
              \labelwidth\Subleftmarginii
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listiii{\leftmargin\Subleftmarginiii
              \labelwidth\Subleftmarginiii
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listiv {\leftmargin\Subleftmarginiv
              \labelwidth\Subleftmarginiv
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listv  {\leftmargin\Subleftmarginv
              \labelwidth\Subleftmarginv
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listvi {\leftmargin\Subleftmarginvi
              \labelwidth\Subleftmarginvi
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listvii{\leftmargin\Subleftmarginvii
              \labelwidth\Subleftmarginvii
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listviii{\leftmargin\Subleftmarginviii
              \labelwidth\Subleftmarginviii
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listix {\leftmargin\Subleftmarginix
              \labelwidth\Subleftmarginix
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}
\def\@listx  {\leftmargin\Subleftmarginx
              \labelwidth\Subleftmarginx
              \advance\labelwidth-\labelsep
              \topsep0pt \parsep0pt \itemsep0pt}

% "Enumerate" analog with hierarchical numeration
\def\Subnum{\ifnum \@Subnumdepth >9 \@toodeep\else
        \advance\@Subnumdepth \@ne
        \edef\@Subnumctr{Subnum\romannumeral\the\@Subnumdepth}\Sublist
        {\csname label\@Subnumctr\endcsname}{\usecounter
          {\@Subnumctr}\def\makelabel##1{\hss\llap{##1}}}\fi}
\let\endSubnum=\endlist

\def\theSubnumi{\arabic{Subnumi}}
\def\theSubnumii{\arabic{Subnumii}}
\def\theSubnumiii{\arabic{Subnumiii}}
\def\theSubnumiv{\arabic{Subnumiv}}
\def\theSubnumv{\arabic{Subnumv}}
\def\theSubnumvi{\arabic{Subnumvi}}
\def\theSubnumvii{\arabic{Subnumvii}}
\def\theSubnumviii{\arabic{Subnumviii}}
\def\theSubnumix{\arabic{Subnumix}}
\def\theSubnumx{\arabic{Subnumx}}
\def\labelSubnumi{\theSubnumi.}
\def\labelSubnumii{\theSubnumi.\theSubnumii.}
\def\labelSubnumiii{\theSubnumi.\theSubnumii.\theSubnumiii.}
\def\labelSubnumiv{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.}
\def\labelSubnumv{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.}
\def\labelSubnumvi{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.}
\def\labelSubnumvii{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.}
\def\labelSubnumviii{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.\theSubnumviii.}
\def\labelSubnumix{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.\theSubnumviii.\theSubnumix.}
\def\labelSubnumx{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.\theSubnumviii.\theSubnumix.\theSubnumx.}
\def\p@Subnumi{}
\def\p@Subnumii{\theSubnumi.}
\def\p@Subnumiii{\theSubnumi.\theSubnumii.}
\def\p@Subnumiv{\theSubnumi.\theSubnumii.\theSubnumiii.}
\def\p@Subnumv{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.}
\def\p@Subnumvi{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.}
\def\p@Subnumvii{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.}
\def\p@Subnumviii{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.}
\def\p@Subnumix{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.\theSubnumviii.}
\def\p@Subnumx{\theSubnumi.\theSubnumii.\theSubnumiii.\theSubnumiv.\theSubnumv.\theSubnumvi.\theSubnumvii.\theSubnumviii.\theSubnumix.}

% Lists with changing indent(LaTeX Companion 1st ed., p. 51--66)

% Ragged left
\newenvironment{Lautolist}[1][\quad]%
        {\begin{list}{}{\renewcommand{\makelabel}[1]{{##1}\hfil}%
                \settowidth{\labelwidth}{{#1}}%
                \setlength{\leftmargin}{\labelwidth+\labelsep}%
                \itemsep=.5pt\parsep=2pt\topsep=5pt}}
        {\end{list}}

% Ragged right
\newenvironment{Rautolist}[1][\quad]%
        {\begin{list}{}{\renewcommand{\makelabel}[1]{\hfil{##1}}%
                \settowidth{\labelwidth}{{#1}}%
                \setlength{\leftmargin}{\labelwidth+\labelsep}%
                \itemsep=.5pt\parsep=2pt\topsep=5pt}}
        {\end{list}}

% Items for several lines
\newcommand{\Lplabel}[1]
        {\raisebox{0pt}[1ex][0pt]{\makebox[\labelwidth][l]%
        {\parbox[t]{\labelwidth}{\raggedright\hspace{0pt}#1}}}}

\newcommand{\Rplabel}[1]
       {\raisebox{0pt}[1ex][0pt]{\makebox[\labelwidth][l]%
       {\parbox[t]{\labelwidth}{\raggedleft\hspace{0pt}#1}}}}

\newenvironment{Rpolylist}[1][\quad]%
       {\begin{list}{}{%
               \renewcommand{\makelabel}[1]{\Rplabel{##1}}%
               \settowidth{\labelwidth}{{#1}}%
               \setlength{\leftmargin}{\labelwidth+\labelsep}%
               \itemsep=.5pt\parsep=2pt\topsep=5pt}}
               {\end{list}}

\newenvironment{Lpolylist}[1][\quad]%
        {\begin{list}{}{%
                \renewcommand{\makelabel}[1]{\Lplabel{##1}}%
                \settowidth{\labelwidth}{{#1}}%
                \setlength{\leftmargin}{\labelwidth+\labelsep}%
                \itemsep=.5pt\parsep=2pt\topsep=5pt}}
        {\end{list}}

% Description-like, but also number items
\def\L@bl#1{\hspace{\labelsep}\refstepcounter{TMC@a}%
        \arabic{TMC@a}.\ \textit{#1}}
\newenvironment{characters}{\begin{list}{}
        {\renewcommand{\makelabel}{\L@bl}}}
{\setcounter{TMC@a}{0}\end{list}}

\endinput