texlive[45185] Master/texmf-dist: robustindex (31aug17)

commits+karl at tug.org commits+karl at tug.org
Fri Sep 1 03:32:23 CEST 2017


Revision: 45185
          http://tug.org/svn/texlive?view=revision&revision=45185
Author:   karl
Date:     2017-09-01 03:32:22 +0200 (Fri, 01 Sep 2017)
Log Message:
-----------
robustindex (31aug17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.pdf
    trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.tex
    trunk/Master/texmf-dist/tex/latex/robustindex/robustindex.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/robustindex/README.md
    trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf
    trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.tex
    trunk/Master/texmf-dist/doc/latex/robustindex/stind.html

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/robustindex/README
    trunk/Master/texmf-dist/doc/latex/robustindex/robustindex.html

Deleted: trunk/Master/texmf-dist/doc/latex/robustindex/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/README	2017-09-01 01:31:58 UTC (rev 45184)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/README	2017-09-01 01:32:22 UTC (rev 45185)
@@ -1,45 +0,0 @@
- Package robustindex.sty, Wilberd van der Kallen Feb 2005.
- http://www.math.uu.nl/people/vdkallen/stind.html
-
- This package addresses two issues.
-
- 1. Third parties often change the page numbers without rerunning makeindex.
- (Yes, it happened also to my 1993 book.)
-
- One would like to make the page numbers in the index entries more robust.
- We use the \pageref mechanism for that. Only after adding, deleting or
- otherwise modifying an \index{entry}, or after changing the order of the
- index entries, does one have to rerun makeindex.
- Other changes do not matter, as long as one runs LaTeX or pdflatex twice.
-
- 2. The theindex environment does not create a hyperref destination.
-
- Therefore we introduce \indexincontents.
- It does what \addcontentsline{toc}{chapter}{Index} or
- \addcontentsline{toc}{section}{Index} should have done in the first place:
- When one clicks on the link that displays the word Index, one actually ends
- up in the index.
-
- Our package performs no miracles. But in simple situations all you need is
- adding the \usepackage{robustindex} to the preamble.
-
- The implicit page range formation of makeindex is disabled.
- Commands of the type \index{entry|editing command} are supported,
- but much more naively than in the encapsulating mechanism of makeindex.
-
- If you use hyperref, choose the option hyperindex=false, because our method
- to set up these hyperlinked indices is different.
- We tested a little with
-
- \usepackage[plainpages=false,hyperindex=false]{hyperref}
-
- See robustsample.tex for more details and illustrations.
-
- There you find examples like
-
- \index{alpha!see beta}
- \index{alpha!see also gamma\gobblepageref}
-
- \indexincontents % always put this before the index.
-
- See also robustglossary.sty

Added: trunk/Master/texmf-dist/doc/latex/robustindex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/README.md	2017-09-01 01:32:22 UTC (rev 45185)
@@ -0,0 +1,18 @@
+Package robustindex.sty, Wilberd van der Kallen Feb 2017.
+ 
+ This package uses \pageref to ensure that the page numbers in the index are synchronous 
+ with the manuscript, even when a third party changes the page numbers and fails to
+ rerun makeindex.
+ 
+ Some features of makeindex had to be disabled.
+ 
+ https://www.staff.science.uu.nl/~kalle101/stind.html
+ 
+% Copyright 2005, 2017 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.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/robustindex/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/robustindex/robustindex.html
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/robustindex.html	2017-09-01 01:31:58 UTC (rev 45184)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/robustindex.html	2017-09-01 01:32:22 UTC (rev 45185)
@@ -1,43 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Robust index package for LaTeX</TITLE>
-</HEAD>
-
-<BODY bgcolor="#FFFFFF">
-<H1><A NAME="top">Robust index package for LaTeX</A></H1>
-
-We are experimenting with a package 
-<A HREF="robustindex.sty">robustindex.sty</A>
-that tries to remedy two problems.
-<DL>
-<DD><H2>Page numbers changed by third party without rerunning makeindex</H2>
-Amazingly often a third party changes the page numbers without rerunning
-makeindex. (Yes, it happened also to my 1993 book.)
-<P>It is much nicer to have an index that adapts itself to all
-changes but the adding/deleting of an \index{entry} command.
-<P>Only after such adding and/or deleting do we want to run makeindex.
-<DD><H2>Index contains no destination for hyperlink</H2>
-The theindex environment lacks a destination for hyperlinks. 
-That is a nuisance when one wants to add the index to
-the bookmarks or to the table of contents in a pdf file.
-</DL>
-
-We have packages <A HREF="robustindex.sty">robustindex.sty</A> and
- <A HREF="robustglossary.sty">robustglossary.sty</A>. They are used in
- the sample file <A HREF="robustsample.tex">robustsample.tex</A>.
-<P>After
-<DL>
-<DD>pdflatex <A HREF="robustsample.tex">robustsample.tex</A>
-<DD>pdflatex robustsample.tex
-<DD>makeindex robustsample
-<DD>pdflatex robustsample.tex
-<DD>pdflatex robustsample.tex
-</DL>
-you should have something like <A HREF="robustsample.pdf">this PDF file</A>.
-
-<BR><BR><BR>
-<A HREF="http://www.math.uu.nl/people/vdkallen/">Wilberd van der Kallen</A> 
-
-
-</BODY>
-</HTML>

Added: trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf	2017-09-01 01:31:58 UTC (rev 45184)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf	2017-09-01 01:32:22 UTC (rev 45185)

Property changes on: trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.tex	2017-09-01 01:32:22 UTC (rev 45185)
@@ -0,0 +1,105 @@
+% robustmanual.tex
+\documentclass{article}
+\usepackage{makeidx}
+\usepackage{robustindex}
+\usepackage[hyperindex=false]{hyperref}
+
+\title {Manual of robustindex package}
+
+\author{Wilberd van der Kallen\index{Wilberd}}
+\date{2017}
+
+\makeindex    % obligatory with robustindex
+
+\begin{document}
+
+\maketitle
+
+\section*{Introduction}
+
+\index{discussion|(}
+
+Amazingly often a third party changes the page numbers without rerunning
+makeindex. We therefore want to have an index in which the page numbers automatically synchronise with the document.
+
+The package \texttt{robustindex} achieves this
+by invoking the \verb|\pageref| mechanism on automatically generated labels
+of the form \verb|ind.2|, \verb|ind.4|, \dots.
+
+Only after adding/deleting/modifying an \verb|\index{|\textit{entry}\verb|}|
+command, or after changing the order of \verb|\index{|\textit{entry}\verb|}|
+commands, does one have to rerun makeindex. (How would you change the order? By moving a block of text that contains 
+an \verb!\index! command.)
+
+Make sure to run makeindex at least once after the last change to the \verb!\index! commands.
+Keep an eye on the \TeX\ log file. It often contains a warning that you  need to rerun \LaTeX\ or makeindex. 
+
+\section*{Standard usage}
+Put 
+$$
+\verb!\usepackage{makeidx}! 
+$$
+$$
+\verb!\usepackage{robustindex}! 
+$$
+$$\verb!\makeindex!$$
+in your preamble.
+If you use the hyperref package, go against their advice and put 
+$$\verb!\usepackage{robustindex}! $$
+\emph{after} the hyperref declaration, \emph{or} 
+turn off \verb!hyperindex! as in 
+$$
+\verb!\usepackage[plainpages=false,hyperindex=false]{hyperref}!.
+$$
+
+That should be all. (You may have to trash old auxiliary files.)
+
+You can now use \index{alpha}\index{gamma|textbf}
+$$\verb!\index{alpha}!$$
+$$\verb?\index{alpha!see beta}?$$
+$$\verb!\index{gamma|textbf}!$$
+$$\verb!\index{ampersand@\&|textbf}!$$
+in the usual manner. 
+\index{ampersand@\&|textbf}
+
+See \url{https://en.wikibooks.org/wiki/LaTeX/Indexing}.\\
+
+
+
+The symbol \verb!|!  has a special meaning inside an \verb!\index! command and cannot be escaped.
+To get \verb!|! as output use the \LaTeX\ command \verb!\vert!.
+
+
+We also have a command \verb!\gobblepageref!
+used as in 
+$$\verb?\index{alpha!see also gamma\gobblepageref}?$$
+\index{alpha!see also gamma\gobblepageref}
+
+\subsection*{Page ranges}
+Some features of makeindex had to be repurposed.
+In particular, \emph{implicit} page ranges are no longer supported. 
+
+
+If you want a page range in the index you have to use 
+the \emph{explicit} page range mechanism of makeindex as in
+$$\verb!\index{discussion|(}!$$% used above
+
+%\index{discussion}% inside range, hence would be suppressed.
+
+%\index{discussion|blah}% inside range, hence would be suppressed.
+
+
+
+
+on the first page of the range, followed by
+$$\verb!\index{discussion|)}!$$\index{discussion|)}on the last page of the range.\\
+
+\subsection*{Table of contents}
+If there is a table of contents and you want the index listed in it, put the command
+$$\verb!\indexincontents!$$
+somewhere before the \verb!\printindex!.
+\index{alpha!see beta}
+
+We now use $\verb!\printindex!$ to get an index (on a new page).
+\printindex
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/robustindex/robustmanual.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.tex	2017-09-01 01:31:58 UTC (rev 45184)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/robustsample.tex	2017-09-01 01:32:22 UTC (rev 45185)
@@ -25,18 +25,21 @@
 \chapter*{Preface}
 \addcontentsline{toc}{chapter}{Preface}
 \markboth{Preface}{Preface}
+This file illustrates some features of the \verb!robustindex! package.
+
+Although this is not a book, we have chosen the book style for illustration.
+
 We will recall the purpose of  \verb|robustindex.sty| in appendix
 \ref{purpose}.
 
-Although this is not a book, we have chosen the book style for illustration.
 
 If you want to see how \verb|robustindex.sty| may be used, compare the file
 \verb|robustsample.tex| or appendix \ref{appendix} with the output.
 
 If you are interested in our usage of \verb|robustglossary.sty|, you must read
-the file \verb|robustsample.tex|.
+the source file \verb|robustsample.tex|.
 
-This preface has an \emph{indexed term}.\index{indexed term}
+This preface has an \emph{indexed term}.\index{indexed term} (You see this in the source file only.)
 
 % Let us pretend this page explains $\mathrm{Ext}^i_B(M,N)$.
 \glossary{$\mathrm{Ext}^i_B(M,N)$&Ext group in the category $\mathcal C_B$}
@@ -60,6 +63,7 @@
 may be edited to remedy such flaws. Such editing will actually be the
 recommended way to achieve more complicated effects like the page ranges on
 page \pageref{range}, which also use several fonts in their page numbers.
+That is actually bad style, but this file just illustrates features.
 
 Traditionally page ranges and fonts for page numbers could be done with the
 encapsulating construction of makeindex, but that construction is broken by our
@@ -66,7 +70,8 @@
 package.
 (The encapsulating construction uses the encap character $|$ in the argument of
 \verb|\index|.)
-We have restored it to some extent, sufficient for common practice,
+
+We have restored encapsulating to some extent, sufficient for common practice,
 but our rules are more naive than those of makeindex.
 See the file \verb|robustsample.tex| for details.
 
@@ -112,9 +117,9 @@
 % 2. One of the brackets "(" or ")", or one of those brackets followed by
 % a sequence as in type 1.
 % Any "(" must be matched by its ")", and this ")" must occur in a later
-% \index command that shares the part before the "|". No intervening \index
-% command may have this same part before the "|".
-% So here we deviate from makeindex.
+% \index command that shares the part before the "|". 
+% If an intervening \index command has this same part before the "|",
+% then it does not appear in the index.
 %
 % Makeindex also attaches special meanings to @, !, ". These meanings stay,
 % but " can no longer be used to escape |. One must simply replace | with
@@ -126,10 +131,17 @@
 % The name "risky" of the subentry is used for sorting by makeindex, and will
 % not be printed.
 %
+%
 \index{page range|(textbf}%
-% This belongs to the entry "page range". The previous
+% This belongs to the entry "page range" in the index. The previous
 % \index command started a subentry of this entry.
 %
+% The next three index commands do not contribute, as they occur 
+% before the page range is ended.
+\index{page range!risky at this $\vert$is$\vert$ complicated|textbf}%
+\index{page range!risky at this $\vert$is$\vert$ complicated}%
+\index{page range!risky at this $\vert$is$\vert$ complicated|textbf}%
+%
 \index{simpler!page range|(}%
 \index{simplest page range|(}%
 % encapsulating to be continued below
@@ -142,7 +154,7 @@
 \usepackage{makeidx}
 \usepackage{robustindex}
 ...
-...\index{Wilberd}}                              % on page i
+...\author{Wilberd van der Kallen\index{Wilberd}} 
 ...
 \makeindex    % obligatory with robustindex
 
@@ -158,12 +170,12 @@
 \index{alpha!see also gamma\gobblepageref}       % on page 5
 ...
 % For special effects you could simply edit filename.ind
-% If you insist on using encapsulation,...
-\index{...|...}...                               % on page 5
+% We illustrate our poor man's encapsulation.
+\index{...|...}...                               % on page 6
 \index{...|...}...                               % on page 7
 \index{...|...}...                               % on page 9
 ....
-\indexincontents % always put this before the index.
+\indexincontents %  before the index.
 \printindex
 
 \end{document}
@@ -170,14 +182,13 @@
 \end{verbatim}
 
 % continuation of encapsulating
-%
+% We close a page range, but now the page number is in italic.
+% This is bad style, but we are just illustrating a feature.
 \index{page range!risky at this $\vert$is$\vert$ complicated|)textit}
 % encapsulating to be continued below
 
 \chapter{Purpose of \texttt{robustindex.sty}}\label{purpose}
-The package \texttt{robustindex} tries to remedy two problems.
-\begin{itemize}
-\item Amazingly often a third party changes the page numbers without rerunning
+Amazingly often a third party changes the page numbers without rerunning
 makeindex. It is much nicer to have an index that adapts itself to all
 changes that do not involve
 \verb|\index{|\textit{entry}\verb|}| commands.
@@ -191,11 +202,6 @@
 commands, does one have to run makeindex. But then it is important that you
 do run makeindex, even when no warning is issued. The robustness has its
 limits.
-\item The \texttt{theindex} environment lacks a destination for hyperlinks.
-That is a nuisance when one wants add the index to
-the bookmarks or to the table of contents in a pdf file: When one clicks on the
-link that displays the word Index, one wants to end up in the index.
-\end{itemize}
 
 % continuation of encapsulating
 %
@@ -203,8 +209,8 @@
 \index{page range!risky at this $\vert$is$\vert$ complicated|texttt}
 %
 \index{page range!with risky label\label{range}}
+% This label actually works and was used above in a \pageref{range} command.
 %
-%
 \index{simpler!page range|)}%
 \index{simplest page range|)}%
 % end of encapsulating
@@ -255,6 +261,14 @@
 
 \end{theglossary}
 
-\indexincontents % always put this before the index.
+% 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
 \printindex
 \end{document}

Added: trunk/Master/texmf-dist/doc/latex/robustindex/stind.html
===================================================================
--- trunk/Master/texmf-dist/doc/latex/robustindex/stind.html	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/robustindex/stind.html	2017-09-01 01:32:22 UTC (rev 45185)
@@ -0,0 +1,46 @@
+<HTML>
+<HEAD>
+<TITLE>Robust index package for LaTeX</TITLE>
+</HEAD>
+
+<BODY>
+<H1><A NAME="top">Robust index package for LaTeX</A></H1>
+
+
+<H2>Page numbers changed by third party without rerunning makeindex</H2>
+Amazingly often the page numbers in index entries are wrong because
+a third party has changed the numbering of pages
+without rerunning makeindex. (Yes, it happened also to my 1993 book.)
+<P>It is much nicer to have an index that adapts itself to all
+changes but the adding/deleting/rearranging of \index commands.
+<P>Our package
+<A HREF="robustindex.sty">robustindex.sty</A>
+achieves this with the \pageref mechanism.
+<P>
+Here is our <A HREF="robustmanual.pdf">Manual for the robustindex package</A>.
+<P>Just try what happens if you put
+\usepackage{robustindex} in your preamble. Do read your TeX log file.
+
+<P>The sample file <A HREF="robustsample.tex">robustsample.tex</A>
+illustrates more than you ever need.
+It also requires the package
+ <A HREF="robustglossary.sty">robustglossary.sty</A>.
+ 
+<P>After
+<DL>
+<DD>pdflatex <A HREF="robustsample.tex">robustsample.tex</A>
+<DD>makeindex robustsample
+<DD>pdflatex robustsample.tex
+<DD>pdflatex robustsample.tex
+</DL>
+you should have something like <A HREF="robustsample.pdf">this PDF file</A>.
+
+
+<BR>
+
+<BR><BR><BR>
+<A HREF="https://www.staff.science.uu.nl/~kalle101/">Wilberd van der Kallen</A> 
+
+
+</BODY>
+</HTML>


Property changes on: trunk/Master/texmf-dist/doc/latex/robustindex/stind.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/robustindex/robustindex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/robustindex/robustindex.sty	2017-09-01 01:31:58 UTC (rev 45184)
+++ trunk/Master/texmf-dist/tex/latex/robustindex/robustindex.sty	2017-09-01 01:32:22 UTC (rev 45185)
@@ -1,29 +1,18 @@
-% Package robustindex.sty, Wilberd van der Kallen Feb 2005.
+% Package robustindex.sty, Wilberd van der Kallen 2005, 2017.
 %
-% This package addresses two issues.
-%
-% 1. The main issue.
 % Third parties often change the page numbers without rerunning makeindex.
 % One would like to make the page numbers in the index entries more robust.
 % We use the \pageref mechanism for that. Only after adding, deleting or
 % otherwise modifying an \index{entry}, or after changing the order of the
 % index entries, does one have to rerun makeindex.
-% Other changes do not matter, as long as one runs LaTeX or pdflatex twice.
+% Other changes do not matter, as long as one runs LaTeX or pdflatex until 
+% labels are stable.
 % As usual a makeindex run has to be preceded and also followed by its
 % LaTeX or pdflatex run.
 %
-% 2. A patch.
-% The theindex environment does not create a hyperref destination.
-% Therefore we introduce \indexincontents.
-% It does what \addcontentsline{toc}{chapter}{Index} or
-% \addcontentsline{toc}{section}{Index} should have done in the first place:
-% When one clicks on the link that displays the word Index, one actually ends
-% up in the index.
-% Our patch is much more simpleminded than the tocbibind package.
 %
-% If you use hyperref, choose the option hyperindex=false. Otherwise hyperref
-% may block our code. And our package already gives hyperlinks in the
-% index.
+% If you use hyperref, you must choose the option hyperindex=false.  
+% Our package already gives hyperlinks in the index.
 % Alternatively, you may go against the advice of hyperref and put our
 % package later.
 %
@@ -31,30 +20,24 @@
 %
 % \usepackage[plainpages=false,hyperindex=false]{hyperref}
 %
-% The implicit page range formation of makeindex is disabled.
+% Automatic page ranges are not supported.
 % Commands of the type \index{entry|editing command} are supported,
 % but much more naively than in the encapsulating mechanism of makeindex.
-% For instance, \index{term|(textbf} may be followed by \index{term|)textit},
-% but not by \index{term|textbf}, even if there is a later
-% \index{term|)textbf}.
+% For instance, \index{term|(textbf} may be followed by \index{term|)textit}.
 %
