summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/shortlst/shortlst.dtx
blob: 74a6b7773f52f76121bc160c0fad64e06ff320c3 (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
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
% \iffalse
% This is the shortlst package
% Copyright 1998 by Mogens Lemvig Hansen
% Run this file through LaTeX and read the documentation in shortlst.dvi
% \fi
% \CheckSum{366}
% \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         \~}
%
% \def\fileversion{1.1} \def\filedate{1998/11/27} \def\docdate{\filedate}
% \title{The \textsf{shortlst} Package\thanks{This file describes version
%   \fileversion, \filedate, which is a bug-fix release containing no new
%   functionality since version 1.0.}}
% \author{\copyright\ Mogens Lemvig Hansen\\mlhansen@uniserve.com}
% \date{\docdate}
% \maketitle
% \begin{abstract}
%    The \textsf{shortlst} package provides environments similar
%    to \textsf{itemize} and \textsf{enumerate} designed especially
%    for lists of short items.
% \end{abstract}
%
% \tableofcontents
%
% \section{The Basics}
% When you have a list of short items, the regular \textsf{itemize}
% environment leaves
% \begin{itemize}
% \item a lot
% \item of
% \item white
% \item space.
% \end{itemize}
% The obvious alternative is to use a \textsf{tabular}, but tables are
% difficult to type and harder to edit if you decide to interchange two items.
% \DescribeEnv{shortitemize}
% This package allows you to type input very similar to \textsf{itemize}
% input.
% \begin{verbatim}
% \begin{shortitemize}
% \item the \textsf{itemize} environment
% \item leaves
% \item a lot
% \item of
% \item white space
% \end{shortitemize}
% \end{verbatim}
% The code above yields output like\footnote{All ``output'' in this document
% is simulated since you probably did not install the \textsf{shortlst}
% package before \LaTeX ing the documentation.  The \emph{real} output is
% nicer\dots} this:
% \newlength\mlh
% \begin{quote}\raggedright\setlength\mlh{65pt}
% \makebox[2\mlh][l]{$\bullet$\hspace{\labelsep}the \textsf{itemize}
%   environment}\ignorespaces
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}leaves}\\
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}a lot}\ignorespaces
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}of}\ignorespaces
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}white space}
% \end{quote}
% Above, \LaTeX\ decided that the first item needs twice as much space as the
% other items.  You may give an optional argument to the \textsf{shortitemize}
% environment specifying the width of the default allotment of space.
% \begin{verbatim}
% \begin{shortitemize}[the \textsf{itemize} environment]
% \end{verbatim}
% Now each item gets as much space as the first.
% \begin{quote}\raggedright
% \settowidth\mlh{the \textsf{itemize} environment}%
% \addtolength\mlh{2\labelsep}\addtolength\mlh\labelwidth
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}the \textsf{itemize}
%   environment}%
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}leaves}\\%
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}a lot}%
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}of}\\%
% \makebox[\mlh][l]{$\bullet$\hspace{\labelsep}white space}%
% \end{quote}
%
% You may not put any list environment inside a
% \textsf{shortitemize} environment---but a \textsf{shortitemize} environment
% can be (part of) an item of a regular list environment.
% If you put a \textsf{shortitemize} environment inside a regular
% \textsf{itemize} environment, \textsf{shortitemize} will use the next level
% of labels.
% \DescribeMacro{\item}
% You may use the optional argument to \verb:\item: to override
% the label---just as for the regular \textsf{itemize} environment.
%
% \DescribeEnv{shortenumerate}
% The \textsf{shortlst} package also provides a \textsf{shortenumerate}
% environment.  You may use \textsf{shortenumerate} in the same way as
% \textsf{shortitemize}, \emph{mutatis mutandis}.
% \begin{verbatim}
% \begin{enumerate}
% \item An item.
% \item This item contains a sub-list:
%       \begin{shortenumerate}
%       \item One
%       \item[\%] One and a half
%       \item Two
%       \item \label{here}Three
%       \end{shortenumerate}
% \item Back in the outer list.
% \end{enumerate}
% \end{verbatim}
% The code above yields this output:
% \begin{enumerate}
% \item An item.
% \item \label{here}This item contains a sub-list:
%       \begin{quote}\raggedright\setlength\mlh{1.2in}
% \makebox[\mlh][l]{(a)\hspace{\labelsep}One}%
% \makebox[\mlh][l]{\%\hspace{\labelsep}One and a half}%
% \makebox[\mlh][l]{(b)\hspace{\labelsep}Two}%
% \makebox[\mlh][l]{(c)\hspace{\labelsep}Three}%
%       \end{quote}
% \item Back in the outer list.
% \end{enumerate}
% Now you may use \verb:\ref{here}: to refer to item \ref{here}(c) in the
% usual manner.
%
% \DescribeEnv{runenumerate}
% Some lists do not deserve a displayed paragraph.  For such you may use the
% \textsf{runenumerate} environment.
% \begin{verbatim}
% You have three choices:
% \begin{runenumerate}
% \item wash you hands,
% \item postpone it until tomorrow, or
% \item \label{choice}stay dirty.
% \end{runenumerate}
% I choose \ref{choice}!
% \end{verbatim}
% Here is then the output:
% \begin{quotation}\setlength\mlh{1em plus .5em minus .5em}
% You have three choices:
% \mbox{1.\hspace\labelsep}wash you hands,\hspace\mlh
% \mbox{2.\hspace\labelsep}postpone it until tomorrow, or\hspace\mlh
% \mbox{3.\hspace\labelsep}stay dirty.\hspace\mlh
% I choose 3!
% \end{quotation}
% The main advantage of the \textsf{runenumerate} environment is the automatic
% (and nested) numbering and cross references.
% \DescribeEnv{runitemize}
% For completeness, the \textsf{shortlst} package also provides a
% \textsf{runitemize} environment.
%
% \section{The Parameters}
%
% \DescribeMacro{\runitemsep}
% The length \verb:\runitemsep: stores the space
% between items of a \textsf{runenumerate} or \textsf{runitemize}
% environment.  Here is the default value:
% \begin{verbatim}
% \setlength{\runitemsep}{1em plus .5em minus .5em}
% \end{verbatim}
%
% \DescribeMacro{\labelsep}
% All four environments, \textsf{shortitemize}, \textsf{shortenumerate},
% \textsf{runitemize}, and \textsf{runenumerate} use \verb:\labelsep: (from
% the \LaTeX\ kernel, see \cite[p.~113]{LaTeXbook}, \cite[p.~62]{companion},
% or \cite{ltlists}) for the space between the label and
% the item itself.  The two short-list environments use the same space as the
% minimal space between one item and the next label.
%
% \DescribeMacro{\labelwidth}
% The labels of the \textsf{shortitemize} and \textsf{shortenumerate}
% environments may overlap the previous item if the length \verb:\labelwidth:
% (from the \LaTeX\ kernel, see \cite[p.~113]{LaTeXbook},
% \cite[p.~62]{companion}, or \cite{ltlists}) is too small.
%
% \DescribeMacro{\shortitemwidth}
% Instead of giving optional arguments to each \textsf{shortitemize} and
% \textsf{shortitemize} environment, you may change the length
% \verb:\shortitemwidth:, which stores the default width of each item (without
% the label and a bit of space on each side).
% \begin{verbatim}
% \setlength{\shortitemwidth}{65pt}
% \end{verbatim}
% Inside a \textsf{shortitemize} or \textsf{shortenumerate} environment
% \verb:\shortitemwidth: is the width of the optional argument to the
% environment.  Thus you may use
% \verb:\parbox[t]{\shortitemwidth}{:\meta{paragraph}\verb:}: to typeset a
% long item.
% \begin{verbatim}
% \begin{shortenumerate}[A little paragraph]
% \item A short item
% \item \parbox[t]{\shortitemwidth}{A little paragraph
%       that\footnote{To parbox} will be too long to fit on one line
%       no matter what\strut.}
% \item Another short
% \item \newlength{\mylength}%
%       \setlength{\mylength}{2\shortitemwidth}%
%       \addtolength{\mylength}{2\labelsep}%
%       \addtolength{\mylength}{\labelwidth}%
%       \begin{minipage}[t]{\mylength}
%         A little paragraph that\footnote{To minipage}
%         will be too long to fit on one line no matter what.
%       \end{minipage}
% \item Bla
% \item Bla
% \end{shortenumerate}
% \end{verbatim}
% The \verb:\strut: on the last line of the \verb:\parbox: improves the
% spacing between the \verb:\parbox: and the following line.
% \begin{quote}
% \raggedright
% \newlength\mylength
% \settowidth\mylength{A little paragraph}
% \setlength\mlh{100pt}
% \makebox[\mlh][l]{1.\hspace\labelsep A short item}^^A
% \makebox[\mlh][l]{2.\hspace\labelsep \parbox[t]{\mylength}{A little
% paragraph that\footnotemark{} will be too long to fit on one line
% no matter what.\strut}}\footnotetext{To parbox}^^A
% \makebox[\mlh][l]{3.\hspace\labelsep Another short}\\
% \makebox[2\mlh][l]{4.\hspace\labelsep
%       \begin{minipage}[t]{180pt}
%               A little paragraph that\footnote{To minipage}
%               will be too long to fit on one line
%               no matter what.
%       \end{minipage}}^^A
% \makebox[\mlh][l]{5.\hspace\labelsep Bla}\\
% \makebox[\mlh][l]{6.\hspace\labelsep Bla}^^A
% \end{quote}
%
%
% \section{The Limitations}
% \begin{itemize}
% \item The \textsf{shortitemize} and \textsf{shortenumerate} environments
% cannot contain any list environment.  These include \textsf{shortitemize},
% \textsf{shortenumerate}, \textsf{itemize}, \textsf{enumerate},
% \textsf{description}, \textsf{quote}, \textsf{quotation}, \textsf{verse},
% \textsf{center}, \textsf{flushleft}, \textsf{flushright},
% \textsf{verbatim}\footnote{But \texttt{\bslash verb} is ok.},
% \textsf{tabbing}, \textsf{trivlist}, \textsf{list}, and all environments
% made with \verb:\newtheorem:.
%
% \item All four environments handle footnotes\footnote{In the case of
% \textsf{shortitemize} and \textsf{shortenumerate} due to a technique found
% in the \textsf{tabularx} package by David Carlisle
% \cite[code lines 121--127]{tabularx}.};
% however, the \textsf{shortitemize} and \textsf{shortenumerate} environments
% do not handle other types of floats.
%
% \item The \textsf{shortitemize} and \textsf{shortenumerate} environments
% cannot handle items that are longer than one line; use \verb:\parbox: or the
% \textsf{minipage} environment---with the implications that has on footnotes.
%
% \item The \textsf{shortlst} package does not define a version of the
% \textsf{description} environment because I do not know what it should do.
%
% \item You cannot use the \verb:\label: command if your
% \textsf{shortenumerate} or \textsf{runenumerate} environment is nested
% inside a \textsf{tabularx} environment.
%
% \item All four environments defined by the \textsf{shortlst} package make
% (parts of) paragraphs not boxes.  If you want your list centred, you must
% therefore include it in a \verb:\parbox: (or \textsf{minipage}) and centre
% the box.
%
% \end{itemize}
%
%
% \section{The Alternatives}
% \begin{description}
% \item[multiple columns]
% You may use the regular \textsf{itemize} and \textsf{enumerate} environments
% in a multi-column format.  The \textsf{multicol} package \cite{multicol}
% creates multiple columns very nicely.  The items end up ordered vertically
% where this package orders them horizontally.
%
% \item[\textsf{tabular}]
% You can put your items in a table---but such are difficult to edit and you
% do not get automatic numbering and cross references.
%
% \item[\textsf{multienum}]
% The \textsf{multienum} package \cite{multienum} provides an environment
% similar to \textsf{shortenumerate}.  However, the input syntax is more
% similar to \textsf{tabular} than to \textsf{enumerate}.
%
% \item[\textsf{paralist}]
% The \textsf{paralist} package \cite{paralist} provides environments
% similar to \textsf{runitemize} and \textsf{runenumerate} except that
% nesting inside \textsf{itemize} or \textsf{enumerate} is not considered.
%
% \end{description}

