summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/indextools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-11-15 23:38:38 +0000
committerKarl Berry <karl@freefriends.org>2015-11-15 23:38:38 +0000
commit6752b8c70172a1caa4d65871d9f52615fc462445 (patch)
tree797b1beb22eed8a2ebb94161dc54ac6038bccb2c /Master/texmf-dist/tex/latex/indextools
parenta51021b1ead7a65b753c03564dfb0fbb1a4c6325 (diff)
indextools (15nov15)
git-svn-id: svn://tug.org/texlive/trunk@38861 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/indextools')
-rw-r--r--Master/texmf-dist/tex/latex/indextools/indextools.sty99
1 files changed, 78 insertions, 21 deletions
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