Debian Codegraph @

texmf-dist/source/latex/termlist/termlist.dtx

raw
1 % \iffalse meta-comment
2 %
3 % The termlist package provides environments to typeset lists of
4 % numbered terms, where the "terms" may contain anything printable.
5 % The list of terms is formatted to look consistent to a list of
6 % mathematical equations inside an eqnarray environment. Also for
7 % consistency, the same equation counter is used for numbering. You
8 % may think of termlist as a generalisation of the eqnarray
9 % environment, if you want to typeset more than just mathematics.
10 %
11 % Copyright 2008, 2010 Bernd Rellermeyer
12 %
13 % This file may be distributed and/or modified under the conditions
14 % of the LaTeX Project Public License, either version 1.3b of this
15 % license or (at your option) any later version. The latest version
16 % of this license is in:
17 %
18 % http://www.latex-project.org/lppl.txt
19 %
20 % and version 1.3b or later is part of all distributions of LaTeX
21 % version 2005/12/01 or later.
22 %
23 % Unpacking:
24 % (a) If termlist.ins is present:
25 % tex termlist.ins
26 % (b) Without termlist.ins:
27 % tex termlist.dtx
28 % (c) If you insist on using LaTeX
29 % latex \let\install=y\input{termlist.dtx}
30 % (quote the arguments according to the demands of your shell)
31 %
32 % Documentation:
33 % (a) If termlist.drv is present:
34 % latex termlist.drv
35 % (b) Without termlist.drv:
36 % latex termlist.dtx; ...
37 % The class ltxdoc loads the configuration file ltxdoc.cfg if
38 % available. Here you can specify further options, e.g. use A4
39 % as paper format:
40 % \PassOptionsToClass{a4paper}{article}
41 %
42 % Programm calls to get the documentation:
43 % pdflatex termlist.dtx
44 % pdflatex termlist.dtx
45 %
46 % Installation:
47 % TDS:tex/latex/termlist/termlist.sty
48 % TDS:doc/latex/termlist/termlist.pdf
49 % TDS:source/latex/termlist/termlist.dtx
50 %
51 %<package>\NeedsTeXFormat{LaTeX2e}
52 %<package>\ProvidesPackage{termlist}[2010/06/12 v1.1 Minor layout corrections]
53 %<*ignore>
54 \begingroup
55 \def\x{LaTeX2e}%
56 \expandafter\endgroup
57 \ifcase 0\ifx\install y1\fi\expandafter
58 \ifx\csname processbatchFile\endcsname\relax\else1\fi
59 \ifx\fmtname\x\else 1\fi\relax
60 \else\csname fi\endcsname
61 %</ignore>
62 %<*install>
63 \input docstrip.tex
64 \keepsilent
65
66 \usedir{tex/latex/termlist}
67
68 \preamble
69
70 Typeset lists of numbered terms.
71
72 Copyright 2008, 2010 Bernd Rellermeyer
73
74 This file may be distributed and/or modified under the conditions
75 of the LaTeX Project Public License, either version 1.3b of this
76 license or (at your option) any later version. The latest version
77 of this license is in:
78
79 http://www.latex-project.org/lppl.txt
80
81 and version 1.3b or later is part of all distributions of LaTeX
82 version 2005/12/01 or later.
83
84 \endpreamble
85
86 \generate{\file{termlist.sty}{\from{termlist.dtx}{package}}}
87
88 \ifToplevel{
89 \obeyspaces
90 \Msg{***********************************************************}
91 \Msg{*}
92 \Msg{* To finish the installation you have to move the following}
93 \Msg{* file into a directory searched by TeX:}
94 \Msg{*}
95 \Msg{* \space\space termlist.sty}
96 \Msg{*}
97 \Msg{* To produce the documentation run the file `termlist.dtx'}
98 \Msg{* through LaTeX2e.}
99 \Msg{*}
100 \Msg{* Happy TeXing}
101 \Msg{***********************************************************}
102 }
103
104 \endbatchfile
105 %</install>
106 %<*ignore>
107 \fi
108 %</ignore>
109 %<*driver>
110 \documentclass{ltxdoc}
111 \usepackage{termlist}
112 \usepackage{sverb}
113 \begin{document}
114 \DocInput{termlist.dtx}
115 \end{document}
116 %</driver>
117 % \fi
118 %
119 % \CheckSum{73}
120 % \CharacterTable
121 % {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
122 % 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
123 % Digits \0\1\2\3\4\5\6\7\8\9
124 % Exclamation \! Double quote \" Hash (number) \#
125 % Dollar \$ Percent \% Ampersand \&
126 % Acute accent \' Left paren \( Right paren \)
127 % Asterisk \* Plus \+ Comma \,
128 % Minus \- Point \. Solidus \/
129 % Colon \: Semicolon \; Less than \<
130 % Equals \= Greater than \> Question mark \?
131 % Commercial at \@ Left bracket \[ Backslash \\
132 % Right bracket \] Circumflex \^ Underscore \_
133 % Grave accent \` Left brace \{ Vertical bar \|
134 % Right brace \} Tilde \~}
135 %
136 %
137 % \changes{v1.0}{2008/08/18}{First release}
138 % \changes{v1.1}{2010/06/12}{Minor layout corrections}
139 %
140 % \GetFileInfo{termlist.sty}
141 %
142 % \title{The \textsf{termlist} package}
143 % \author{Bernd Rellermeyer}
144 % \date{\fileversion, \filedate}
145 %
146 % \maketitle
147 %
148 % \begin{abstract}\noindent
149 % The \textsf{termlist} package provides environments to typeset
150 % lists of numbered terms, where the ``terms'' may contain anything
151 % printable. The list of terms is formatted to look consistent to a
152 % list of mathematical equations inside an |eqnarray| environment.
153 % Also for consistency, the same |equation| counter is used for
154 % numbering. You may think of termlist as a generalisation of the
155 % |eqnarray| environment, if you want to typeset more than just
156 % mathematics.
157 % \end{abstract}
158 %
159 % \section{Introduction}
160 %
161 % The \LaTeX\ typesetting system is widely used by mathematicians. A
162 % number of constructs, like the |equation| or |eqnarray|
163 % environments, fit the specific needs of mathematical texts. The
164 % math modes are intrinsic parts of \TeX\ and have left their marks on
165 % the whole system.
166 %
167 % The \textsf{termlist} package may be seen as a generalization of the
168 % |equation| and |eqnarray| environments for non-mathematical texts.
169 % It provides environments to typeset any kinds of mathematical or
170 % non-mathematical terms, like propositions, hypotheses, examples, or
171 % linguistic terms, in the same way mathematical terms are typesetted
172 % inside an |equation| or |eqnarray| environment. I.\,e., the terms
173 % are indented and labelled with a continuous number---for consistency
174 % with the |equation| and |eqnarray| environments, the same |equation|
175 % counter is used for that---so that the look consistent to
176 % mathematical terms inside those environments.
177 %
178 % The \textsf{termlist} package is based on an idea of the
179 % \textsf{covington} package.
180 %
181 % \section{Usage}
182 %
183 % The \textsf{termlist} package provides the four new environments
184 % |termlist|, |term|, |termlist*|, and |term*|.
185 %
186 % \DescribeEnv{termlist} The |termlist| environment is the fundamental
187 % one of these environments. It is a list of terms, each indented and
188 % labelled with the |equation| counter on the left side by default.
189 % The default label can be changed by the optional argument of the
190 % |\item| command.
191 %
192 % For consistency with the |equation| and |eqnarray| environments, the
193 % global |leqno| option or something similar should be used to print
194 % the labels of mathematical terms inside these environments also on
195 % the left side.
196 %
197 % \begin{demo}{termlist}
198 % \begin{termlist}
199 % \item Here is an example of
200 % the \verb|termlist|
201 % environment.
202 % \item\label{second item}
203 % Each term is indented
204 % and labelled with the
205 % \verb|equation| counter.
206 % \item[(\ref{second item}a)]
207 % The label of the term
208 % can be changed by the
209 % optional argument of the
210 % \verb|\item| command.
211 % \item Using the optional
212 % argument of the
213 % \verb|\item| command
214 % does not increment the
215 % \verb|equation| counter.
216 % \end{termlist}
217 % \end{demo}
218 %
219 % \DescribeEnv{term} The |term| environment is a |termlist|
220 % environment with only one list item.
221 %
222 % \begin{demo}{term}
223 % \begin{term}
224 % The \verb|term| environment
225 % labels the term with the
226 % \verb|equation| counter.
227 % \end{term}
228 % \end{demo}
229 %
230 % \DescribeEnv{termlist*} The |termlist*| environment is the same as
231 % the |termlist| environment, but with empty labels.
232 %
233 % \begin{demo}{termlist*}
234 % \begin{termlist*}
235 % \item The \verb|termlist*|
236 % environment is a list of
237 % terms.
238 % \item The terms do not
239 % have labels.
240 % \end{termlist*}
241 % \end{demo}
242 %
243 % \DescribeEnv{term*} The |term*| environment is the same as the
244 % |term| environment, but with an empty label.
245 %
246 % \begin{demo}{term*}
247 % \begin{term*}
248 % The \verb|term*|
249 % environment does not
250 % label the term.
251 % \end{term*}
252 % \begin{term}
253 % Using the
254 % \verb|termlist*|
255 % or \verb|term*|
256 % environment does not
257 % increment the
258 % \verb|equation|
259 % counter.
260 % \end{term}
261 % \end{demo}
262 %
263 % The four environments provided by this package can be customized by
264 % the three macros |\termlabel|, |\termlabelfont|, and |\termindent|.
265 %
266 % \DescribeMacro\termlabel The label of each term is defined by the
267 % macro |\termlabel|. For consistency with the |equation| and
268 % |eqnarray| environments, its default value is |(\theequation)|. Use
269 % one of the commands
270 % \begin{termlist*}
271 % \item |\def\termlabel{|\meta{labeldescription}|}|, or
272 % \item |\renewcommand{\termlabel}{|\meta{labeldescription}|}|
273 % \end{termlist*}
274 % to change its value. Note that even if the value of |\termlabel|
275 % does not contain something like |\theequation|, the |equation|
276 % counter is incremented with each list item.
277 %
278 % \DescribeMacro\termlabelfont The label font and label color is
279 % defined by the macro |\termlabelfont|. For consistency with the
280 % |equation| and |eqnarray| environments, its default value is
281 % |\normalfont\normalcolor|. Use one of the commands
282 % \begin{termlist*}
283 % \item |\def\termlabelfont{|\meta{fontdescription}|}|, or
284 % \item |\renewcommand{\termlabelfont}{|\meta{fontdescription}|}|
285 % \end{termlist*}
286 % to change its value.
287 %
288 % Note that for the |equation| and |eqnarray| environments, the whole
289 % label, including its font and color, is defined by the macro
290 % |\@eqnnum|. For consistency, |\termlabel| and |\termlabelfont|
291 % should always have values that match the value of |\@eqnnum|.
292 %
293 % \DescribeMacro\termindent The amount of the left indentation of each
294 % term is defined by the macro |\termindent|. Its default value is
295 % |\leftmargini|. This is also the default value of the macro
296 % |\mathindent|, which defines the amount of the left indentation of
297 % mathematical terms inside an |equation| or |eqnarray| environment,
298 % if the \textsf{fleqn} package is used. In this case, |\termindent|
299 % and |\mathindent| should always have the same values. Use on of the
300 % commands
301 % \begin{termlist*}
302 % \item |\termindent|\meta{dimension}, or
303 % \item |\setlength{\termindent}{|\meta{dimension}|}|
304 % \end{termlist*}
305 % to change the value of |\termindent|.
306 %
307 % \StopEventually{}
308 %
309 % \iffalse
310 %<*package>
311 % \fi
312 %
313 % \section{Implementation}
314 %
315 % \begin{macro}{\termlabel}
316 % The |termlabel| macro defines the label of each term inside the
317 % |termlist| and |term| environments.
318 % \begin{macrocode}
319 \def\termlabel{(\theequation)}
320 % \end{macrocode}
321 % \end{macro}
322 %
323 % \begin{macro}{\termlabelfont}
324 % \begin{macro}{\@termlistmklab}
325 % The |termlabelfont| macro defines the font and color of the label
326 % of each term inside the |termlist| and |term| environments. The
327 % macro |\@termlistmklab| is used internally in the definition of
328 % the |termlist| environment.
329 % \begin{macrocode}
330 \def\termlabelfont{\normalfont\normalcolor}
331 \def\@termlistmklab#1{\termlabelfont #1\hfil}
332 % \end{macrocode}
333 % \end{macro}
334 % \end{macro}
335 %
336 % \begin{macro}{\termindent}
337 % The |termindent| macro defines the amount of the left indentation
338 % of each term inside one of the four environments provided by this
339 % package.
340 % \begin{macrocode}
341 \newdimen\termindent
342 \termindent\leftmargini
343 % \end{macrocode}
344 % \end{macro}
345 %
346 % \begin{environment}{termlist}
347 % The |termlist| environment is implemented as a list. Each list
348 % item has a default label defined by |\termlabel| and
349 % |\@termlistmklab| and left and right margins defined by
350 % |\termindent| and |\leftmargini|, resp. The indentation
351 % |\listparindent| and the amount of space between two paragraphs
352 % |\parsep| inside the list are set to their corresponding values
353 % outside the list, |\parindent| and |\parskip|, resp. The total
354 % amount of space between two list items is the sum of |\parsep| and
355 % |\itemsep|. The extra amount of space |\itemsep| is set to such a
356 % value, that the total amount of space between two list items is
357 % the maximum of |\parsep| and the extra amount of space |\jot|
358 % between two lines inside an |eqnarray| environment. To be further
359 % consistent to the |equation| and |eqnarray| environments, the
360 % amount of space above and below the list |\topsep| is set to
361 % |\abovedisplayskip|.
362 % \begin{macrocode}
363 \newenvironment{termlist}{%
364 \list{\termlabel}{%
365 \@nmbrlisttrue
366 \def\@listctr{equation}%
367 \partopsep\z@\@plus\p@\@minus\p@
368 \topsep\abovedisplayskip
369 \leftmargin\termindent
370 \labelwidth\leftmargin
371 \advance\labelwidth-\labelsep
372 \listparindent\parindent
373 \parsep\parskip
374 \ifdim\parsep<\jot
375 \itemsep\jot
376 \advance\itemsep-\parsep
377 \else
378 \itemsep\z@skip
379 \fi
380 \let\makelabel\@termlistmklab}}{%
381 \endlist}
382 % \end{macrocode}
383 % \end{environment}
384 %
385 % \begin{environment}{term}
386 % The |term| environment is implemented as a |termlist| environment
387 % with only one list item.
388 % \begin{macrocode}
389 \newenvironment{term}{%
390 \begin{termlist}\item\relax}{%
391 \end{termlist}}
392 % \end{macrocode}
393 % \end{environment}
394 %
395 % \begin{environment}{termlist*}
396 % The |termlist*| environment is implemented as a |termlist|
397 % environment with empty labels.
398 % \begin{macrocode}
399 \newenvironment{termlist*}{%
400 \termlist\@nmbrlistfalse\let\termlabel\relax}{%
401 \endlist}
402 % \end{macrocode}
403 % \end{environment}
404 %
405 % \begin{environment}{term*}
406 % The |term*| environment is implemented as a |termlist*|
407 % environment with only one list item.
408 % \begin{macrocode}
409 \newenvironment{term*}{%
410 \begin{termlist*}\item\relax}{%
411 \end{termlist*}}
412 % \end{macrocode}
413 % \end{environment}
414 %
415 % \iffalse
416 %</package>
417 % \fi
418 %
419 % \Finale
420 \endinput