summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/indextools/indextools.pdfbin519530 -> 548507 bytes
-rw-r--r--Master/texmf-dist/doc/latex/indextools/issue4.pdfbin0 -> 9552 bytes
-rw-r--r--Master/texmf-dist/source/latex/indextools/indextools.dtx215
-rw-r--r--Master/texmf-dist/tex/latex/indextools/indextools.sty99
4 files changed, 201 insertions, 113 deletions
diff --git a/Master/texmf-dist/doc/latex/indextools/indextools.pdf b/Master/texmf-dist/doc/latex/indextools/indextools.pdf
index d7d4ff2803b..9f31ad6d70b 100644
--- a/Master/texmf-dist/doc/latex/indextools/indextools.pdf
+++ b/Master/texmf-dist/doc/latex/indextools/indextools.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/indextools/issue4.pdf b/Master/texmf-dist/doc/latex/indextools/issue4.pdf
new file mode 100644
index 00000000000..bca8849fbd1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/indextools/issue4.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/indextools/indextools.dtx b/Master/texmf-dist/source/latex/indextools/indextools.dtx
index ed33f77fe38..038f73234eb 100644
--- a/Master/texmf-dist/source/latex/indextools/indextools.dtx
+++ b/Master/texmf-dist/source/latex/indextools/indextools.dtx
@@ -45,7 +45,7 @@ and the derived files indextools.sty and indextools.pdf.
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{indextools}%
%<*package>
- [2015/01/23 v1.4 Package for typesetting indices in a synchronous mode]
+ [2015/11/15 v1.5 Package for typesetting indices in a synchronous mode]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -68,7 +68,7 @@ and the derived files indextools.sty and indextools.pdf.
\GetFileInfo{indextools.dtx}% dtx extension required
\title{The package \pack{indextools}\thanks{Version number \fileversion; last
revision \filedate.}}
-\author{Maïeul Rouquette\thanks{\texttt{maieul at maieul dot net}} from Enrico Gregorio's work}
+\author{Maïeul Rouquette\thanks{\texttt{maieul at maieul dot net}} \\ from Enrico Gregorio's work}
\date{}
\maketitle
\begin{multicols}{2}
@@ -80,7 +80,7 @@ and the derived files indextools.sty and indextools.pdf.
\end{document}
%</driver>
% \fi
-% \CheckSum{798}
+% \CheckSum{889}
%
% \changes{v1.0}{2010/07/10}{First public version}
% \changes{v1.0a}{2010/07/12}{Small bug correction}
@@ -96,6 +96,9 @@ and the derived files indextools.sty and indextools.pdf.
% \changes{v1.3}{2013/07/11}{Added internal so as to cooperate in a better
% way with eledmac (by Maïeul Rouquette)}
% \changes{v1.4}{2015/01/23}{Compatibility with bidi. Fork from imakeidx. New name indextools}
+% \changes{v1.5}{2015/11/15}{New option `afterindex'}
+% \changes{v1.5}{2015/11/15}{New option `innote'}
+% \changes{v1.5}{2015/11/15}{New option `notenumber'}
%
% \begin{abstract}
% This package is a fork of the \pack{imakeidx} package. The original authors
@@ -200,13 +203,10 @@ and the derived files indextools.sty and indextools.pdf.
%
% The available \meta{options} consist in a comma separated list of
% the following options:
-% ^^A
% \begin{description}\def\Item[#1]{\item[\normalfont\ttfamily#1]}
-% ^^A
% \Item[makeindex] in order to use the \prog{makeindex} sorting and
% formatting engine; this option is the default and is mutually
% exclusive with the next option.
-% ^^A
% \Item[xindy] in order to use the \prog{xindy} sorting and formatting
% engine; \texttt{texindy} is an alias for \texttt{xindy} and actually
% it's the script \prog{texindy} which is called by this package.
@@ -215,7 +215,6 @@ and the derived files indextools.sty and indextools.pdf.
% the command line specific settings, it is possible to specify the
% option \texttt{truexindy}; the user is then responsible to set up
% the \prog{xindy} engine with the suitable command line options.
-% ^^A
% \Item[noautomatic] disables the automatic splitting of the raw
% index files and running of the system programs; this option might
% be used to save time when one knows for sure that the index files
@@ -223,26 +222,34 @@ and the derived files indextools.sty and indextools.pdf.
% spent in splitting, sorting and formatting is so short that this
% option might be useful only when very lengthy indices are being
% processed.
-% ^^A
% \Item[nonewpage] inhibits the new page command to be issued when
% using an article type document class and multiple indices are being
% typeset. We don't see why someone would use multiple indices in an
% article (except possibly for package documentations, which usually
% provide a macro index and a list of changes).
-% ^^A
% \Item[quiet] suppresses all messages about manual index processing.
-% ^^A
% \Item[original] uses the class-provided \texttt{theindex}
% environment for typesetting the indices; it is implicitly set if the
% document class option \texttt{twocolumn} has been specified.
-% ^^A
+% \Item[afterindex] allows to use \cs{index} command after \cs{printindex}.
+% If this case, the index will be printed only on the secund run.
+% \Item[innote] adds a mark for content indexed in note. The standard mark is an italic `n' added after the page number. You can redefine the \cs{innnote} command to modify the standard mark.
+% The default value is:\\
+% \begin{verbatim}
+% \providecommand{\innote}[1]{#1\textit{n}}
+% \end{verbatim}
+% \Item[notenumber] adds the note number for content indexed in note. The standard marks is a `n.' followed by the note number.
+% You can redefine \cs{innnotenumber} to modify the standard mark.
+% The default value is:\\
+% \begin{verbatim}
+% \providecommand{\innotenumber}[2]{#2n.~#1}
+% \end{verbatim}
% \Item[splitindex] calls the \prog{splitindex} script by Markus Kohm,
% which is included in every \TeX~Live distribution since 2009. With
% this option all index entries, which are written in one raw index
% file, are successively split into all the requested index files;
% in this way there is virtually no limit on the number of indices
% that is possible to create for a particular document.
-% ^^A
% \end{description}
%
% The last described option deserves an explanation. \LaTeX\ can
@@ -275,17 +282,13 @@ and the derived files indextools.sty and indextools.pdf.
% and \cs{printindex} must be used. This package redefines them so as
% to produce multiple indices and defines some other commands. The first three
% of the following commands may be used only in the preamble.
-% ^^A
% \begin{description}\def\Item[#1]{\item[\normalfont\ttfamily\cs{#1}]}
-% ^^A
% \Item[makeindex] with the syntax:\\[1ex]
% \cs{makeindex}\oarg{key-values}\\[1ex]
% where \meta{key-values} is a comma separated list of key-value
% assignments of the form: \texttt{key=value}; the available
% keys are the following:
-% ^^A
% \begin{description}\def\Item[#1]{\item[\normalfont\sffamily\textsl{#1}]}
-% ^^A
% \Item[name] is the symbolic name for an index; if this key is not
% specified, it defaults to the value of the \cs{jobname} control
% sequence, in other words the name of the current main \texttt{.tex}
@@ -294,11 +297,9 @@ and the derived files indextools.sty and indextools.pdf.
% doing multiple indices and is used with the \cs{index}
% command to point to the right index.\\*
% Example: \texttt{name=nameidx}
-% ^^A
% \Item[title] is the title that is typeset at the beginning of the
% specific index; if not specified, the \cs{indexname} value is
% used.\\* Example: \texttt{title=Index of names}.
-% ^^A
% \Item[program] is the name of the system program that is used to
% sort and format an index; valid choices are \prog{makeindex},
% \prog{xindy}, or \prog{texindy}, plus \prog{truexindy}. If not
@@ -306,7 +307,6 @@ and the derived files indextools.sty and indextools.pdf.
% If no option is specified, \prog{makeindex} is used. In order to
% use \prog{xindy}, it's necessary to call \prog{pdflatex} with
% the shell escape command line option.\\* Example: \texttt{program=xindy}.
-% ^^A
% \Item[options] is the list of options to be passed to the sorting
% and formatting program; this list is a balanced text of program
% options, separated with the syntax required by the sorting and
@@ -314,40 +314,31 @@ and the derived files indextools.sty and indextools.pdf.
% \prog{makeindex} sorting and formatting style \pack{mystyle.ist} and
% avoiding any message in the screen output, write \texttt{options=-s
% mystyle}.
-% ^^A
% \Item[noautomatic] is a boolean key that defaults to \texttt{false};
% you can set it to \texttt{true} by simply listing its key in the
% key-value list, without necessarily specifying the \texttt{=true}
% part. If specified the index sorting program won't be called during
% the typesetting run for this particular index.
-% ^^A
% \Item[intoc] is a boolean variable that defaults to \texttt{false};
% if you want to set it \texttt{true} you must simply list this key in
% the key-value list, with no need of specifying the \texttt{=true}
% part. By setting this key to \texttt{true} an entry for this
% particular index is put in the table of contents.
-% ^^A
% \Item[columns] accepts an integer representing the number of columns
% in the index; this is silently ignored if the \texttt{original} or
% the \texttt{twocolumn} options are set; the number can even
% be~$1$.\\* Example: \texttt{columns=3}
-% ^^A
% \Item[columnsep] accepts a dimension representing the separation
% between index columns; the default is $35$\,pt as in the standard
% classes.\\* Example: \texttt{columnsep=15pt}
-% ^^A
% \Item[columnseprule] is a boolean option; if it is set, a rule will appear
% between the index columns.
-% ^^A
% \end{description}
-% ^^A
% \Item[indexsetup] with the syntax:\\[1ex]
% \cs{indexsetup}\marg{key-values}\\[1ex]
% where again \meta{key-values} is a comma separated list of \texttt{key=value}
% assignments; the available keys are:
-% ^^A
% \begin{description}\def\Item[#1]{\item[\normalfont\sffamily\textsl{#1}]}
-% ^^A
% \Item[level] whose acceptable values are sectioning commands such as
% \cs{chapter} or \cs{chapter*}. Actually any command with an argument
% will do and will receive the index title as its argument. The
@@ -611,7 +602,6 @@ and the derived files indextools.sty and indextools.pdf.
% If shell hackers know a way to access the exit status of the called
% program, we'd be glad to implement a supplementary check.
%
-% ^^A G
% \section{Hints}\label{sec:hints}
% Actually this package reaches two goals: (\textit{a})~it typesets
% the indices of a specific document in just one run, and
@@ -752,34 +742,6 @@ and the derived files indextools.sty and indextools.pdf.
% necessary to load this package \pack{indextools} \emph{before} package
% \pack{combine}.
%
-% \subsubsection{Package \pack{ledmac}}
-%
-% Some users reported some conflicts with package \pack{ledmac}; in order
-% to mark with an italic `n' the pages where the reference was made in
-% one of the footnotes, it is necessary to use the package \pack{etoolbox}
-% and its command |\pretocmd|; actually it is not necessary to load
-% \pack{etoolbox}, because this \pack{indextools} package provides for it:
-%\begin{verbatim}
-%...
-%\usepackage{letltxmacro}
-%\usepackage{indextools}
-%...
-%\makeatletter
-%\LetLtxMacro\orig@@index\index
-%\newcommand\nindex[1]{\orig@@index{#1|innote}}
-%\newcommand\innote[1]{#1\textit{n}}
-%...
-%\makeindex[...]
-%...
-%\AtBeginDocument{%
-% \pretocommand{\@footnotetext}{\let\index\nindex}{}{}
-%}
-%\end{verbatim}
-% We did not apply this patch directly because we tried to avoid possible
-% conflicts that might show up when loading other packages. Therefore we
-% simply show what to do in case it might be necessary.
-%
-% With the newer \pack{eledmac} package there are no problems.
%
% \subsection{Package \pack{bidi}}
% A strange conflict was discovered between packages \pack{imakeidx} and
@@ -825,18 +787,14 @@ and the derived files indextools.sty and indextools.pdf.
% When you make any kind of customisation, remember that there are
% several classes, or personal settings, or features that may render your
% customisation very difficult to handle. Typically:
-%^^A
%\begin{itemize}
-%^^A
% \item There are classes where the normal usable highest sectioning
% command, disregarding |\part|, is not |\chapter|, but |\section|; for
% example classes \class{article}, \class{scrartcl}.
-%^^A
%\item Sectioning commands come in two varieties: starred and unstarred;
% the former ones are not numbered and do not produce any entry in the
% headings and in the table of contents; the latter ones may behave
% differently according to the next item.
-%^^A
% \item There are some classes (for example \class{book},
% \class{scrbook}, \class{menoir},\dots) that have the special
% ``sectioning'' declarations |\frontmatter|, |\mainmatter|, and
@@ -847,7 +805,6 @@ and the derived files indextools.sty and indextools.pdf.
% end. This means that the |\backmatter| declaration may be in force;
% in this case unstarred sectioning commands are not numbered but they
% produce normal headings and table of contents entries.
-%^^A
%\item Heading entries are used by the output routine paging algorithm
% in such a way as to extract the left or the right part from suitable
% ``marks''; for the even (left) pages the required information is
@@ -859,14 +816,12 @@ and the derived files indextools.sty and indextools.pdf.
% \Kvalue{headers} option value, you specify two brace balanced strings that
% are loaded through |\markboth| as the left and right part of the
% current mark.
-%^^A
% \item The contents of the marks may be very varied; they are generally
% made up of two brace balanced strings, which in turn may contain other
% brace balanced strings that may be used in different ways by the selected page
% style and by the page style definitions of the macros |\chaptermarks|,
% |\sectionmarks|, and |\subsectionmarks| that may interfere with personal
% customisations.
-%^^A
% \item Remember also that things change in an obvious way when one side
% typesetting is chosen; all pages are treated as if they were odd ones;
% therefore any customisation must take into account also this aspect.
@@ -1064,6 +1019,15 @@ and the derived files indextools.sty and indextools.pdf.
\DeclareOption{quiet}{\AtEndOfPackage{%
\let\indtl@finalmessage\@gobble
\let\indtl@splitindexmessage\relax}}
+\newif\ifindtl@afterindex
+\DeclareOption{afterindex}{\indtl@afterindextrue}
+
+\newif\ifindtl@innote
+\DeclareOption{innote}{\indtl@innotetrue}
+
+\newif\ifindtl@notenumber
+\DeclareOption{notenumber}{\indtl@notenumbertrue}
+
\ExecuteOptions{makeindex}
\ProcessOptions\relax
@@ -1088,7 +1052,7 @@ and the derived files indextools.sty and indextools.pdf.
\@onlypreamble\splitindexoptions
% \end{macrocode}
%
-% ^^A A - incompatibilities and emulation
+% \subsection{Incompatibilities and emulation}
%
% While experimenting we found out that some classes or packages are
% either incompatible with this one, or must be faked in order to
@@ -1140,7 +1104,7 @@ and the derived files indextools.sty and indextools.pdf.
\providecommand*\alsoname{see also}
% \end{macrocode}
%
-% ^^A C - \makeindex
+% \subsection{\cs{makeindex}}
%
% From here on, some commands are duplicated; this depends on the
% fact that the behavior must be different when using \prog{splitindex} or
@@ -1275,7 +1239,7 @@ and the derived files indextools.sty and indextools.pdf.
\fi}
% \end{macrocode}
%
-% ^^A D - \index
+% \subsection{\cs{index}}
%
% Provide a default definition for \cs{index}; when a \cs{makeindex}
% command is given and \LaTeX\ is writing on auxiliary files,
@@ -1354,7 +1318,7 @@ and the derived files indextools.sty and indextools.pdf.
}
% \end{macrocode}
%
-% ^^A E - \printindex
+% \subsection{\cs{printindex}}
%
% Compilation of the indices is disabled if \texttt{-shell-escape} has
% not been given or the restricted mode is not active; in this case we
@@ -1549,20 +1513,41 @@ and the derived files indextools.sty and indextools.pdf.
% automatic processing is possible, so that the main macro can take
% the appropriate action.
% \begin{macrocode}
-\def\indtl@makeindexname{makeindex}
-\def\indtl@decide{%
- \@tempswafalse
- \ifindtl@splitindex % splitindex is not "safe"
- \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
- \else
- \ifx\indtl@program\indtl@makeindexname % nor is texindy
+ \def\indtl@makeindexname{makeindex}
+ \def\indtl@decide{%
+ \@tempswafalse
+ \ifindtl@splitindex % splitindex is not "safe"
+ \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
+ \else
+ \ifx\indtl@program\indtl@makeindexname % nor is texindy
\ifnum\indtl@shellescape=\tw@\@tempswatrue\fi
- \fi
- \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
+ \fi
+ \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
+ \fi
+ \ifKV@indtl@noautomatic
+ \@tempswafalse
+ \fi}
+% \end{macrocode}
+% We define a macro that close a specified index file and run in.
+% \begin{macrocode}
+\newcommand{\indtl@closeandrundidxsplit}[1]{%
+ \immediate\closeout\csname #1@idxfile\endcsname
+ \let\indtl@indexname\indexname % keep \indexname
+ \@nameuse{indtl@set@#1}\indtl@decide
+ \if@tempswa % we can call the external program
+ \indtl@exec{\indtl@program\indtl@options#1.idx}%
+ \else
+ \indtl@finalmessage{#1}%
\fi
- \ifKV@indtl@noautomatic
- \@tempswafalse
- \fi}
+}
+% \end{macrocode}
+% We define a macro that close the general index file and run in.
+% \begin{macrocode}
+\newcommand{\indtl@closeandrundidxunique}{%
+ \immediate\closeout\@indexfile
+ \indtl@exec{splitindex \indtl@splitindexoptions\space\indtl@jobname.idx}%
+ \global\indtl@splitdonetrue
+}
% \end{macrocode}
% We now define the main macro that puts the specified index file into
% the document and possibly orders to add the index title to the
@@ -1580,13 +1565,14 @@ and the derived files indextools.sty and indextools.pdf.
\ifindtl@nonewpage\else
\indtl@clearpage
\fi
- \immediate\closeout\csname #1@idxfile\endcsname
- \let\indtl@indexname\indexname % keep \indexname
- \@nameuse{indtl@set@#1}\indtl@decide
- \if@tempswa % we can call the external program
- \indtl@exec{\indtl@program\indtl@options#1.idx}%
- \else
- \indtl@finalmessage{#1}%
+ \ifindtl@afterindex%
+ \AtEndDocument{%
+ \indtl@clearpage%
+ \indtl@closeandrundidxsplit{#1}%
+ \indltl@afterindexMessage%
+ }%
+ \else%
+ \indtl@closeandrundidxsplit{#1}%
\fi
\ifKV@indtl@intoc
\def\indtl@maybeaddtotoc{\@nameuse{phantomsection}%
@@ -1610,9 +1596,15 @@ and the derived files indextools.sty and indextools.pdf.
\@nameuse{indtl@set@#1}\indtl@decide
\if@tempswa % we can call the external program
\ifindtl@splitdone\else
- \immediate\closeout\@indexfile
- \indtl@exec{splitindex \indtl@splitindexoptions\space\indtl@jobname.idx}%
- \global\indtl@splitdonetrue
+ \ifindtl@afterindex
+ \AtEndDocument{%
+ \indtl@clearpage%
+ \indtl@closeandrundidxunique%
+ \indltl@afterindexMessage%
+ }
+ \else
+ \indtl@closeandrundidxunique
+ \fi
\fi
\else
\ifindtl@splitdone\else
@@ -1635,8 +1627,47 @@ and the derived files indextools.sty and indextools.pdf.
\let\indexname\indtl@indexname % restore \indexname
}
% \end{macrocode}
-%
-% ^^A F - Final decisions
+% A warning message when using `afterindex' option.
+% \begin{macrocode}
+\newcommand{\indltl@afterindexMessage}{%
+ \PackageWarning{indextools}{You use the `afterindex' option.
+ \MessageBreak That means you use \string\index\space commands after \string\printindex\space command.
+ \MessageBreak Consequently, the index may be not ok at the first run.
+ }%
+}
+% \end{macrocode}
+% \subsection{`innnote' and `notenumber' options}
+%
+% If the `innote' option is enabled, we modify the standard index command when we are in a note, in order to insert the \verb+|innote+ in the \verb+.idx+ file.
+% \begin{macrocode}
+
+\AtBeginDocument{%
+ \ifindtl@innote%
+ \RequirePackage{letltxmacro}
+ \LetLtxMacro\orig@@index\index
+ \pretocmd{\@footnotetext}{\let\index\nindex}{}{}
+ \apptocmd{\@footnotetext}{\let\index\orig@@index}{}{}
+
+ \fi%
+% \end{macrocode}
+% The same is true if the `notnumber' option is enabled.
+% \begin{macrocode}
+ \ifindtl@notenumber%
+ \RequirePackage{letltxmacro}
+ \LetLtxMacro\orig@@index\index
+ \pretocmd{\@footnotetext}{\let\index\nnumberindex}{}{}
+ \apptocmd{\@footnotetext}{\let\index\orig@@index}{}{}
+ \fi%
+% \end{macrocode}
+% \begin{macrocode}
+% And now, the command, defines in any case, but only at the begin of documents, because people can have defined them in the preamble.
+ \newcommand\nnumberindex[2][]{\orig@@index[#1]{#2|innotenumber{\thefootnote}}}
+ \newcommand\nindex[2][]{\orig@@index[#1]{#2|innote}}
+ \providecommand{\innotenumber}[2]{#2n.~#1}
+ \providecommand{\innote}[1]{#1\textit{n}}
+}
+% \end{macrcocode}
+% \subsection{Final decisions}
%
% At this point, we choose the meaning of the relevant commands,
% reclaiming the space occupied by the discarded ones
diff --git a/Master/texmf-dist/tex/latex/indextools/indextools.sty b/Master/texmf-dist/tex/latex/indextools/indextools.sty
index 8422828155a..85a3cde8baf 100644
--- a/Master/texmf-dist/tex/latex/indextools/indextools.sty
+++ b/Master/texmf-dist/tex/latex/indextools/indextools.sty
@@ -15,7 +15,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{indextools}%
- [2015/01/23 v1.4 Package for typesetting indices in a synchronous mode]
+ [2015/11/15 v1.5 Package for typesetting indices in a synchronous mode]
@@ -38,6 +38,15 @@
\DeclareOption{quiet}{\AtEndOfPackage{%
\let\indtl@finalmessage\@gobble
\let\indtl@splitindexmessage\relax}}
+\newif\ifindtl@afterindex
+\DeclareOption{afterindex}{\indtl@afterindextrue}
+
+\newif\ifindtl@innote
+\DeclareOption{innote}{\indtl@innotetrue}
+
+\newif\ifindtl@notenumber
+\DeclareOption{notenumber}{\indtl@notenumbertrue}
+
\ExecuteOptions{makeindex}
\ProcessOptions\relax
@@ -315,24 +324,21 @@
\AtEndDocument{\PackageWarningNoLine{indextools}{%
Remember to run \indtl@engine\space again after calling\MessageBreak
`splitindex' and processing the indices\indtl@shellwarn}}}
-\def\indtl@makeindexname{makeindex}
-\def\indtl@decide{%
- \@tempswafalse
- \ifindtl@splitindex % splitindex is not "safe"
- \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
- \else
- \ifx\indtl@program\indtl@makeindexname % nor is texindy
+ \def\indtl@makeindexname{makeindex}
+ \def\indtl@decide{%
+ \@tempswafalse
+ \ifindtl@splitindex % splitindex is not "safe"
+ \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
+ \else
+ \ifx\indtl@program\indtl@makeindexname % nor is texindy
\ifnum\indtl@shellescape=\tw@\@tempswatrue\fi
- \fi
- \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
- \fi
- \ifKV@indtl@noautomatic
- \@tempswafalse
- \fi}
-\def\indtl@putindexsplit#1{%
- \ifindtl@nonewpage\else
- \indtl@clearpage
- \fi
+ \fi
+ \ifnum\indtl@shellescape=\@ne\@tempswatrue\fi
+ \fi
+ \ifKV@indtl@noautomatic
+ \@tempswafalse
+ \fi}
+\newcommand{\indtl@closeandrundidxsplit}[1]{%
\immediate\closeout\csname #1@idxfile\endcsname
\let\indtl@indexname\indexname % keep \indexname
\@nameuse{indtl@set@#1}\indtl@decide
@@ -341,6 +347,25 @@
\else
\indtl@finalmessage{#1}%
\fi
+}
+\newcommand{\indtl@closeandrundidxunique}{%
+ \immediate\closeout\@indexfile
+ \indtl@exec{splitindex \indtl@splitindexoptions\space\indtl@jobname.idx}%
+ \global\indtl@splitdonetrue
+}
+\def\indtl@putindexsplit#1{%
+ \ifindtl@nonewpage\else
+ \indtl@clearpage
+ \fi
+ \ifindtl@afterindex%
+ \AtEndDocument{%
+ \indtl@clearpage%
+ \indtl@closeandrundidxsplit{#1}%
+ \indltl@afterindexMessage%
+ }%
+ \else%
+ \indtl@closeandrundidxsplit{#1}%
+ \fi
\ifKV@indtl@intoc
\def\indtl@maybeaddtotoc{\@nameuse{phantomsection}%
\addcontentsline{toc}{\indtl@toclevel}{\indtl@title}}%
@@ -363,9 +388,15 @@
\@nameuse{indtl@set@#1}\indtl@decide
\if@tempswa % we can call the external program
\ifindtl@splitdone\else
- \immediate\closeout\@indexfile
- \indtl@exec{splitindex \indtl@splitindexoptions\space\indtl@jobname.idx}%
- \global\indtl@splitdonetrue
+ \ifindtl@afterindex
+ \AtEndDocument{%
+ \indtl@clearpage%
+ \indtl@closeandrundidxunique%
+ \indltl@afterindexMessage%
+ }
+ \else
+ \indtl@closeandrundidxunique
+ \fi
\fi
\else
\ifindtl@splitdone\else
@@ -387,6 +418,32 @@
\@input@{\indtl@jobname-#1.ind}
\let\indexname\indtl@indexname % restore \indexname
}
+\newcommand{\indltl@afterindexMessage}{%
+ \PackageWarning{indextools}{You use the `afterindex' option.
+ \MessageBreak That means you use \string\index\space commands after \string\printindex\space command.
+ \MessageBreak Consequently, the index may be not ok at the first run.
+ }%
+}
+
+\AtBeginDocument{%
+ \ifindtl@innote%
+ \RequirePackage{letltxmacro}
+ \LetLtxMacro\orig@@index\index
+ \pretocmd{\@footnotetext}{\let\index\nindex}{}{}
+ \apptocmd{\@footnotetext}{\let\index\orig@@index}{}{}
+
+ \fi%
+ \ifindtl@notenumber%
+ \RequirePackage{letltxmacro}
+ \LetLtxMacro\orig@@index\index
+ \pretocmd{\@footnotetext}{\let\index\nnumberindex}{}{}
+ \apptocmd{\@footnotetext}{\let\index\orig@@index}{}{}
+ \fi%
+ \newcommand\nnumberindex[2][]{\orig@@index[#1]{#2|innotenumber{\thefootnote}}}
+ \newcommand\nindex[2][]{\orig@@index[#1]{#2|innote}}
+ \providecommand{\innotenumber}[2]{#2n.~#1}
+ \providecommand{\innote}[1]{#1\textit{n}}
+}
\ifindtl@splitindex
\let\indtl@startidx\indtl@startidxunique
\let\@wrindex\indtl@wrindexunique