From b0b1eec080787a40ef4abe3eec0d79fcba29d423 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 2 May 2018 20:49:48 +0000 Subject: manyind (2may18) git-svn-id: svn://tug.org/texlive/trunk@47574 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/manyind/manyind.sty | 219 ++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/manyind/manyind.sty (limited to 'Master/texmf-dist/tex/latex/manyind') diff --git a/Master/texmf-dist/tex/latex/manyind/manyind.sty b/Master/texmf-dist/tex/latex/manyind/manyind.sty new file mode 100644 index 00000000000..e180d2eb9b8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/manyind/manyind.sty @@ -0,0 +1,219 @@ +% Package manyind.sty, Wilberd van der Kallen 2018. +% +% Variation on \usepackage[multind]{robustindex}, now without pagerefs in indexes. +% https://www.staff.science.uu.nl/~kalle101/mind.html +% +% Copyright 2018 Wilberd van der Kallen +% +% This file may be distributed 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. + + +\ProvidesPackage{manyind} + [2018/05/01 + many indexes] + +\RequirePackage{makeidx} + + +\AtBeginDocument{\def\ind@nr#1{\string\indnr\mindchoice d\gr@bltr#1-\relax b #1}% +\ifx\@@wrindex\undefined +\def\@wrindex#1{\@bsphack +\protected@write + \@indexfile {}{\string \indexentry + {\ind@nr#1 }{\thepage}}% + \endgroup +\@esphack}% +\else +\def\@wrindex#1{\@@wrindex\ind@nr#1||\\}% +\fi +\setindex{main}}% + +\AtEndDocument{% +\PackageWarning{manyind}{There are \the\c@mindexctr\space indexes. Did you run makeindex +recently?}% +}% + +\newcommand{\ind@nr}{\relax}% We prepend the argument of \index with a string used by +% makeindex for its lexicographic sorting. Thus it ends up in the ind file in a place +% based on which index is active and what the first letter of the index entry is. + +\newcommand{\@sindex}{\relax} + +\newcommand{\@@sindex}{\relax} + +\newcommand\sindex{\@ifnextchar[{\@sindex}{\@@sindex}}% + +\def\@sindex[#1]{\setindex{#1}\index} + +\def\@@sindex{\setindex{main}\index} + +\newcommand{\mind@prnt}{\relax} + +\newcommand{\mind@@prnt}{\relax} + +\newcommand{\mind@@@prnt}{\relax} + +\newcommand{\mind@@@@prnt}{\relax} + +\def\mind@@prnt[#1]{\setindex{#1}\mind@@@prnt} + +\let\mind@prnt\printindex + +\renewcommand{\printindex}{\@ifnextchar[{\mind@@prnt}{\mind@prnt}}% + +\renewcommand{\mind@@@prnt}{\@ifnextchar[{\mind@@@@prnt}{\mind@prnt}} + +\def\mind@@@@prnt[#1]{\renewcommand{\indexname}{#1}\mind@prnt} + +\newcommand{\indexpreamble}{\relax}% compare the preamble of makeindex + +\newcommand{\indexincontents}{% + \def\indexpreamble{% + \refstepcounter{subsection}% + % This creates a hyperlink destination. + % Compare phantomsection in hyperref. + % An index is not to be followed immediately by a subsection. + \addcontentsline{toc}% + {\ifx\c@chapter\undefined section\else chapter\fi}{\indexname}% + }% +}% + +\newcommand{\old@theindex}{}% + +\let\old@theindex\theindex + + +\def\theindex{% + \old@theindex + \indexpreamble +}% + +\newcommand{\mgobblepgeref}{\relax} + +\def\mgobblepgeref, #1 {} + +\newcommand{\gobblepageref}{\protect\mgobblepgeref} + +\newcommand{\gr@bltr}{\relax}% + +\def\gr@bltr#1#2\relax{\ifcat A#1\the\uccode`#1\else 60\fi}% to keep "a" and "A" together. + +% But first some code for embellishing an index. Our hacking brakes the insertion of +% \indexspace at appropriate places. We have to work hard to restore that. While we +% are at it, we may as well add the possibility to insert a letter T after the +% \indexspace that precedes the entries that start with t or T. +% First we describe the default style, that does not insert the T. +\newcommand{\indexcapstyle}[1]{\indexspace} +% To get the T one changes the style like this +% \renewcommand{\indexcapstyle}[1]{\indexspace\textbf{#1}\par}% + +\newcommand{\nxtletre}{\def\item{\letr@test}}% about next letter in alphabet + +\newcommand{\mindc@pitalhead}[1]{% Preparing for a heading; not printed. + \protected@write + \@indexfile {}{\string \indexentry + {\string\indnr \mindchoice d\gr@bltr#1\relax a #1@\protect\nxtletre + \protect\def\protect\nwletre{#1}\string\jmptonine}{9}}% +}% + +\newcommand{\capitals@inindex}[1]{% Will be called by \mnew@index with full alphabet. +\mfind@capitals#1\relax}% + +\newcommand{\mfind@capitals}{\relax}% + +\def\mfind@capitals#1#2\relax{% To deal with 26 letters. +\mindc@pitalhead #1% +\ifx\relax#2\relax +\else\mfind@capitals#2\relax +\fi}% + +\newcommand{\letr@test}{\relax}% To test if entry starts with new letter. + +\long\def\letr@test#1{\ifx#1\nxtletre\else\proc@letter{#1}\fi}% + +\newcommand{\proc@letter}{\relax}% + +\def\proc@letter#1{\long\def\item{\m@olditem}\ifx#1\relax\else\indexcapstyle{\nwletre}\fi +\ifx#1\indnr\expandafter\ja@\else #1\fi}% + +\newcommand{\m@olditem}{\relax}% + +\newcommand{\ja@}{\relax} + +\def\ja@#1 {\fi}% Mysterious. Seems necessary. + +% All this just to embellish an index. Now more support for multiple indexes. + +\newcommand{\setindex}[1]{% +\@bsphack +\expandafter\ifx\csname#1@rbstind\endcsname\relax + \mnew@index{#1}% +\else + \edef\mindchoice{\csname#1@rbstind\endcsname}% +\fi +\@esphack}% + +\newcounter{multindctr}% +\newcounter{mindexctr} +\newcommand{\mindcutpoint}{\relax}% +\newcommand{\untilmindcutpoint}{\relax}% +\newcommand{\mnew@index}{\relax}% +\newcommand{\mindchoice}{\relax}% +\newcommand{\indnr}{\relax}% + +\setcounter{multindctr}{999}% Fewer than 899 indexes expected. + +\long\def\untilmindcutpoint#1\mindcutpoint{\fi}% +% This tels the mouth of TeX not to send too much to the stomach. +% It should only forward the part that belongs to the active index. + +\def\indnr#1 {}% The \indnr part is used for sorting by makeindex and needs to be ignored + % by TeX thereafter. + +\newcommand\multindpreamble{\let\m@olditem\item}% +% \multindpreamble may serve as hook for further code. + +\newcommand{\jmptonine}{\relax}% + +\def\jmptonine#1 9{\relax} + +\def\mnew@index#1{\@bsphack +\ifx\@indexfile\undefined\PackageWarning{manyind}{% +Package needs \string\make index in preamble. Detected}\fi +\ifnum\c@multindctr=999% + \protected@write + \@indexfile {}{\string \indexentry + {\string\indnr 999b @\string\nxtletre + \string\mindcutpoint\string\jmptonine}{9}}% + \@esphack +\fi +\addtocounter{multindctr}{-1}% +\expandafter\edef\csname#1@rbstind\endcsname{\the\c@multindctr}% +\edef\mindchoice{\csname#1@rbstind\endcsname}% +\stepcounter{mindexctr} +\PackageInfo{manyind}{index #1 has number \mindchoice.}% +\@esphack +\protected@write + \@indexfile {}{\string \indexentry + {\string\indnr\the\c@multindctr d91a @\protect\nxtletre\protect\def + \protect\nwletre{\relax}\string\jmptonine +}{9}}% +\protected@write + \@indexfile {}{\string \indexentry + {\string\indnr\the\c@multindctr a @% + \string\mindcutpoint +\string\ifnum\string\mindchoice=\the\c@multindctr\string\multindpreamble +\string\else\string\untilmindcutpoint +\string\fi\string\jmptonine +}{9}}% +\capitals@inindex{ABCDEFGHIJKLMNOPQRSTUVWXYZ}% +\@esphack +}% + +\endinput + -- cgit v1.2.3