%
%
% \section{The Copyright}
% \begin{itemize}
% \item
%%      You may use this software.
% \item
%%      You may copy this software and the documentation for your own use.
% \item
%%      You may distribute the file \texttt{shortlst.dtx} to others provided
%%      you do not make a profit doing so.
% \item
%%      You may modify my code and the documentation---including incorporating
%%      it into your own work---provided you do not make a profit on my work
%%      or allow others to.
% \end{itemize}
%
%
% \section{The Installation}
% \begin{itemize}
% \item Run the file \texttt{shortlst.dtx} through \LaTeX\ (thrice to resolve
% cross references\footnote{If you want an index you must run MakeIndex
% (\texttt{makeindex -s gind.ist shortlst}) between the second and third
% \LaTeX{} run.}).
% \begin{verbatim}
% latex shortlst.dtx
% \end{verbatim}
% \item Run the file \texttt{shortlst.ins} which now exists through \LaTeX.
% \begin{verbatim}
% latex shortlst.ins
% \end{verbatim}
% \item You now have to decide what to do with several files.
% \begin{itemize}
% \item You may now have to move the file \texttt{shortlst.sty} to some
% directory where \LaTeX\ can find it; \texttt{texmf/tex/latex/misc} would be
% the natural choice~\cite{tds}.
% \item Move the documentation, \texttt{shortlst.dvi}, to
% \texttt{texmf/doc/latex/misc}.
% \item You may discard the source file, \texttt{shortlst.dtx}, or store it in
% the directory \texttt{texmf/source/latex/misc}.
% \item Discard all remaining \texttt{shortlst.*} files.
% \end{itemize}
% \end{itemize}
%
%\StopEventually{
% \bibliographystyle{is-plain}
% ^^A\bibliography{tex}
% \begin{thebibliography}{1}
%
% \bibitem{ltlists}
% Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, Frank
%   Mittelbach, Tobias Oetiker, Chris Rowley, and Rainer Sch{\"{o}}pf.
% \newblock {\em ltlists.dtx}.
% \newblock CTAN, 1997/02/21 edition, 1997.
%
% \bibitem{tabularx}
% David Carlisle.
% \newblock {\em The \textsf{tabularx} Package}.
% \newblock CTAN, 1997/09/18 v2.05 edition, 1997.
%
% \bibitem{ltboxes}
% David Carlisle, Leslie Lamport, Frank Mittelbach, and Chris Rowley.
% \newblock {\em ltboxes.dtx}.
% \newblock CTAN, 1998/06/05 edition, 1998.
%
% \bibitem{companion}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock {\em The {\LaTeX} Companion}.
% \newblock Addison-Wesley, 1994.
% \newblock ISBN 0-201-54199-8.
%
% \bibitem{multienum}
% Dennis Kletzing.
% \newblock {\em A Multienumerate Package}.
% \newblock CTAN.
% \newblock The author does not provide a version number.
%
% \bibitem{LaTeXbook}
% Leslie Lamport.
% \newblock {\em {\LaTeX}, A Document Preparation System, User's Guide and
%   Reference Manual}.
% \newblock Addison-Wesley, second edition, 1994.
% \newblock ISBN 0-201-52983-1.
%
% \bibitem{multicol}
% Frank Mittelbach.
% \newblock {\em An environment for multicolumn output}.
% \newblock CTAN, 1997/12/16 v1.5p edition, 1997.
%
% \bibitem{paralist}
% Bernd Schandl.
% \newblock {\em \textsf{paralist}, Enumerate and Itemize as and within
%   Paragraphs}.
% \newblock CTAN, 1998/10/11 v1.0 edition.
%
% \bibitem{tds}
% {TUG Working Group on a {\TeX} Directory Structure (TWG-TDS)}.
% \newblock {\em A Directory Structure for {\TeX} Files}.
% \newblock CTAN, version 0.9995, january 26, 1998 edition, 1998.
%
% \end{thebibliography}
% \PrintIndex
%}
%
%
% \section{The Driver}
% The following few lines of code allow \LaTeX\ to generate
% the \texttt{.sty} file and the documentation from this source.
% First, a \textsf{filecontents} environment creates the installation script,
% \texttt{shortlst.ins}, for \textsc{DocStrip}.
%    \begin{macrocode}
%<*docstrip>
\begin{filecontents}{shortlst.ins}
\input docstrip.tex
\preamble
   The shortlst Package
   Copyright 1998 by Mogens Lemvig Hansen
   mlhansen@uniserve.com
\endpreamble
%    \end{macrocode}
% I think that \texttt{shortlst.sty} should go into the directory
% \texttt{tex/latex/misc}; however, \textsc{DocStrip} will not heed my advise
% unless your configuration file, \texttt{docstrip.cfg}, allows it to.
%    \begin{macrocode}
\usedir{tex/latex/misc}
\generate{\file{shortlst.sty}{\from{shortlst.dtx}{package}}}
\endbatchfile
\end{filecontents}
%</docstrip>
%    \end{macrocode}
% Then the driver to typeset the documentation.
%    \begin{macrocode}
%<*docdriver>
\documentclass{ltxdoc}[1996/01/11]
\CodelineIndex%\EnableCrossrefs
\begin{document} \DocInput{shortlst.dtx} \end{document}
%</docdriver>
%    \end{macrocode}
%
%
% \section{The Implementation}
%
% Declare the package name.  I made this package with the December 1997
% version of \LaTeX; it may work with earlier versions.
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{shortlst}
         [1998/11/27 version 1.1]
%    \end{macrocode}
%
% \subsection{The run-in lists}
% \begin{macro}{\runitemsep}
% Run-in items are separated by the length \verb:\runitemsep:.  The same
% amount of space is also placed before the first item and after the last.
%    \begin{macrocode}
\newlength\runitemsep
\setlength\runitemsep{1em plus .5em minus .5em}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{runitemize}
% The \textsf{runitemize} environment first checks if the current level of
% nesting of \textsf{itemize}-like environments is shallow enough to proceed.
%    \begin{macrocode}
\newenvironment{runitemize}{%
   \ifnum \@itemdepth >\thr@@\@toodeep\else
   \advance\@itemdepth\@ne
%    \end{macrocode}
% Define the default label, \verb:\@itemlabel:, as \verb:\labelitem:\meta{i}
% which expand to the bullet, dash, etc.\ used by \textsf{itemize}.
%    \begin{macrocode}
   \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
   \def\@itemlabel{\csname\@itemitem\endcsname}%
%    \end{macrocode}
% The regular \verb:\item: command calls \verb:\@item:, so make it use a
% custom version.
%    \begin{macrocode}
   \let\@item\run@item
%    \end{macrocode}
% Disable \verb:\par: inside the \textsf{runitemize} environment, ignore
% spaces following the \verb:\begin{runitemize}:, and close the \verb:\ifnum:
% at the beginning of this definition.
%    \begin{macrocode}
   \let\par\relax
   \ignorespaces\fi}
%    \end{macrocode}
% At the end of the \textsf{runitemize} environment you must remove the space
% (if any) between the last item and the \verb:\end{runitemize}:; replace it
% by \verb:\runitemsep: amount of space.   Then ignore spaces following the
% \verb:\end{runitemize}:.
%    \begin{macrocode}
   {\unskip\hspace\runitemsep\ignorespacesafterend}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{runenumerate}
% The definition of the \textsf{runenumerate} environment is similar to that
% of the \textsf{runitemize} environment.
%    \begin{macrocode}
\newenvironment{runenumerate}{%
   \ifnum \@enumdepth >\thr@@\@toodeep\else
   \advance\@enumdepth\@ne
%    \end{macrocode}
% The call to \verb:\usecounter{enum:\meta{i}\verb:}: sets \verb:\if@nmbrlist:
% true and defines \verb:\@listctr: as \verb:enum:\meta{i} which is the
% counter used by the \textsf{enumerate} environment at this level.
%    \begin{macrocode}
   \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
   \usecounter{\@enumctr}%
%    \end{macrocode}
% Define the default label, \verb:\@itemlabel:, as \verb:\labelenum:\meta{i}.
%    \begin{macrocode}
   \def\@itemlabel{\csname label\@enumctr \endcsname}%
   \let\@item\run@item
   \let\par\@empty
   \ignorespaces\fi}
   {\unskip\hspace\runitemsep\ignorespacesafterend}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\run@item}
