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/doc/latex/manyind/README.md | 21 ++ Master/texmf-dist/doc/latex/manyind/mind.html | 46 ++++ Master/texmf-dist/doc/latex/manyind/mindsample.pdf | Bin 0 -> 151815 bytes Master/texmf-dist/doc/latex/manyind/mindsample.tex | 251 +++++++++++++++++++++ Master/texmf-dist/tex/latex/manyind/manyind.sty | 219 ++++++++++++++++++ 5 files changed, 537 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/manyind/README.md create mode 100644 Master/texmf-dist/doc/latex/manyind/mind.html create mode 100644 Master/texmf-dist/doc/latex/manyind/mindsample.pdf create mode 100644 Master/texmf-dist/doc/latex/manyind/mindsample.tex create mode 100644 Master/texmf-dist/tex/latex/manyind/manyind.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/manyind/README.md b/Master/texmf-dist/doc/latex/manyind/README.md new file mode 100644 index 00000000000..9ce930daa6f --- /dev/null +++ b/Master/texmf-dist/doc/latex/manyind/README.md @@ -0,0 +1,21 @@ +Package manyind.sty, Wilberd van der Kallen 2018. +Date of last change of _anything_ in the bundle 2018/05/01 + + This package provides support for many indexes, leaving all the bookkeeping to LaTeX and + makeindex. No extra programs or files are needed. One runs latex and makeindex as if + there is just one index. In the main file one puts commands like \setindex{main} to + steer the flow. + + Some features of makeindex may no longer work. + + [Home page of package](https://www.staff.science.uu.nl/~kalle101/mind.html) + + + Copyright 2018 Wilberd van der Kallen + + This package 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 + [lpp.txt](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. diff --git a/Master/texmf-dist/doc/latex/manyind/mind.html b/Master/texmf-dist/doc/latex/manyind/mind.html new file mode 100644 index 00000000000..680c3c023d3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/manyind/mind.html @@ -0,0 +1,46 @@ + + +manyind package for LaTeX + + + +

manyind package for many indexes in LaTeX

+ + +

Just run latex and makeindex as if there is one index only

+ The package +manyind.sty (version 2018/05/01) + provides support for many indexes, leaving all the bookkeeping to LaTeX and makeindex. + No extra programs or files are needed. One runs latex and makeindex as if there is + just one index. In the main file one puts commands like + \setindex{main} + to steer the flow. + + Some features of makeindex may no longer work. + + +

The sample file mindsample.tex +explains and illustrates the usage. + +

After the old fashioned +

+
pdflatex mindsample.tex +
makeindex mindsample +
pdflatex mindsample.tex +
pdflatex mindsample.tex +
+you should have something like this PDF file. + +

If you want several indexes with pagerefs you may try + \usepackage[multind]{robustindex} instead. + See Home page of + robustindex.sty + +
+ +


+Wilberd van der Kallen + + + + diff --git a/Master/texmf-dist/doc/latex/manyind/mindsample.pdf b/Master/texmf-dist/doc/latex/manyind/mindsample.pdf new file mode 100644 index 00000000000..23326abb845 Binary files /dev/null and b/Master/texmf-dist/doc/latex/manyind/mindsample.pdf differ diff --git a/Master/texmf-dist/doc/latex/manyind/mindsample.tex b/Master/texmf-dist/doc/latex/manyind/mindsample.tex new file mode 100644 index 00000000000..9e3d674f75c --- /dev/null +++ b/Master/texmf-dist/doc/latex/manyind/mindsample.tex @@ -0,0 +1,251 @@ +% mindsample.tex 2018/04/29 +\documentclass{book} + +\usepackage{manyind} +\usepackage[plainpages=false,colorlinks=true]{hyperref} + +\title {Package manyind provides support for many indexes} + + +\author{Wilberd van der Kallen\index{Wilberd}} +\date{April 2018} + +\makeindex % obligatory with manyindex + +\begin{document} + +\renewcommand\thepage{\roman{page}} +\index{z}% ends up in index main. + + +\setindex{b1} + +\maketitle % So Wilberd will end up in index b1. + +\tableofcontents +\addcontentsline{toc}{chapter}{Contents} + + +\chapter*{Preface} + +\addcontentsline{toc}{chapter}{Preface} +\markboth{Preface}{Preface} +This file illustrates some features of the \verb!manyind! package. +One runs latex and makeindex as if there is just one index. No extra programs are required. +We let makeindex and \TeX\ do the work. As we are using makeindex in a way that was never intended, +some features of makeindex may not work anymore. + + Although this is not a book, we have chosen the book style for illustration. +Let us say we want to use four indexes. First we choose tags to identify them. +In this file we use the tags \verb|main|, \verb|bis|, \verb|a1|, \verb|b1|. +With the \verb!\setindex! command we activate an index. +Thus \verb!\setindex{main}! (no spaces!) tells \LaTeX\ that the active index is now the index identified by the tag +\verb|main|, until the next \verb!\setindex! command. If a tag has not been encountered +before, then a new index with that tag is created. +The tag \verb|main| is always known and +the index with tag \verb|main| becomes active at the \verb|\begin{document}|. +The \verb!\index! command and +the \verb|\printindex| commands write to/from the active index.\\ + +After running latex on {\it filename}.\verb!tex! one must run makeindex on {\it +filename} to get the index entries in {\it filename}.\texttt{ind}. +Before this there may be warnings about labels or names. +Do not exclude any relevant files. For instance, do not use +\verb|\includeonly|. + +(A tool like pdflatexmk in TeXShop on the MAC will call makeindex for you.)\\ + +If you wish you may use \verb!\sindex[bis]{!\emph{entry}\verb!}! as shorthand for\\ + +\hspace{5em} \verb!\setindex{bis}\index{!\emph{entry}\verb!}!\\ + +and \verb!\sindex{!\emph{entry}\verb!}! as shorthand for\\ + + \hspace{5em} \verb!\setindex{main}\index{!\emph{entry}\verb!}!.\\ + + One may give (at most) two optional arguments to \verb|\printindex|. +\noindent While + + \verb|\printindex| + +\noindent prints the active index, + + \verb|\printindex[b1]| + +\noindent first makes \verb|b1| the active index. + And + + \verb|\printindex[b1][Index with tag b1]| + + \noindent also first does a + \verb|\renewcommand{\indexname}{Index with tag b1}|. + + +To see how package \verb|manyind| may be used, you may also compare the file +\verb|mindsample.tex| with the output. + +This preface has an \emph{indexed term}.\setindex{b1}\index{indexed term} + (You see this in the source file only.) + +\chapter{Introduction}\sloppy +\renewcommand\thepage{\arabic{page}} +\addtocounter{page}{-6}% Just to get overlap in roman and arabic page numbers. +This introduction has another indexed term +\setindex{a1} +\index{other term!cited twice on same page}% +as well as the old indexed term.\setindex{b1}\index{indexed term}% will appear in an automatic page range +The page number is \thepage, but now in arabic. +If you index the same term twice on the same page, then it gets listed only once. + +We have hacked various mechanisms of makeindex. +Subentries are still supported. We illustrate this in +\verb|mindsample.tex| and appendix \ref{appendix} with alpha, beta and gamma (output on page \pageref{range}). +This also illustrates the use of \verb|\gobblepageref|, a variant of \verb!\see!. + +The package \verb|manyind| + is similar to option \verb!multind! of package \verb|robustindex|, but it does not + put any \verb|\pageref| in an index. Therefore it does not have to disable the automatic page range mechanism of makeindex. + +The index file {\it filename}.\texttt{ind} has become quite unreadable. Do not edit it. +Use the package \verb!manyind! only if you are willing to keep the indexes standard. + + +\setindex{a1}\index{alpha!see beta} +\index{alpha!see also gamma\gobblepageref} + +\newpage +\setindex{b1}\index{indexed term}% will appear in an automatic page range + +\setindex{b1}\index{page range!risky@this $\vert$is$\vert$ complicated|(textbf}% +\index{page range|(textit}% +\index{page range!risky@this $\vert$is$\vert$ complicated|textbf}% +\index{page range!risky@this $\vert$is$\vert$ complicated|textbf}% +\index{page range!risky@this $\vert$is$\vert$ complicated|textbf}% +% +\index{simpler!page range|(}% +\index{simplest page range|(}% +\setindex{b1}\index{indexed term}% will appear in an automatic page range +\appendix +\setindex{b1}\index{indexed term}% will appear in an automatic page range +\chapter{Structure of the \LaTeX\ file}\label{appendix} +\setindex{b1}\index{indexed term}% will appear in an automatic page range +\begin{verbatim} +\documentclass{book} + +\usepackage{manyind} +\usepackage[plainpages=false,colorlinks=true]{hyperref} + +... +...\author{Wilberd van der Kallen\index{Wilberd}} +... +\makeindex % obligatory with manyind + +\begin{document} +... +\tableofcontents +...\index{indexed term} % on page vi +... +...\index{other term!cited twice on same page} % on page 1 +...\index{indexed term} % on page 1 +...\index{other term!cited twice on same page} % on page 1 +... +\setindex{a1}\index{alpha!see beta} % on page 1 +\index{alpha!see also gamma\gobblepageref} % on page 1 +... +\indexincontents % before the indexes. +\setindex{main} +\printindex +... +\renewcommand{\indexcapstyle}[1]{\indexspace\textsc{#1}\par} +\printindex[main][Index with headings] +\end{document} +\end{verbatim} + +\setindex{b1}\index{indexed term}% will appear in an automatic page range + +\sindex{as! t@is} + +\index{tris} + +\setindex{main}\index{alpha} + +\setindex{a1}\index{gamma} + +\setindex{bis}\index{bis} + +\setindex{main}\index{delta!vardelta} + + +\setindex{main}\index{animal!than@fish} + + +\setindex{main}\index{time!here@now} + + +\setindex{b1}\index{page range!risky@this $\vert$is$\vert$ complicated|)textbf} + + +\index{page range|)textit}% + +\sindex[b1]{page range!risky@this $\vert$is$\vert$ complicated|textbf} + +% +\setindex{a1}\index{page range!with risky label\label{range}} +% This label actually works and was used above in a \pageref{range} command. +% +\sindex[b1]{simpler!page range|)}% +\index{simplest page range|)}% + + +% If you want the index in the table of contents, you may do +% +% \clearpage +% \phantomsection +% \addcontentsline{toc}{chapter}{\indexname} +% +% We have a command for this: + +\indexincontents % before \printindex + + + +\renewcommand{\indexname}{Index} +\setindex{main} +\printindex + +\renewcommand{\indexname}{Index bis} +\setindex{bis} +\printindex + + +\renewcommand{\indexname}{Index with tag a1} +\setindex{a1} +\printindex + + +\renewcommand{\indexname}{Index with tag b1} +\setindex{b1} +\printindex +\subsection*{Embellishment} +The command \verb!\indexcapstyle! +takes one argument. Its original definition is \verb!\newcommand{\indexcapstyle}[1]{\indexspace}!. + +One may embellish an index with letter headings, like this.\\ + +\setindex{main}\index{animal!ruminant!cow} + + +\verb!\renewcommand{\indexcapstyle}[1]{\indexspace\textsc{#1}\par}!% + + +\verb!\printindex[main][Index with headings]! \\ + +\noindent This gives + + + +\renewcommand{\indexcapstyle}[1]{\indexspace\textsc{#1}\par} +\printindex[main][Index with headings] + + +\end{document} 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