diff options
author | Karl Berry <karl@freefriends.org> | 2012-09-23 22:56:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-09-23 22:56:44 +0000 |
commit | adc80d7a3ef83b1dff3402eaeaf362a65874c3c9 (patch) | |
tree | 4b9e48e0f408a65c6486a708ea865140d4a9a37c /Master/texmf-dist/tex/latex | |
parent | 1a3d2a5725fcd461d05af13d1fa1390d483c9dc2 (diff) |
imakeidx (23sep12)
git-svn-id: svn://tug.org/texlive/trunk@27784 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty b/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty index 380450ed537..285c4e390f2 100644 --- a/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty +++ b/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty @@ -14,10 +14,14 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{imakeidx}% - [2012/09/07 v1.1a Package for typesetting indices in a synchronous mode] + [2012/09/22 v1.2b Package for typesetting indices in a synchronous mode] + + + \RequirePackage{xkeyval} \DeclareOption{xindy}{\def\imki@progdefault{texindy}} \DeclareOption{texindy}{\def\imki@progdefault{texindy}} +\DeclareOption{truexindy}{\def\imki@progdefault{truexindy}} \DeclareOption{makeindex}{\def\imki@progdefault{makeindex}} \newif\ifimki@disableautomatic \DeclareOption{noautomatic}{\imki@disableautomatictrue} @@ -38,9 +42,8 @@ \if@twocolumn\imki@originaltrue\fi \def\imki@exec{\immediate\write18} \def\imki@engine{(pdf)latex} -\RequirePackage{ifxetex,ifluatex} -\ifxetex\def\imki@engine{xelatex}\fi -\ifluatex % luatex doesn't have \(pdf)shellescape +\ifdefined\XeTeXversion\def\imki@engine{xelatex}\fi +\ifdefined\directlua % luatex doesn't have \(pdf)shellescape \def\imki@engine{lualatex} \ifnum\luatexversion<68 \chardef\imki@shellescape\@ne % no way to know the value @@ -50,6 +53,7 @@ \fi \let\imki@exec\pdf@system \fi +\RequirePackage{xpatch} \edef\imki@splitindexoptions{-m \string"\string"} \def\splitindexoptions#1{\g@addto@macro\imki@splitindexoptions{ #1}} \@onlypreamble\splitindexoptions @@ -66,7 +70,7 @@ \providecommand*\makeindex{} % to use \renewcommand safely \renewcommand{\makeindex}[1][]{\imki@makeindex{#1}} \def\imki@makeindex#1{% - \def\imki@name{\jobname}% + \edef\imki@name{\jobname}% \def\imki@title{\indexname}% \edef\imki@program{\imki@progdefault}% \let\imki@options\space @@ -80,13 +84,15 @@ \define@key{imki}{name}{\def\imki@name{#1}} \define@key{imki}{title}{\def\imki@title{#1}} \define@choicekey{imki}{program}[\imki@val\imki@nr] - {makeindex,xindy,texindy}{% + {makeindex,xindy,texindy,truexindy}{% \ifcase\imki@nr\relax \def\imki@program{makeindex}% \or \def\imki@program{texindy}% \or \def\imki@program{texindy}% + \or + \def\imki@program{xindy}% \fi} \define@key{imki}{options}{\def\imki@options{ #1 }} \define@boolkey{imki}{noautomatic}[true]{} @@ -130,7 +136,7 @@ \def\imki@startidxsplit#1{% \if@filesw \def\index{\@bsphack - \@ifnextchar [{\@index}{\@index[\jobname]}} + \@ifnextchar [{\@index}{\@index[\imki@name]}} \expandafter\newwrite\csname #1@idxfile\endcsname \immediate\openout \csname #1@idxfile\endcsname #1.idx\relax \typeout{Writing index file #1.idx}% @@ -140,11 +146,11 @@ \if@filesw \ifimki@startedidx\else \newwrite\@indexfile - \immediate\openout\@indexfile\jobname.idx% + \immediate\openout\@indexfile\imki@name.idx% \global\imki@startedidxtrue \fi \def\index{\@bsphack - \@ifnextchar [{\@index}{\@index[\jobname]}} + \@ifnextchar [{\@index}{\@index[\imki@name]}} \expandafter\let\csname #1@idxfile\endcsname\@empty \typeout{Started index file #1}% \fi} @@ -160,15 +166,21 @@ \@sanitize \@wrindex\@idxfile}} \def\imki@nowrindex#1{\endgroup\@esphack} +\newif\ifimki@showidx +\@ifpackageloaded{showidx}{\imki@showidxtrue}{\imki@showidxfalse} +\edef\imki@jobname{\jobname} +\newcommand\imki@showidxentry[2]{\ifimki@showidx +\@showidx{\ifdefequal{\imki@jobname}{#1}{}{[#1]\space}#2}% +\fi} \def\imki@wrindexsplit#1#2{% \expandafter\protected@write\csname#1@idxfile\endcsname{}% {\string\indexentry{#2}{\thepage}}% - \endgroup + \endgroup\imki@showidxentry{#1}{#2}% \@esphack} \def\imki@wrindexunique#1#2{% \protected@write\@indexfile{}% {\string\indexentry[#1]{#2}{\thepage}}% - \endgroup + \endgroup\imki@showidxentry{#1}{#2}% \@esphack} \def\imki@shellwarn{} \ifdefined\imki@shellescape % luatex @@ -187,6 +199,11 @@ \let\KV@imki@noautomaticfalse\KV@imki@noautomatictrue \KV@imki@noautomatictrue \fi +\newif\ifimki@fancyhdr +\AtBeginDocument{\@ifpackageloaded{fancyhdr}{\imki@fancyhdrtrue}{\imki@fancyhdrfalse}% +\ifimki@fancyhdr + \patchcmd{\theindex}{\imki@indexheaders}{\relax}{}{}% + \patchcmd{\theindex}{\thispagestyle}{\@gobble}{}{}\fi} \ifimki@original \expandafter\def\expandafter\theindex\expandafter{\expandafter \imki@maybeaddtotoc\theindex} @@ -237,11 +254,11 @@ \newcommand{\indexprologue}[2][\bigskip]{% \long\gdef\imki@idxprologue{{#2\par}#1}} \providecommand*{\printindex}{} -\renewcommand*{\printindex}[1][\jobname]{% +\renewcommand*{\printindex}[1][\imki@name]{% \@ifundefined{#1@idxfile}{\imki@error{#1}}{\imki@putindex{#1}}} \def\imki@error#1{% - \def\@tempa{#1}\def\@tempb{\jobname}% + \def\@tempa{#1}\def\@tempb{\imki@name}% \ifx\@tempa\@tempb \let\imki@optarg\@empty \else @@ -324,7 +341,7 @@ \if@tempswa % we can call the external program \ifimki@splitdone\else \immediate\closeout\@indexfile - \imki@exec{splitindex \imki@splitindexoptions\space\jobname.idx}% + \imki@exec{splitindex \imki@splitindexoptions\space\imki@name.idx}% \global\imki@splitdonetrue \fi \else @@ -333,7 +350,7 @@ \fi \fi \if@tempswa % we can call the external program - \imki@exec{\imki@program\imki@options\jobname-#1.idx}% + \imki@exec{\imki@program\imki@options\imki@name-#1.idx}% \fi \ifKV@imki@intoc \def\imki@maybeaddtotoc{\@nameuse{phantomsection}% @@ -344,7 +361,7 @@ \ifx\imki@title\imki@check@indexname\else \def\indexname{\imki@title}% \fi - \@input@{\jobname-#1.ind} + \@input@{\imki@name-#1.ind} \let\indexname\imki@indexname % restore \indexname } \ifimki@splitindex @@ -363,7 +380,6 @@ \let\imki@putindexunique\@undefined \fi \@ifclassloaded{memoir}{\let\@wrindexm@m\@wrindex}{} - %% %% Copyright 2010--2012 Claudio Beccari <claudio dot beccari at gmail dot it> %% Copyright 2010--2012 Enrico Gregorio <Enrico dot Gregorio at univr dot it> |