% The regular \verb:\item: command checks if it has an optional argument,
% stores the answer in \verb:\if@noitemarg:, and calls \verb:\@item: or
% \verb:\@item[\@itemlabel]: as appropriate.  The \verb:\run@item: command is
% the custom version of \verb:\@item: for the run-in list environments.
%
% First remove the space (if any) between the last item and this one; replace
% it by \verb:\runitemsep: amount of space.  However, this could be the first
% item of a list which is the first object in a paragraph.  In that case, just
% begin a new paragraph.
%    \begin{macrocode}
\def\run@item[#1]{%
   \ifhmode\unskip\hspace\runitemsep\else\leavevmode\fi
%    \end{macrocode}
% If the \verb:\item: had no optional argument and if this is a numbered list,
% increment the counter.
%    \begin{macrocode}
   \if@noitemarg
      \@noitemargfalse
      \if@nmbrlist\refstepcounter{\@listctr}\fi
   \fi
%    \end{macrocode}
% Set the label.
%    \begin{macrocode}
   \mbox{#1}\kern\labelsep\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsection{The short-lists}
% \begin{macro}{\shortitemwidth}
% The idea is to typeset each item in a box of width
% ``a multiple of a fixed length.''  \TeX\ will then stack the boxes so that
% they line up nicely.
% The default ``fixed length'' is $\verb:\shortitemwidth: + \verb:\labelwidth:
% + 2\verb:\labelsep:$ (one \verb:\labelsep: between the label and the item;
% another \verb:\labelsep: between this item and the next label).
% The default value is rather arbitrary.
%    \begin{macrocode}
\newlength\shortitemwidth
\setlength\shortitemwidth{65pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{shortitemize}
% The default value of the optional argument to the \textsf{shortitemize}
% environment is a box of width \verb:\shortitemwidth:.
%    \begin{macrocode}
\newenvironment{shortitemize}[1][\hbox to \shortitemwidth{\hfil}]{%
%    \end{macrocode}
% Check the level of nesting and define the default label as for
% \textsf{runitemize} above.
%    \begin{macrocode}
   \ifnum \@itemdepth >\thr@@\@toodeep\let\endsh@rtitem\relax\else
   \ifx\item\sh@rtitem\sh@rtnesterr\let\endsh@rtitem\relax\else
   \advance\@itemdepth\@ne
   \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
%    \end{macrocode}
% Measure the width of the optional argument.
% Since short-list environments
% cannot be nested anyway, you may store the value locally in
% \verb:\shortitemwidth:.
%    \begin{macrocode}
   \settowidth\shortitemwidth{#1}%
%    \end{macrocode}
%
% Use the \textsf{list} environment to create a displayed paragraph for the
% short-list.
% If the end-user has mismatched environments, \LaTeX\ should not mention a
% \textsf{list} environment from the workings of this code, so use
% \verb:\list: and \verb:\endlist: instead of \verb:\begin{list}: and
% \verb:\end{list}:.
%
% In the \textsf{itemize} environment labels stick out in the margin; to get
% things to line up here, it is easier to move the left margin instead.
%    \begin{macrocode}
   \list{}{\addtolength\leftmargin\itemindent
           \addtolength\leftmargin{-\labelwidth}%
           \addtolength\leftmargin{-\labelsep}%
%    \end{macrocode}
% You cannot have any indentation inside the \textsf{shortitemize}
% environment.
%    \begin{macrocode}
           \setlength\itemindent\z@}%
%    \end{macrocode}
% The \verb:\item: command gets the \textsf{list} environment started.  Then
% it is safe to set up a custom version of \verb:\item:
% \changes{1.1}{98/11/27}{Fixed the ragged right.}
% and a \verb:\raggedright: style right-hand margin.
% The \verb:\endsh@rtitem: command is explained below.
%    \begin{macrocode}
   \item\relax
   \@rightskip\@flushglue \rightskip\@rightskip
   \let\endsh@rtitem\noindent
   \let\item\sh@rtitem
   \def\@itemlabel{\csname\@itemitem\endcsname}%
   \fi\fi\ignorespaces}%
%    \end{macrocode}
%
% At the end of the \textsf{shortitemize} environment you must process the
% last item and close the \textsf{list} environment.
%    \begin{macrocode}
   {\endsh@rtitem\endlist}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{environment}{shortenumerate}
% The definition of the \textsf{shortenumerate} environment is straight
% forward once you comprehend the \textsf{runenumerate} and
% \textsf{shortitemize} environments.
% \changes{1.1}{98/11/27}{Fixed the ragged right.}
%    \begin{macrocode}
\newenvironment{shortenumerate}[1][\hbox to \shortitemwidth{\hfil}]{%
   \ifnum \@enumdepth >\thr@@\@toodeep\let\endsh@rtitem\relax\else
   \ifx\item\sh@rtitem\sh@rtnesterr\let\endsh@rtitem\relax\else
   \advance\@enumdepth\@ne
   \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
   \settowidth\shortitemwidth{#1}%
   \list{}{\addtolength\leftmargin\itemindent
           \addtolength\leftmargin{-\labelwidth}%
           \addtolength\leftmargin{-\labelsep}%
           \setlength\itemindent\z@}%
   \item\relax
   \@rightskip\@flushglue \rightskip\@rightskip
   \let\endsh@rtitem\noindent
   \let\item\sh@rtitem
   \usecounter{\@enumctr}%
   \def\@itemlabel{\csname label\@enumctr \endcsname}%
   \fi\fi\ignorespaces}%
   {\endsh@rtitem\endlist}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\TX@ftn}\begin{macro}{\TX@ftntext}\begin{macro}{\TX@xftntext}
% Since each item is typeset inside a box, \TeX\ gobbles up all footnotes.
% David Carlisle has solved that problem in his \textsf{tabularx} package
% \cite[code lines 122--127]{tabularx}.  To
% require all of that package every time seems a bit much, so just copy those
% lines of code if needed.
% These special versions of \verb:\@footnotetext: and \verb:\@xfootnotetext:
% store appropriate \verb:\footnotetext: commands in the token list
% \verb:\TX@ftn: for later processing.
%    \begin{macrocode}
\ifx\TX@ftn\undefined
   \newtoks\TX@ftn
   \long\def\TX@ftntext#1{%
     \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
                       [\the\csname c@\@mpfn\endcsname]}%
     \global\TX@ftn\expandafter{\@tempa{#1}}}%
   \long\def\TX@xftntext[#1]#2{%
     \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
\fi
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\sh@rtitem}
% You need to capture each item in a box.  Thus each \verb:\item: must close
% and process the previous box before it begins capturing the next item.  The
% custom version of \verb:\item: therefore first calls \verb:\endsh@rtitem: to
% finish off the last item, then checks for an optional argument, stores the
% answer in \verb:\@noitemarg:, and calls \verb:\sh@rt@item: or
% \verb:\sh@rt@item[\@itemlabel]: as appropriate.  Here \verb:\@itemlabel: is
% the default label.
%    \begin{macrocode}
\def\sh@rtitem{%
  \endsh@rtitem
  \@inmatherr\item
  \@ifnextchar [\sh@rt@item{\@noitemargtrue \sh@rt@item[\@itemlabel]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sh@rt@item}
% \begin{macro}{\endsh@rtitem}
% The \verb:\sh@rt@item: command first (re-)defines \verb:\endsh@rtitem:.  An
% \textsf{lrbox} environment captures the label and the text of the item in
% the box \verb:\@tempboxa:, so close that environment---only use
% \verb:\begingroup\lrbox: and \verb:\endlrbox\endgroup: instead of
% \verb:\begin{lrbox}: and \verb:\end{lrbox}: as for \verb:\list: above (the
% extra group is necessary due to the convoluted workings of \textsf{lrbox}
% \cite[code lines 69--80]{ltboxes}).
%    \begin{macrocode}
\def\sh@rt@item[#1]{%
   \def\endsh@rtitem{\endlrbox\endgroup%
%    \end{macrocode}
% Measure the width of the box---that is, the width of the label, the space
% between the label and the item, and the item itself.  Let $a$ be that width
% plus one \verb:\labelsep: (for the separation between this item and the next
% label).
%    \begin{macrocode}
      \setlength\@tempdima{\wd\@tempboxa}%
      \addtolength\@tempdima\labelsep
%    \end{macrocode}
% Then let $b$ be the ``fixed length;'' that is, $\verb:\labelwidth: +
% 2\verb:\labelsep: + \verb:\shortitemwidth:$.
%    \begin{macrocode}
      \setlength\@tempdimb\shortitemwidth
      \addtolength\@tempdimb{2\labelsep}%
      \addtolength\@tempdimb{\labelwidth}%
%    \end{macrocode}
% Then calculate how many multiples of $b$ you need to contain $a$; that is,
% calculate $\lceil \frac ab \rceil b$.  However, \LaTeX\ does not provide a
% ceiling function, so use \TeX's integer division command, which (for
% positive integers) calculates $\lfloor \frac ab \rfloor$, and add one.  The
% result is fine except when $b$ divides $a$ perfectly---which could happen if
% the item is a \verb:\parbox{\shortitemwidth}:, so cheat:  decrease $a$ by A
% Very Small Length first.
%    \begin{macrocode}
      \addtolength\@tempdima{-1sp}% subtract a Very Small Length
      \divide\@tempdima by \@tempdimb%
      \addtolength\@tempdima{1sp}%  add one
      \multiply\@tempdimb by \@tempdima%
%    \end{macrocode}
% Now $b$ is the desired width of the box. Instead of actually making a box of
% that width, typeset the box as is followed by a suitable amount of space
% (which will then nicely disappear if it happens to land on the right-hand
% margin).
%    \begin{macrocode}
      \addtolength\@tempdimb{-\wd\@tempboxa}%
      \usebox\@tempboxa
%    \end{macrocode}
% Now $b$ is the amount of space which you must remember to set once the
% footnotes have been processed..
%
% The following line of code (from \cite[code line 50]{tabularx}) inserts the
% footnotes (or, rather, \verb:\footnotetext:-s) that were collected inside
% the box.
% The \verb:\expandafter: trickery causes \TeX\ to first clear the token list
% \verb:\TX@ftn:, then execute the \verb:\footnotetext: commands that it
% contained.  This convoluted order ensures that the \verb:\footnotetext:-s go
% back into \verb:\TX@ftn: if the short-list is nested inside a
% \textsf{tabularx} environment (so that \textsf{tabularx} can typeset them in
% due time).
%   \begin{macrocode}
      \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
      \hspace\@tempdimb}%
%    \end{macrocode}
% \end{macro}
%
% That was the end---now back to the beginning.  First ref-step the counter if
% appropriate.
%    \begin{macrocode}
   \if@noitemarg
      \@noitemargfalse
      \if@nmbrlist\refstepcounter{\@listctr}\fi
   \fi
%    \end{macrocode}
% Issue a warning if the label is too wide---it may overlap the previous item.
%    \begin{macrocode}
   \settowidth\@tempdima{#1}%
   \ifdim\@tempdima>\labelwidth\PackageWarning{shortlst}%
      {label too wide
       (set \string\labelwidth\space to at least \the\@tempdima)}%
   \fi
%    \end{macrocode}
% Then begin collecting an lrbox.  Once inside the box, use the custom
% footnotes and set the label and some space before the item itself.
%    \begin{macrocode}
   \begingroup\lrbox{\@tempboxa}%
      \let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
      \makebox[\labelwidth][r]{#1}%
      \hspace{\labelsep}\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sh@rtnesterr}
% That's it!  You just need a single custom error message.
%    \begin{macrocode}
\newcommand{\sh@rtnesterr}{\PackageError{shortlst}
   {nested short-lists}
   {don't nest short-list environments within each other}}
%</package>
%    \end{macrocode}
% \end{macro}
% \Finale