-% See robustsample.tex at 
-% http://www.math.uu.nl/people/vdkallen/stind.html
-% for further details.
 %
-% There you find examples like
-%
-% \index{alpha!see beta}
-% \index{alpha!see also gamma\gobblepageref}
-%
-% \indexincontents % always put this before the index.
-%
 % Our package performs no miracles. But in simple situations all you need is
 % adding the \usepackage{robustindex} to the preamble. Do not exclude any
 % relevant files, as in \includeonly.
 %
-% Copyright 2005 Wilberd van der Kallen
+% Remark.
+% The package imakeidx also synchronises the index with the manuscript,
+% but it has a different method and different requirements.
 %
+% https://www.staff.science.uu.nl/~kalle101/stind
+%
+% Copyright 2017 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
@@ -63,7 +46,7 @@
 % version 1999/12/01 or later.
 
 \ProvidesPackage{robustindex}
-  [2005/02/24
+  [2017/08/31
   index entries with pagerefs]
 
 \newcounter{indexctr}%
@@ -88,9 +71,14 @@
   \@esphack
 }%
 
+\newif\ifinside at range% output must be supressed inside page range.
+\inside at rangefalse
+
 \newcommand{\indpageref}[1]{%
+\ifinside at range \findEndPageRange\else
    \ifnum\c at maxindctr<#1\relax\setcounter{maxindctr}{#1}\fi
    \pageref{\indstring#1}%
+   \fi
 }%
 
 \newcommand{\indexpreamble}{\relax}% compare the preamble of makeindex
@@ -97,6 +85,10 @@
 
 \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 at chapter\undefined section\else chapter\fi}{\indexname}%
   }%
