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
|
%%
%% This is file `luaindex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luaindex.dtx (with options: `package')
%%
%% Copyright (c) 2011 by Markus Kohm <komascript(at)gmx.info>
%%
%% This file was generated from file(s) of luaindex distribution.
%% --------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, version 1.3c of the license.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer and author of this work is Markus Kohm.
%%
%% This file may only be distributed together with the files listed in
%% `luaindex.dtx'. You may however distribute the files listed in
%% `luaindex.dtx' without this file.
%%
%% NOTE: THIS IS AN ALPHA-VERSION!
%%
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{luaindex}
[2011/02/18 v0.1b LuaLaTeX Package
index processor]%
\RequirePackage{ifluatex}
\ifluatex\else
\PackageError{luaindex}{lualatex needed}{%
Package `luaindex' needs LuaTeX.\MessageBreak
So you should use `lualatex' to process you document!\MessageBreak
See documentation of `luaindex' for further information.}%
\expandafter\expandafter\expandafter\csname endinput\endcsname
\fi
\RequirePackage{luatexbase-compat}[2010/10/10]
\RequirePackage{luatexbase-modutils}[2010/10/10]
\luatexbase@ensure@primitive{luaescapestring}
\directlua{%
if not tex.error then
luatexbase.module_error('luaindex',
'undefined function!\string\n%
LuaTeX function tex.error() needed but not defined.\string\n%
Maybe you are using the wrong version of LuaTeX.')
end
if not tex.print then
luatexbase.module_error('luaindex',
'undefined function!\string\n%
LuaTeX function tex.print() needed but not defined.\string\n%
Maybe you are using the wrong version of LuaTeX.')
end
if not tex.sprint then
luatexbase.module_error('luaindex',
'undefined function!\string\n%
LuaTeX function tex.sprint() needed but not defined.\string\n%
Maybe you are using the wrong version of LuaTeX.')
end
}
\RequireLuaModule{luaindex}
\newwrite\@indexfile
\AtBeginDocument{%
\IfFileExists{\jobname.ldx}{\directlua{dofile('\jobname.ldx')}}{}%
\openout\@indexfile=\jobname.ldx
}
\RequirePackage{scrbase}
\DefineFamily{luaindex}
\DefineFamilyMember{luaindex}
\newcommand*{\luaindex@sortorder}{}
\DefineFamilyKey{luaindex}{sortorder}{%
\edef\luaindex@sortorder{#1}%
}
\DefineFamilyKey{luaindex}{locale}{%
\if@atdocument
\expandafter\@firstofone
\else
\expandafter\AtBeginDocument
\fi
{%
\protected@write\@indexfile{}{%
os.setlocale('#1','collate')
}%
}%
}
\newcommand*{\luaindex@pageformat}{}
\DefineFamilyKey{luaindex}{pageformat}{%
\def\luaindex@pageformat{#1}%
}
\FamilyBoolKey{luaindex}{singlepass}{@luaindexsinglepass}
\FamilyProcessOptions{luaindex}\relax
\newcommand*{\setupluaindex}{\FamilyOptions{luaindex}}
\newcommand*\see[2]{\emph{\seename} #1}
\providecommand*\seealso[2]{\emph{\alsoname} #1}
\providecommand\seename{see}
\providecommand*\alsoname{see also}
\newcommand*{\newindex}[2][]{%
\directlua{luaindex.newindex('\luatexluaescapestring{#2}')}%
\begingroup
\setupluaindex{#1}%
\ifx\luaindex@sortorder\@empty\else
\AtBeginDocument{%
\protected@write\@indexfile{}{%
luaindex.sortorder('\luatexluaescapestring{#2}',
'\luaindex@sortorder')
}}%
\fi
\endgroup
}
\@onlypreamble\newindex
\newcommand*{\luaindex}[1]{%
\@bsphack
\begingroup
\edef\luaindex@name{#1}%
\lua@index
}
\newcommand*{\lua@index}[2][]{%
\set@display@protect
\edef\luaindex@sort{#2}%
\define@key{luaindex.setindex}{sort}{\edef\luaindex@sort{##1}}%
\define@key{luaindex.setindex}{pageformat}{\def\luaindex@pageformat{##1}}%
\define@key{luaindex.setindex}{locale}{\luaindexsetup{locale=#1}}%
\setkeys{luaindex.setindex}{#1}%
\protected@write\@indexfile{\let\luatexluaescapestring\relax}{%
luaindex.insert('\luatexluaescapestring{\luaindex@name}',
'{\luatexluaescapestring{\luaindex@pageformat{\thepage}}}',
'\luatexluaescapestring{\luaindex@sort}',
'\luatexluaescapestring{#2}')
}%
\endgroup
\@esphack
}
\newcommand*{\luasubindex}[1]{%
\@bsphack
\begingroup
\edef\luaindex@name{#1}%
\lua@subindex
}
\newcommand*{\lua@subindex}[2][]{%
\set@display@protect
\edef\luaindex@sort{#2}%
\define@key{luaindex.setindex}{sort}{\edef\luaindex@sort{##1}}%
\define@key{luaindex.setindex}{pageformat}{\def\luaindex@pageformat{##1}}%
\define@key{luaindex.setindex}{locale}{\luaindexsetup{locale=#1}}%
\setkeys{luaindex.setindex}{#1}%
\protected@write\@indexfile{\let\luatexluaescapestring\relax}{%
luaindex.insert('\luatexluaescapestring{\luaindex@name}',
'{\luatexluaescapestring{\luaindex@pageformat{\thepage}}}',
'\luatexluaescapestring{\luaindex@sort}',
'\luatexluaescapestring{#2}',
}%
\aftergroup\lua@@subindex
\endgroup
}
\newcommand*{\lua@@subindex}[2][]{%
\begingroup
\set@display@protect
\edef\luaindex@sort{#2}%
\define@key{luaindex.setindex}{sort}{\edef\luaindex@sort{##1}}%
\setkeys{luaindex.setindex}{#1}%
\protected@write\@indexfile{\let\luatexluaescapestring\relax}{%
\@spaces
'\luatexluaescapestring{\luaindex@sort}',
'\luatexluaescapestring{#2}')
}%
\endgroup
\@esphack
}
\newcommand*{\luasubsubindex}[1]{%
\@bsphack
\begingroup
\edef\luaindex@name{#1}%
\lua@subsubindex
}
\newcommand*{\lua@subsubindex}[2][]{%
\set@display@protect
\edef\luaindex@sort{#2}%
\define@key{luaindex.setindex}{sort}{\edef\luaindex@sort{##1}}%
\define@key{luaindex.setindex}{pageformat}{\def\luaindex@pageformat{##1}}%
\define@key{luaindex.setindex}{locale}{%
\luaindexsetup{locale=#1}%
}
\setkeys{luaindex.setindex}{#1}%
\protected@write\@indexfile{\let\luatexluaescapestring\relax}{%
luaindex.insert('\luatexluaescapestring{\luaindex@name}',
'{\luatexluaescapestring{\luaindex@pageformat{\thepage}}}',
'\luatexluaescapestring{\luaindex@sort}',
'\luatexluaescapestring{#2}',
}%
\aftergroup\lua@@@subindex
\endgroup
}
\newcommand*{\lua@@@subindex}[2][]{%
\begingroup
\set@display@protect
\edef\luaindex@sort{#2}%
\define@key{luaindex.setindex}{sort}{\edef\luaindex@sort{##1}}%
\setkeys{luaindex.setindex}{#1}%
\protected@write\@indexfile{\let\luatexluaescapestring\relax}{%
\@spaces
'\luatexluaescapestring{\luaindex@sort}',
'\luatexluaescapestring{#2}',
}%
\aftergroup\lua@@subindex
\endgroup
}
\renewcommand*{\makeindex}{%
\newindex{general}%
\renewcommand*\index{\luaindex{general}}%
\newcommand*\subindex{\luasubindex{general}}%
\newcommand*\subsubindex{\luasubsubindex{general}}%
}
\newcommand*{\printindex}[1][]{%
\begingroup
\edef\luaindex@name{general}%
\define@key{luaindex.setindex}{index}{\edef\luaindex@name{##1}}%
\define@key{luaindex.setindex}{singlepass}[true]{%
\setupluaindex{singlepass}{##1}%
}%
\setkeys{luaindex.setindex}{#1}%
\if@luaindexsinglepass
\closeout\@indexfile
\clearpage
\directlua{%
luaindex.removeentries('\luatexluaescapestring{\luaindex@name}')
dofile('\jobname.ldx')
}%
\fi
\directlua{%
luaindex.printindex('\luatexluaescapestring{\luaindex@name}')
}%
\endgroup
}
\providecommand*{\indexgroup}[1]{%
\indexspace\textbf{#1}\nopagebreak
}
\providecommand*{\indexspace}{%
\def\indexspace{\vskip\baselineskip}
}
\providecommand*{\symbolsname}{Symbols}
\providecommand*{\numbersname}{Numbers}
\AtBeginDocument{%
\providecaptionname{english}\symbolsname{Symbols}%
\providecaptionname{english}\numbersname{Numbers}%
\providecaptionname{german}\symbolsname{Symbole}%
\providecaptionname{german}\numbersname{Zahlen}%
\providecaptionname{ngerman}\symbolsname{Symbole}%
\providecaptionname{ngerman}\numbersname{Zahlen}%
\providecaptionname{austrian}\symbolsname{Symbole}%
\providecaptionname{austrian}\numbersname{Zahlen}%
\providecaptionname{naustrian}\symbolsname{Symbole}%
\providecaptionname{naustrian}\numbersname{Zahlen}%
\providecaptionname{french}\symbolsname{Symbole}%
\providecaptionname{french}\numbersname{Chiffres}%
\providecaptionname{spanish}\symbolsname{Simbolos}%
\providecaptionname{spanish}\numbersname{N\'umeros}%
}
\providecommand*{\indexpagenumbers}[1]{%
\def\index@pagenumbersep{\let\index@pagenumbersep\indexpagenumbersep}%
\nobreakspace-- #1}
\providecommand*{\indexpagenumber}[1]{\index@pagenumbersep #1}
\providecommand*{\indexpagenumbersep}{, }
\endinput
%%
%% End of file `luaindex.sty'.
|