diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty | 247 |
1 files changed, 247 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..01ad7ddf926 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/luaindex/luaindex.sty @@ -0,0 +1,247 @@ +%% +%% 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 and of this work. +%% +%% 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/09 v0.1a 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 +\directlua{dofile("luaindex.lua")} +\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{koma.luaindex.newindex("\luatexluaescapestring{#2}")}% + \begingroup + \setupluaindex{#1}% + \ifx\luaindex@sortorder\@empty\else + \AtBeginDocument{% + \protected@write\@indexfile{}{% + koma.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}{% + koma.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}{% + koma.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}{% + koma.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{% + koma.luaindex.removeentries("\luatexluaescapestring{\luaindex@name}") + dofile("\jobname.ldx") + }% + \fi + \directlua{% + koma.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'. |