summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luaindex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-16 18:50:17 +0000
committerKarl Berry <karl@freefriends.org>2011-08-16 18:50:17 +0000
commiteda19491f745bdb010a90467848a14149d12c0fa (patch)
tree66de8d03cdfcd3ac5aaf7c2204aad1cdd27d1ae1 /Master/texmf-dist/tex/lualatex/luaindex
parente8ad316b194c9af5548184fe1c57929fd93a350f (diff)
try luaindex again
git-svn-id: svn://tug.org/texlive/trunk@23577 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/luaindex')
-rw-r--r--Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty270
1 files changed, 270 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty b/Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty
new file mode 100644
index 00000000000..360bb2a5f45
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty
@@ -0,0 +1,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'.