@@ -108,7 +100,7 @@
 
 \newcommand{\cndhyprndxwrng}{%
     \ifHy at hyperindex
-       \PackageWarning{robustind}{%
+       \PackageWarning{robustindex}{%
           Use option hyperindex=false in hyperref. Hyperlinks in the index
 	  will be made through \string\pageref. Detected%
        }%
@@ -117,10 +109,7 @@
 
 \def\theindex{%
    \old at theindex
-   \refstepcounter{subsection}\indexpreamble
-   % We use that \refstepcounter{subsection} creates a destination.
-   % An index is not to be followed immediately by a subsection.
-   % We do not use \phantomsection, as we do not assume hyperref is used.
+   \indexpreamble
    \ifx\ifHy at hyperindex\undefined\else\cndhyprndxwrng\fi
 }%
 
@@ -132,13 +121,13 @@
    \ifnum\c at indexctr=\c at maxindctr
    \else
       \ifnum\c at indexctr=0%
-         \PackageWarning{robustind}{%
+         \PackageWarning{robustindex}{%
 	    Package needs \string\make index in preamble,
 	    and if you use hyperref, you must
 	    use option hyperindex=false. Detected%
 	 }%
       \else
-         \PackageWarning{robustind}{%
+         \PackageWarning{robustindex}{%
             Index not up to date, run makeindex. Detected%
          }%
       \fi
@@ -156,18 +145,19 @@
    #1{\pageref{\indstring#2}}%
 }%
 
-\newcommand{\gobbleindpageref}{\wrappageref\@gobble}
+\newcommand{\gobbleindpageref}{\wrappageref\@gobble}%
 
-\newcommand{\gobblepageref}{% to supress one page number.
+\newcommand{\gobblepageref}{% to suppress one page number.
       \protect\gobbleindpageref
 }%
 
 
-% Now it gets technical, because we wish to implement a poor man's encap
+% Now it gets ugly, because we wish to implement a poor man's encap
 % mechanism, distinguishing \index{entry}, \index{entry|(}, \index{entry|)},
 % \index{entry|(towrap}, \index{entry|)towrap}, where towrap is a sequence
 % of letters and \towrap is to be wrapped around \indpageref{countervalue}.
 
+
 \newcommand{\findencap}{}%
 
 \def\findencap#1|#2\relax{%
@@ -183,58 +173,52 @@
 \def\wr at pencap#1|{encpageref{#1}}%
 
 \newcommand{\encpageref}[2]{%
-   \findleftbrack#1(\relax{#2}%
+     \findleft at brack#1(\relax{#2}%
 }%
 
-\newcommand{\findleftbrack}{}%
+\newcommand{\findleft at brack}{}%
 
-\def\findleftbrack#1(#2\relax#3{%
-   \ifx|#1| \dropleftbrack#2{#3}%
-   \else \findrightbrack#1)\relax{#3}%
+\def\findleft at brack#1(#2\relax#3{%
+   \ifx|#1| \dropleft at brack#2{#3}% bracket ( found.
+   \else \findright at brack#1)\relax{#3}%
    \fi
 }%
 
-\newcommand{\dropleftbrack}{}%
+\newcommand{\dropleft at brack}{}%
 
-\def\dropleftbrack#1(#2{%
-   \unskip
-   \ifx|#1|\indpageref{#2}%
+\def\dropleft at brack#1(#2{%
+   \ifx|#1|\indpageref{#2}\inside at rangetrue%
    \else
-      \csname #1\endcsname{\indpageref{#2}}%
+      \csname #1\endcsname{\indpageref{#2}}\inside at rangetrue%
    \fi
-   \gobblecomma
+   % output for this key must be suppressed until end of range.
+   \findEndPageRange%
 }%
 
-\newcommand{\gobblecomma}{}%
 
-\newcommand{\oldndpgrf}{}%
+\newcommand{\findEndPageRange}{}% Name is helpful in error message if end not found.
 
-\let\oldndpgrf\indpageref
-
-\def\gobblecomma#1,{%
-   \def\indpageref{\rangewarning}%
+\def\findEndPageRange#1,{% It actually removes a comma.
    \ignorespaces #1%
 }%
 
-\newcommand{\rangewarning}{%
-   \PackageWarning{robustind}{%
-       You must first close the page range. Detected%
-   }%
-}%
+\newcommand{\findright at brack}{}%
 
-\newcommand{\findrightbrack}{}%
-
-\def\findrightbrack#1)#2\relax#3{%
-   \ifx|#1| \droprightbrack#2{#3}
+\def\findright at brack#1)#2\relax#3{%
+   \ifx|#1|\unskip \dropright at brack#2{#3}% bracket ) found.
    \else
-      \csname#1\endcsname{\indpageref{#3}}%
+      \ifinside at range
+        \findEndPageRange
+      \else
+        \csname#1\endcsname{\indpageref{#3}}%
+      \fi
    \fi
 }%
 
-\newcommand{\droprightbrack}{}%
+\newcommand{\dropright at brack}{}%
 
-\def\droprightbrack#1)#2{%
-   \let\indpageref\oldndpgrf
+\def\dropright at brack#1)#2{%
+   \inside at rangefalse% output no longer suppressed.
    \ifx|#1|\unskip \mbox{--}\nobreak\indpageref{#2}%
    \else
       \unskip \mbox{--}\nobreak\csname #1\endcsname{\indpageref{#2}}%



More information about the tex-live-commits mailing list