From b4b129826b2fdb5a82d1c405d558dda7cfafaf4f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 13 Jan 2006 00:07:32 +0000 Subject: splitindex git-svn-id: svn://tug.org/texlive/trunk@1339 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/splitindex/splitidx.sty | 291 +++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/splitindex/splitidx.sty diff --git a/Master/texmf-dist/tex/latex/splitindex/splitidx.sty b/Master/texmf-dist/tex/latex/splitindex/splitidx.sty new file mode 100644 index 00000000000..4ea875ca961 --- /dev/null +++ b/Master/texmf-dist/tex/latex/splitindex/splitidx.sty @@ -0,0 +1,291 @@ +%% +%% This is file `splitidx.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% splitidx.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (c) Markus Kohm, 2002 +%% +%% This file was generated from file(s) of the `SplitIndex bundle'. +%% ---------------------------------------------------------------- +%% +%% It may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 of this +%% license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This file may only be distributed together with a copy of the +%% `SplitIndex bundle'. You may however distribute the `SpitIndex +%% bundle' without such generated files. +%% +%% The list of all files belonging to the `SplitIndex bundle' is +%% given in the file `manifest.txt'. +%% +\ProvidesPackage{splitidx}[% + 2003/01/05 v0.2a multiple indices for LaTeX] +\DeclareOption{makeindex}{\AtEndOfPackage{\makeindex}} +\DeclareOption{allatone}{% + \AtEndOfPackage{% + \renewcommand*{\sindex}[1][]{\index}% + \g@addto@macro\makeindex{\renewcommand*{\sindex}[1][]{\index}}% + }% +} +\newif\if@newidxcmd\@newidxcmdfalse +\DeclareOption{idxcommands}{\@newidxcmdtrue} +\newif\if@splitidx\@splitidxfalse +\DeclareOption{split}{\@splitidxtrue} +\ProcessOptions\relax +\newcommand*\see[2]{\emph{\seename} #1} +\providecommand*\seealso[2]{\emph{\alsoname} #1} +\providecommand\seename{see} +\providecommand*\alsoname{see also} +\newcommand*{\sindex}[2][]{% +} +\g@addto@macro\makeindex{% + \renewcommand*{\sindex}{% + \@bsphack\begingroup + \@sanitize + \@wrsindex + }% + \typeout{Using splitted index at \jobname.idx}% +} +\newcommand*{\@wrsindex}[2][]{% + \ifx\relax#1\relax + \if@splitidx + \@wrsindex[idx]{#2}% + \else + \@wrindex{#2}% + \fi + \else + \expandafter\ifx\csname @@wrsindex\endcsname\relax + \@@@wrsindex{#1}{{#2}{\thepage}}% + \else + \@@wrsindex{#1}#2||\\% + \fi + \endgroup + \@esphack + \fi +} +\newcommand*{\@@@wrsindex}[2]{% + \begingroup + \if@splitidx + \expandafter\ifx\csname @indexfile@#1\endcsname\relax + \PackageError{splitidx}{% + Index entry for not existing index% + }{% + You've tried to set an index to index `#1', without + defining\MessageBreak + that index before using \string\newindex.\MessageBreak + This is only allowed, if you are not using package option + `split'.% + }% + \else + \expandafter\protected@write\csname @indexfile@#1\endcsname{}{% + \string\indexentry#2% + }% + \fi + \else + \protected@write\@indexfile{}{% + \string\indexentry[#1]#2% + }% + \fi + \endgroup +} +\AtBeginDocument{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname ifHy@hyperindex\endcsname\relax + \else + \csname ifHy@hyperindex\endcsname + \expandafter\ifx\csname @@wrsindex\endcsname\relax + \def\@@wrsindex#1#2|#3|#4\\{% + \ifx\\#3\\% + \@@@wrsindex{#1}{{#2|hyperpage}{\thepage}}% + \else + \def\Hy@temp@A{#3}% + \ifx\Hy@temp@A\HyInd@ParenLeft + \@@@wrsindex{#1}{{#2|#3hyperpage}{\thepage}}% + \else + \ifx\Hy@temp@A\HyInd@ParenRight + \@@@wrsindex{#1}{{#2|#3hyperpage}{\thepage}}% + \else + \@@@wrsindex{#1}{{#2|#3}{\thepage}}% + \fi + \fi + \fi + }% + \fi + \csname fi\endcsname + \fi +} +\newcommand*{\printindex}{% + \@ifstar {% + \begingroup + \let\printindex@@endhook=\printindex@endhook + \let\printindex@endhook=\relax + \printindices% + \csname printindex@@endhook\endcsname + \endgroup + }{% + \@ifnextchar [\@printindex%] brace check comment + {% + \@input@{\jobname.ind}% + \csname printindex@endhook\endcsname + }% + }% +} +\newcommand*{\@printindex}{} +\def\@printindex[#1]{% + \@ifnextchar [% + {\@@printindex[{#1}]}% + {\@@printindex[{#1}][\csname index@#1@name\endcsname]}% +} +\newcommand*{\@@printindex}{} +\def\@@printindex[#1][#2]{% + \begingroup + \edef\indexshortcut{#1}% + \def\indexname{#2}% + \let\index@preamble\relax + \expandafter\let\expandafter\index@preamble + \csname index@\indexshortcut @preamble\endcsname + \if@splitidx + \def\@tempa{idx}\def\@tempb{#1}% + \ifx\@tempa\@tempb\let\@indexsuffix\@gobble\fi + \fi + \@input@{\jobname\@indexsuffix{#1}.ind}% + \endgroup + \csname printindex@endhook\endcsname +} +\begingroup +\catcode`\-12 +\lowercase{\endgroup + \newcommand*{\@indexsuffix}[1]{-#1}% +} +\newcommand*{\printindices}{% + \ifx\@indices\@empty + \printindex + \else + \begingroup + \@for\@tempa:=\@indices\do{% + \expandafter\printindex\expandafter[\@tempa]% + }% + \endgroup + \fi +} +\newcommand*{\newindex}[2][\relax]{% + \@ifundefined{index@#2@name}{% + \ifx\@indices\@empty + \xdef\@indices{#2}% + \else + \xdef\@indices{\@indices,#2}% + \fi + \ifx \relax#1 + \expandafter\xdef\csname index@#2@name\endcsname{#2}% + \else + \expandafter\xdef\csname index@#2@name\endcsname{#1}% + \fi + \if@newidxcmd + \expandafter\newcommand\expandafter*\csname #2\endcsname{% + \sindex[#2]% + }% + \fi + \if@splitidx + \def\@tempa{#2}\def\@tempb{idx}% + \ifx\@tempa\@tempb + \let\@indexfile@idx=\@indexfile + \else + \expandafter\newwrite\csname @indexfile@#2\endcsname + \expandafter\immediate\expandafter\openout + \csname @indexfile@#2\endcsname=\jobname-#2.idx + \fi + \fi + }{% + \PackageError{splitidx}{% + index `#2' already defined% + }{% + You have already defined an index with shortcut `#2'.\MessageBreak + You can't define a new index with the same shortcut. If you'll continue + \MessageBreak + The new definition will be ignored.% + }% + }% +} +\if@splitidx + \@onlypreamble\newindex +\fi +\newcommand*{\@indices}{} +\gdef\@indices{} +\newcommand{\extendtheindex}[4]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname splitindex@theindex\endcsname\relax + \let\splitindex@theindex=\theindex + \let\endsplitindex@theindex=\endtheindex + \fi + \renewcommand*{\theindex}{% + #1\splitindex@theindex #2% + }% + \renewcommand*{\endtheindex}{% + #3\endsplitindex@theindex #4% + }% +} +\newcommand{\splitindex@setip}{} +\let\splitindex@setip\setindexpreamble +\let\setindexpreamble\relax +\newcommand{\setindexpreamble}[2][]{% + \ifx \relax#1\relax + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname splitindex@setip\endcsname\relax + \@namedef{index@preamble}{#2}% + \else + \splitindex@setip{#2}% + \fi + \else + \@namedef{index@#1@preamble}{#2}% + \fi +} +\newcommand{\useindexpreamble}[1][]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname index@preamble\endcsname\relax\else + \ifx\index@preamble\@empty\else + \index@preamble #1% + \fi + \fi +} +\newcommand*{\printsubindex}{% + \begingroup + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname chapter\endcsname\relax + \let\section\subsection + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname addsec\endcsname\relax\else + \def\addsec{\setcounter{secnumdepth}{0}\subsection}% + \fi + \else + \let\chapter\section + \def\@makeschapterhead{\section*} + \let\@makechapterhead\section + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname addchap\endcsname\relax\else + \let\addchap\addsec + \fi + \fi + \let\onecolumn\@firstoptofone + \let\twocolumn\@firstoptofone + \let\clearpage\relax + \let\cleardoublepage\relax + \def\markboth{\expandafter\markright\@gobble}% + \ifx\@mkboth\@gobble\else\let\@mkboth\markboth\fi + \let\thispagestyle\@gobble + \let\printindex@endhook=\endgroup + \printindex +} +\providecommand{\@firstoptofone}[1][]{#1} +\endinput +%% +%% End of file `splitidx.sty'. -- cgit v1.2.3