summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ltxindex/ltxindex.sty
blob: a8436e34035adf82e9827e825855321014cc9102 (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
%%
%% This is file `ltxindex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ltxindex.dtx  (with options: `ltxindex,package')
%% 
%%    ltxindex.sty, a LaTeX package to typeset indices with GNU's Texindex
%%    Copyright (C) 2004 by Richard Stallman, Robert J. Chassell,
%%    Michael Clarkson, \& Luis Rivera.
%% 
%%    This program is free software; you can redistribute it and/or modify
%%    it under the terms of the GNU General Public License as published by
%%    the Free Software Foundation; either version 2, or (at your option)
%%    any later version.
%% 
%%    This program is distributed in the hope that it will be useful,
%%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%    GNU General Public License for more details.
%% 
%%    You should have received a copy of the GNU General Public License
%%    along with this program; if not, write to the Free Software
%%    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%% 
%%               WARNING!!! This code is fairly experimental.
%% 
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{ltxindex}
    [2008/06/06 v0.1c ltxindex: LaTeX indexing, texindex style]
\RequirePackage{multicol}
\newenvironment{ltxmulticols}{\begin{multicols}{2}}{\end{multicols}}
\DeclareOption{nomulticol}{\renewenvironment{ltxmulticols}{}{}}
\def\cindex{\cpindex}
\def\pindex{\pgindex}
\def\vindex{\vrindex}
\def\tindex{\tpindex}
\def\kindex{\kyindex}
\def\findex{\fnindex}
\def\newindex#1{\csname newindex#1\endcsname}
\def\newindexcp{\if@filesw \newwrite\@cpindexfile
  \immediate\openout\@cpindexfile=\jobname.cp
  \def\cpindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@cpindexfile}%
  \def\cpsubindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrsubindex\@cpindexfile}%
  \def\cpindexbold{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindexbold\@cpindexfile}
   \typeout{Writing concepts index file \jobname.cp }%
   \fi}

\def\cpindex{\@bsphack\begingroup \@sanitize\@index}
\def\cpsubindex{\@bsphack\begingroup \@sanitize\@index}
\def\cpindexbold{\@bsphack\begingroup \@sanitize\@index}

\def\@wrindex#1#2{\let\thepage\relax
   \xdef\@gtempa{\write#1{\string \entry{#2}{\thepage}{#2}}}\endgroup
   \def\@tempa{}\def\thing{#2}\ifx\thing\@tempa\relax\else\@gtempa\fi
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\@wrindexbold#1#2{\let\thepage\relax \let\bf\relax
   \xdef\@gtempa{\write#1{\string \entry{#2}{\b{\thepage}}{#2}}}\endgroup
   \def\@tempa{}\def\thing{#2}\ifx\thing\@tempa\relax\else\@gtempa\fi
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\@wrsubindex#1#2#3{\let\thepage\relax
\xdef\@gtempa{\write#1{\string \entry{#2 #3}{\thepage}{#2}{#3}}}\endgroup%
\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\@index#1{\endgroup\@esphack}

\def\pgindex{\@bsphack\begingroup \@sanitize\@index}
\def\newindexpg{\if@filesw \newwrite\@pgindexfile
  \immediate\openout\@pgindexfile=\jobname.pg
  \def\pgindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@pgindexfile}
  \def\pgindexbold{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindexbold\@pgindexfile}
\typeout{Writing index file \jobname.pg }\fi}

\def\pgindex{\@bsphack\begingroup \@sanitize\@index}
\def\pgindexbold{\@bsphack\begingroup \@sanitize\@index}

\def\newindexvr{\if@filesw \newwrite\@vrindexfile
  \immediate\openout\@vrindexfile=\jobname.vr
  \def\vrindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@vrindexfile}
  \def\vrindexbold{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindexbold\@vrindexfile}
\typeout{Writing variable index file \jobname.vr }\fi}

\def\vrindex{\@bsphack\begingroup \@sanitize\@index}
\def\vrindexbold{\@bsphack\begingroup \@sanitize\@index}

\def\newindextp{\if@filesw \newwrite\@tpindexfile
  \immediate\openout\@tpindexfile=\jobname.tp
  \def\tpindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@tpindexfile}
  \def\tpindexbold{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindexbold\@tpindexfile}
\typeout{Writing datatype index file \jobname.tp }\fi}

\def\tpindex{\@bsphack\begingroup \@sanitize\@index}
\def\tpindexbold{\@bsphack\begingroup \@sanitize\@index}

\def\newindexky{\if@filesw
  \newwrite\@kyindexfile
  \immediate\openout\@kyindexfile=\jobname.ky
  \def\kyindex{\@bsphack\begingroup
      \def\protect####1{\string####1\space}\@sanitize
      \@wrindex\@kyindexfile}\typeout{Writing key index file \jobname.ky}
  \fi}

\def\kyindex{\@bsphack\begingroup \@sanitize\@index}
\def\kyindexbold{\@bsphack\begingroup \@sanitize\@index}

\def\newindexfn{\if@filesw \newwrite\@fnindexfile
  \immediate\openout\@fnindexfile=\jobname.fn
  \def\fnindex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindex\@fnindexfile}
  \def\fnindexbold{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrindexbold\@fnindexfile}
\typeout{Writing function index file \jobname.fn }\fi}

\def\fnindex{\@bsphack\begingroup \@sanitize\@index}
\def\fnindexbold{\@bsphack\begingroup \@sanitize\@index}
\def\synindex#1#2{\expandafter\xdef \csname @#1index\endcsname{%
\noexpand\csname @#2index\endcsname}%
\expandafter \chardef \csname @#1indexfile\endcsname=\csname @#2indexfile\endcsname}
\def\syncodeindex#1#2{%
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
\csname#1boldindex\endcsname{#2}}%
}
\newskip\secondaryindent
\secondaryindent=0.5cm
\ifx\putwordIndexNonexistent\undefined
    \gdef\putwordIndexNonexistent{(Index is nonexistent)}
\fi
\ifx\putwordIndexIsEmpty\undefined
    \gdef\putwordIndexIsEmpty{(Index is empty)}
\fi
\def\printindex#1{
\def\indexbackslash{\rawbackslashxx}
\tolerance=9500 \advance\baselineskip -1pt
\openin 1 \jobname.#1s
\ifeof 1
    \putwordIndexNonexistent
  \else
    \read 1 to \temp
  \ifeof 1
    \putwordIndexIsEmpty
  \else
    \begin{ltxmulticols}
    \input \jobname.#1s
    \end{ltxmulticols}
  \fi
\fi
\closein 1
}
\def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros
\def\pline{\hbox to\hsize}

\def\initial#1{%
{\bigbreak\pline{\large\bf#1\hfill}\kern 2pt\penalty3000}}

\def\entry #1#2{
{\parfillskip=0in \parskip=0in \parindent=0in \small
\hangindent=1in \hangafter=1%
\noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll\relax #2\par
}}

\def\primary #1{\pline{\small#1\hfil}}

\def\secondary #1#2{
{\parfillskip=0in \parskip=0in \small
\hangindent =1in \hangafter=1
\noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par
}}
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
\newindex{cp}
\newcommand{\indexcp}[1]{#1\cpindex{#1}}
\newcommand{\subindexcp}[2]{#1\cpsubindex{#2}{#1}}
\ExecuteOptions{}
\ProcessOptions
\endinput
%%
%% End of file `ltxindex.sty'.