summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/termlist/termlist.dtx
blob: 48a9144e5ef7b4e5579c91da1c76f12ca9f783f3 (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
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
% \iffalse meta-comment
%
% The termlist package provides environments to typeset lists of
% numbered terms, where the "terms" may contain anything printable.
% The list of terms is formatted to look consistent to a list of
% mathematical equations inside an eqnarray environment.  Also for
% consistency, the same equation counter is used for numbering.  You
% may think of termlist as a generalisation of the eqnarray
% environment, if you want to typeset more than just mathematics.
%
% Copyright 2008, 2010 Bernd Rellermeyer
%
% This file may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3b of this
% license or (at your option) any later version.  The latest version
% of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3b or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% Unpacking:
%    (a) If termlist.ins is present:
%           tex termlist.ins
%    (b) Without termlist.ins:
%           tex termlist.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{termlist.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%    (a) If termlist.drv is present:
%           latex termlist.drv
%    (b) Without termlist.drv:
%           latex termlist.dtx; ...
%    The class ltxdoc loads the configuration file ltxdoc.cfg if
%    available.  Here you can specify further options, e.g. use A4
%    as paper format:
%       \PassOptionsToClass{a4paper}{article}
%
%    Programm calls to get the documentation:
%       pdflatex termlist.dtx
%       pdflatex termlist.dtx
%
% Installation:
%    TDS:tex/latex/termlist/termlist.sty
%    TDS:doc/latex/termlist/termlist.pdf
%    TDS:source/latex/termlist/termlist.dtx
%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{termlist}[2010/06/12 v1.1 Minor layout corrections]
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\keepsilent

\usedir{tex/latex/termlist}

\preamble

Typeset lists of numbered terms.
 
Copyright 2008, 2010 Bernd Rellermeyer

This file may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3b of this
license or (at your option) any later version.  The latest version
of this license is in:

http://www.latex-project.org/lppl.txt

and version 1.3b or later is part of all distributions of LaTeX
version 2005/12/01 or later.

\endpreamble

\generate{\file{termlist.sty}{\from{termlist.dtx}{package}}}

\ifToplevel{
\obeyspaces
\Msg{***********************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{* \space\space termlist.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `termlist.dtx'}
\Msg{* through LaTeX2e.}
\Msg{*}
\Msg{* Happy TeXing}
\Msg{***********************************************************}
}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\documentclass{ltxdoc}
\usepackage{termlist}
\usepackage{sverb}
\begin{document}
\DocInput{termlist.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{73}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v1.0}{2008/08/18}{First release}
% \changes{v1.1}{2010/06/12}{Minor layout corrections}
%
% \GetFileInfo{termlist.sty}
%
% \title{The \textsf{termlist} package}
% \author{Bernd Rellermeyer}
% \date{\fileversion, \filedate}
%
% \maketitle
%
% \begin{abstract}\noindent
%   The \textsf{termlist} package provides environments to typeset
%   lists of numbered terms, where the ``terms'' may contain anything
%   printable.  The list of terms is formatted to look consistent to a
%   list of mathematical equations inside an |eqnarray| environment.
%   Also for consistency, the same |equation| counter is used for
%   numbering.  You may think of termlist as a generalisation of the
%   |eqnarray| environment, if you want to typeset more than just
%   mathematics.
% \end{abstract}
%
% \section{Introduction}
%
% The \LaTeX\ typesetting system is widely used by mathematicians.  A
% number of constructs, like the |equation| or |eqnarray|
% environments, fit the specific needs of mathematical texts.  The
% math modes are intrinsic parts of \TeX\ and have left their marks on
% the whole system.
%
% The \textsf{termlist} package may be seen as a generalization of the
% |equation| and |eqnarray| environments for non-mathematical texts.
% It provides environments to typeset any kinds of mathematical or
% non-mathematical terms, like propositions, hypotheses, examples, or
% linguistic terms, in the same way mathematical terms are typesetted
% inside an |equation| or |eqnarray| environment.  I.\,e., the terms
% are indented and labelled with a continuous number---for consistency
% with the |equation| and |eqnarray| environments, the same |equation|
% counter is used for that---so that the look consistent to
% mathematical terms inside those environments.
%
% The \textsf{termlist} package is based on an idea of the
% \textsf{covington} package.
%
% \section{Usage}
%
% The \textsf{termlist} package provides the four new environments
% |termlist|, |term|, |termlist*|, and |term*|.
%
% \DescribeEnv{termlist} The |termlist| environment is the fundamental
% one of these environments.  It is a list of terms, each indented and
% labelled with the |equation| counter on the left side by default.
% The default label can be changed by the optional argument of the
% |\item| command.
%
% For consistency with the |equation| and |eqnarray| environments, the
% global |leqno| option or something similar should be used to print
% the labels of mathematical terms inside these environments also on
% the left side.
%
% \begin{demo}{termlist}
%   \begin{termlist}
%   \item Here is an example of
%     the \verb|termlist|
%     environment.
%   \item\label{second item}
%     Each term is indented
%     and labelled with the
%     \verb|equation| counter.
%   \item[(\ref{second item}a)]
%     The label of the term
%     can be changed by the
%     optional argument of the
%     \verb|\item| command.
%   \item Using the optional
%     argument of the
%     \verb|\item| command
%     does not increment the
%     \verb|equation| counter.
%   \end{termlist}
% \end{demo}
%
% \DescribeEnv{term} The |term| environment is a |termlist|
% environment with only one list item.
%
% \begin{demo}{term}
%   \begin{term}
%     The \verb|term| environment
%     labels the term with the
%     \verb|equation| counter.
%   \end{term}
% \end{demo}
%
% \DescribeEnv{termlist*} The |termlist*| environment is the same as
% the |termlist| environment, but with empty labels.
%
% \begin{demo}{termlist*}
%   \begin{termlist*}
%     \item The \verb|termlist*|
%       environment is a list of
%       terms.
%     \item The terms do not
%       have labels.
%   \end{termlist*}
% \end{demo}
%
% \DescribeEnv{term*} The |term*| environment is the same as the
% |term| environment, but with an empty label.
%
% \begin{demo}{term*}
%   \begin{term*}
%     The \verb|term*|
%     environment does not
%     label the term.
%   \end{term*}
%   \begin{term}
%     Using the
%     \verb|termlist*|
%     or \verb|term*|
%     environment does not
%     increment the
%     \verb|equation|
%     counter.
%   \end{term}
% \end{demo}
%
% The four environments provided by this package can be customized by
% the three macros |\termlabel|, |\termlabelfont|, and |\termindent|.
%
% \DescribeMacro\termlabel The label of each term is defined by the
% macro |\termlabel|.  For consistency with the |equation| and
% |eqnarray| environments, its default value is |(\theequation)|.  Use
% one of the commands
% \begin{termlist*}
% \item |\def\termlabel{|\meta{labeldescription}|}|, or
% \item |\renewcommand{\termlabel}{|\meta{labeldescription}|}|
% \end{termlist*}
% to change its value.  Note that even if the value of |\termlabel|
% does not contain something like |\theequation|, the |equation|
% counter is incremented with each list item.
%
% \DescribeMacro\termlabelfont The label font and label color is
% defined by the macro |\termlabelfont|.  For consistency with the
% |equation| and |eqnarray| environments, its default value is
% |\normalfont\normalcolor|.  Use one of the commands
% \begin{termlist*}
% \item |\def\termlabelfont{|\meta{fontdescription}|}|, or
% \item |\renewcommand{\termlabelfont}{|\meta{fontdescription}|}|
% \end{termlist*}
% to change its value.
%
% Note that for the |equation| and |eqnarray| environments, the whole
% label, including its font and color, is defined by the macro
% |\@eqnnum|.  For consistency, |\termlabel| and |\termlabelfont|
% should always have values that match the value of |\@eqnnum|.
%
% \DescribeMacro\termindent The amount of the left indentation of each
% term is defined by the macro |\termindent|.  Its default value is
% |\leftmargini|.  This is also the default value of the macro
% |\mathindent|, which defines the amount of the left indentation of
% mathematical terms inside an |equation| or |eqnarray| environment,
% if the \textsf{fleqn} package is used.  In this case, |\termindent|
% and |\mathindent| should always have the same values.  Use on of the
% commands
% \begin{termlist*}
% \item |\termindent|\meta{dimension}, or
% \item |\setlength{\termindent}{|\meta{dimension}|}|
% \end{termlist*}
% to change the value of |\termindent|.
%
% \StopEventually{}
%
% \iffalse
%<*package>
% \fi
%
% \section{Implementation}
%
% \begin{macro}{\termlabel}
%   The |termlabel| macro defines the label of each term inside the
%   |termlist| and |term| environments.
%    \begin{macrocode}
\def\termlabel{(\theequation)}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\termlabelfont}
% \begin{macro}{\@termlistmklab}
%   The |termlabelfont| macro defines the font and color of the label
%   of each term inside the |termlist| and |term| environments.  The
%   macro |\@termlistmklab| is used internally in the definition of
%   the |termlist| environment.
%    \begin{macrocode}
\def\termlabelfont{\normalfont\normalcolor}
\def\@termlistmklab#1{\termlabelfont #1\hfil}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\termindent}
%   The |termindent| macro defines the amount of the left indentation
%   of each term inside one of the four environments provided by this
%   package.
%    \begin{macrocode}
\newdimen\termindent
\termindent\leftmargini
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{termlist}
%   The |termlist| environment is implemented as a list.  Each list
%   item has a default label defined by |\termlabel| and
%   |\@termlistmklab| and left and right margins defined by
%   |\termindent| and |\leftmargini|, resp.  The indentation
%   |\listparindent| and the amount of space between two paragraphs
%   |\parsep| inside the list are set to their corresponding values
%   outside the list, |\parindent| and |\parskip|, resp.  The total
%   amount of space between two list items is the sum of |\parsep| and
%   |\itemsep|.  The extra amount of space |\itemsep| is set to such a
%   value, that the total amount of space between two list items is
%   the maximum of |\parsep| and the extra amount of space |\jot|
%   between two lines inside an |eqnarray| environment.  To be further
%   consistent to the |equation| and |eqnarray| environments, the
%   amount of space above and below the list |\topsep| is set to
%   |\abovedisplayskip|.
%    \begin{macrocode}
\newenvironment{termlist}{%
  \list{\termlabel}{%
    \@nmbrlisttrue
    \def\@listctr{equation}%
    \partopsep\z@\@plus\p@\@minus\p@
    \topsep\abovedisplayskip
    \leftmargin\termindent
    \labelwidth\leftmargin
    \advance\labelwidth-\labelsep
    \listparindent\parindent
    \parsep\parskip
    \ifdim\parsep<\jot
      \itemsep\jot
      \advance\itemsep-\parsep
    \else
      \itemsep\z@skip
    \fi
    \let\makelabel\@termlistmklab}}{%
  \endlist}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{term}
%   The |term| environment is implemented as a |termlist| environment
%   with only one list item.
%    \begin{macrocode}
\newenvironment{term}{%
  \begin{termlist}\item\relax}{%
  \end{termlist}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{termlist*}
%   The |termlist*| environment is implemented as a |termlist|
%   environment with empty labels.
%    \begin{macrocode}
\newenvironment{termlist*}{%
  \termlist\@nmbrlistfalse\let\termlabel\relax}{%
  \endlist}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{term*}
%   The |term*| environment is implemented as a |termlist*|
%   environment with only one list item.
%    \begin{macrocode}
\newenvironment{term*}{%
  \begin{termlist*}\item\relax}{%
  \end{termlist*}}
%    \end{macrocode}
% \end{environment}
%
% \iffalse
%</package>
% \fi
%
% \Finale
\endinput