summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shortlst/shortlst.sty
blob: ae83d7eaa4b0242a474c6355387d2809d07a7334 (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
%%
%% This is file `shortlst.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% shortlst.dtx  (with options: `package')
%%    The shortlst Package
%%    Copyright 1998 by Mogens Lemvig Hansen
%%    mlhansen@uniserve.com

%%      You may use this software.
%%      You may copy this software and the documentation for your own use.
%%      You may distribute the file \texttt{shortlst.dtx} to others provided
%%      you do not make a profit doing so.
%%      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.
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{shortlst}
         [1998/11/27 version 1.1]
\newlength\runitemsep
\setlength\runitemsep{1em plus .5em minus .5em}
\newenvironment{runitemize}{%
   \ifnum \@itemdepth >\thr@@\@toodeep\else
   \advance\@itemdepth\@ne
   \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
   \def\@itemlabel{\csname\@itemitem\endcsname}%
   \let\@item\run@item
   \let\par\relax
   \ignorespaces\fi}
   {\unskip\hspace\runitemsep\ignorespacesafterend}
\newenvironment{runenumerate}{%
   \ifnum \@enumdepth >\thr@@\@toodeep\else
   \advance\@enumdepth\@ne
   \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
   \usecounter{\@enumctr}%
   \def\@itemlabel{\csname label\@enumctr \endcsname}%
   \let\@item\run@item
   \let\par\@empty
   \ignorespaces\fi}
   {\unskip\hspace\runitemsep\ignorespacesafterend}
\def\run@item[#1]{%
   \ifhmode\unskip\hspace\runitemsep\else\leavevmode\fi
   \if@noitemarg
      \@noitemargfalse
      \if@nmbrlist\refstepcounter{\@listctr}\fi
   \fi
   \mbox{#1}\kern\labelsep\ignorespaces}
\newlength\shortitemwidth
\setlength\shortitemwidth{65pt}
\newenvironment{shortitemize}[1][\hbox to \shortitemwidth{\hfil}]{%
   \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}%
   \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
   \def\@itemlabel{\csname\@itemitem\endcsname}%
   \fi\fi\ignorespaces}%
   {\endsh@rtitem\endlist}
\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}
\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
\def\sh@rtitem{%
  \endsh@rtitem
  \@inmatherr\item
  \@ifnextchar [\sh@rt@item{\@noitemargtrue \sh@rt@item[\@itemlabel]}}
\def\sh@rt@item[#1]{%
   \def\endsh@rtitem{\endlrbox\endgroup%
      \setlength\@tempdima{\wd\@tempboxa}%
      \addtolength\@tempdima\labelsep
      \setlength\@tempdimb\shortitemwidth
      \addtolength\@tempdimb{2\labelsep}%
      \addtolength\@tempdimb{\labelwidth}%
      \addtolength\@tempdima{-1sp}% subtract a Very Small Length
      \divide\@tempdima by \@tempdimb%
      \addtolength\@tempdima{1sp}%  add one
      \multiply\@tempdimb by \@tempdima%
      \addtolength\@tempdimb{-\wd\@tempboxa}%
      \usebox\@tempboxa
      \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
      \hspace\@tempdimb}%
   \if@noitemarg
      \@noitemargfalse
      \if@nmbrlist\refstepcounter{\@listctr}\fi
   \fi
   \settowidth\@tempdima{#1}%
   \ifdim\@tempdima>\labelwidth\PackageWarning{shortlst}%
      {label too wide
       (set \string\labelwidth\space to at least \the\@tempdima)}%
   \fi
   \begingroup\lrbox{\@tempboxa}%
      \let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
      \makebox[\labelwidth][r]{#1}%
      \hspace{\labelsep}\ignorespaces}
\newcommand{\sh@rtnesterr}{\PackageError{shortlst}
   {nested short-lists}
   {don't nest short-list environments within each other}}
\endinput
%%
%% End of file `shortlst.sty'.