diff options
author | Karl Berry <karl@freefriends.org> | 2010-07-11 16:41:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-07-11 16:41:22 +0000 |
commit | 29d823f65d5adbee3d5264332ad893be27323983 (patch) | |
tree | d3bdc37b95030f4c8c314a670582d8b264f382bd /Master/texmf-dist/tex | |
parent | 0225a7e61bdeebcf50db7b4bed82ca989b182703 (diff) |
imakeidx 1.0 (9jul10)
git-svn-id: svn://tug.org/texlive/trunk@19375 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty | 374 |
1 files changed, 374 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty b/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty new file mode 100644 index 00000000000..0ba5e713c82 --- /dev/null +++ b/Master/texmf-dist/tex/latex/imakeidx/imakeidx.sty @@ -0,0 +1,374 @@ +%% +%% This is file `imakeidx.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% imakeidx.dtx (with options: `package') +%% ______________________________________________________ +%% The imakeidx package for LaTeX +%% Copyright (C) 2010 Claudio Beccari and Enrico Gregorio +%% All rights reserved +%% +%% License information appended +%% +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{imakeidx}% + [2010/07/09 v.1.0 Package for typesetting indices in a synchronous mode] +\RequirePackage{xkeyval} +\DeclareOption{xindy}{\def\imki@progdefault{texindy}} +\DeclareOption{texindy}{\def\imki@progdefault{texindy}} +\DeclareOption{makeindex}{\def\imki@progdefault{makeindex}} +\newif\ifimki@disableautomatic +\DeclareOption{noautomatic}{\imki@disableautomatictrue} +\newif\ifimki@nonewpage +\DeclareOption{nonewpage}{% + \imki@nonewpagetrue\imki@disableautomatictrue +} +\newif\ifimki@splitindex +\DeclareOption{splitindex}{\imki@splitindextrue} +\newif\ifimki@original +\DeclareOption{original}{\imki@originaltrue} +\DeclareOption{quiet}{\AtEndOfPackage{% + \let\imki@finalmessage\@gobble + \let\imki@splitindexmessage\relax}} +\ExecuteOptions{makeindex} +\ProcessOptions\relax + +\if@twocolumn\imki@originaltrue\fi +\def\imki@exec{\immediate\write18} +\def\imki@engine{(pdf)latex} +\ifdefined\XeTeXversion\def\imki@engine{xelatex}\fi +\ifdefined\directlua % luatex doesn't have \(pdf)shellescape + \def\imki@engine{lualatex}\chardef\imki@shellescape\@cclv +\fi +\edef\imki@splitindexoptions{-m \string"\string"} +\def\splitindexoptions#1{\g@addto@macro\imki@splitindexoptions{ #1}} +\@onlypreamble\splitindexoptions +\@ifclassloaded{memoir}{% + \PackageError{imakeidx}{Incompatible package won't be loaded} + {This package is incompatible with memoir, sorry}\endinput}{} +\@namedef{ver@makeidx.sty}{3000/12/31} +\@ifpackageloaded{multind} + {\PackageError{imakeidx}{Incompatible package `multind' loaded} + {This package is incompatible with multind, don't load both.% + \MessageBreak\@ehc}} + {\@namedef{ver@multind.sty}{3000/12/31}} +\providecommand*\see[2]{\emph{\seename} #1} +\providecommand*\seealso[2]{\emph{\alsoname} #1} +\providecommand*\seename{see} +\providecommand*\alsoname{see also} +\providecommand*\makeindex{} % to use \renewcommand safely +\renewcommand{\makeindex}[1][]{\imki@makeindex{#1}} +\def\imki@makeindex#1{% + \def\imki@name{\jobname}% + \def\imki@title{\indexname}% + \edef\imki@program{\imki@progdefault}% + \let\imki@options\space + \KV@imki@noautomaticfalse\KV@imki@intocfalse + \setkeys{imki}{#1}% + \ifimki@splitindex\KV@imki@noautomaticfalse\fi + \imki@build\imki@name + \imki@startidx\imki@name + \imki@resetdefaults +} +\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}{% + \ifcase\imki@nr\relax + \def\imki@program{makeindex}% + \or + \def\imki@program{texindy}% + \or + \def\imki@program{texindy}% + \fi} +\define@key{imki}{options}{\def\imki@options{ #1 }} +\define@boolkey{imki}{noautomatic}[true]{} +\define@boolkey{imki}{intoc}[true]{} +\define@key{imki}{columns}{\def\imki@columns{#1}} +\define@key{imki}{columnsep}{\def\imki@columnsep{#1}} +\define@boolkey{imki}{columnseprule}[true]{} +\def\imki@resetdefaults{% + \def\imki@options{ }% + \def\imki@columns{2}\def\imki@columnsep{35\p@}% + \KV@imki@columnseprulefalse + \KV@imki@intocfalse\KV@imki@noautomaticfalse} +\imki@resetdefaults +\def\imki@build#1{% + \toks@{}% + \imki@dokey\imki@title + \imki@dokey\imki@program + \imki@dokey\imki@options + \imki@dokey\imki@columns + \imki@dokey\imki@columnsep + \ifKV@imki@noautomatic + \addto@hook\toks@{\KV@imki@noautomatictrue}% + \else + \addto@hook\toks@{\KV@imki@noautomaticfalse}% + \fi + \ifKV@imki@intoc + \addto@hook\toks@{\KV@imki@intoctrue}% + \else + \addto@hook\toks@{\KV@imki@intocfalse}% + \fi + \ifKV@imki@columnseprule + \addto@hook\toks@{\KV@imki@columnsepruletrue}% + \else + \addto@hook\toks@{\KV@imki@columnseprulefalse}% + \fi + \expandafter\edef\csname imki@set@#1\endcsname{\the\toks@}% +} +\def\imki@dokey#1{% + \expandafter\addto@hook\expandafter\toks@\expandafter{% + \expandafter\def\expandafter#1\expandafter{#1}}} +\def\imki@startidxsplit#1{% + \if@filesw + \def\index{\@bsphack + \@ifnextchar [{\@index}{\@index[\jobname]}} + \expandafter\newwrite\csname #1@idxfile\endcsname + \immediate\openout \csname #1@idxfile\endcsname #1.idx\relax + \typeout{Writing index file #1.idx}% + \fi} +\newif\ifimki@startedidx +\def\imki@startidxunique#1{% + \if@filesw + \ifimki@startedidx\else + \newwrite\@indexfile + \immediate\openout\@indexfile\jobname.idx% + \global\imki@startedidxtrue + \fi + \def\index{\@bsphack + \@ifnextchar [{\@index}{\@index[\jobname]}} + \expandafter\let\csname #1@idxfile\endcsname\@empty + \typeout{Started index file #1}% + \fi} +\renewcommand{\index}[2][]{\@bsphack\@esphack} +\def\@index[#1]{% + \@ifundefined{#1@idxfile}% + {\PackageWarning{imakeidx}{Undefined index file `#1'}% + \begingroup + \@sanitize + \imki@nowrindex}% + {\edef\@idxfile{#1}% + \begingroup + \@sanitize + \@wrindex\@idxfile}} +\def\imki@nowrindex#1{\endgroup\@esphack} +\def\imki@wrindexsplit#1#2{% + \expandafter\protected@write\csname#1@idxfile\endcsname{}% + {\string\indexentry{#2}{\thepage}}% + \endgroup + \@esphack} +\def\imki@wrindexunique#1#2{% + \protected@write\@indexfile{}% + {\string\indexentry[#1]{#2}{\thepage}}% + \endgroup + \@esphack} +\def\imki@shellwarn{} +\ifdefined\imki@shellescape % luatex >= 0.60 + \chardef\imki@shellescape=\@ne +\else + \@ifundefined{shellescape} + {\let\imki@shellescape\pdfshellescape} + {\let\imki@shellescape\shellescape} +\fi +\ifnum\imki@shellescape=\z@ + \let\KV@imki@noautomaticfalse\KV@imki@noautomatictrue + \KV@imki@noautomatictrue + \def\imki@shellwarn{\MessageBreak or call \imki@engine\space with + -shell-escape} +\fi +\ifimki@disableautomatic + \let\KV@imki@noautomaticfalse\KV@imki@noautomatictrue + \KV@imki@noautomatictrue +\fi +\ifimki@original + \expandafter\def\expandafter\theindex\expandafter{\expandafter + \imki@maybeaddtotoc\theindex} +\else + \RequirePackage{multicol} + \renewenvironment{theindex} + {\imki@maybeaddtotoc + \imki@indexlevel{\indexname}\imki@indexheaders + \thispagestyle{\imki@firstpagestyle}% + \ifnum\imki@columns>\@ne + \columnsep \imki@columnsep + \ifx\imki@nextidxprologue\relax + \begin{multicols}{\imki@columns} + \else + \begin{multicols}{\imki@columns}[\imki@idxprologue] + \fi + \else + \imki@idxprologue + \fi + \global\let\imki@idxprologue\relax + \parindent\z@ + \parskip\z@ \@plus .3\p@\relax + \columnseprule \ifKV@imki@columnseprule.4\p@\else\z@\fi + \raggedright + \let\item\@idxitem + \imki@othercode} + {\ifnum\imki@columns>\@ne\end{multicols}\fi +} +\fi +\def\imki@indexlevel{% + \@ifundefined{chapter}{\section}{\chapter}*} +\define@key{imkiindex}{level}{\def\imki@indexlevel{#1}} +\def\imki@toclevel{% + \@ifundefined{chapter}{section}{chapter}} +\define@key{imkiindex}{toclevel}{\def\imki@toclevel{#1}} +\define@boolkey{imkiindex}{noclearpage}[true]{\let\imki@clearpage\relax} +\def\imki@indexheaders{% + \@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} +\define@key{imkiindex}{headers}{\def\imki@indexheaders{\markboth#1}} +\def\imki@firstpagestyle{plain} +\define@key{imkiindex}{firstpagestyle}{\def\imki@firstpagestyle{#1}} +\let\imki@othercode\relax +\define@key{imkiindex}{othercode}{\def\imki@othercode{#1}} +\newcommand{\indexsetup}[1]{% + \ifimki@original\else\setkeys{imkiindex}{#1}\fi} +\@onlypreamble\indexsetup +\newcommand{\indexprologue}[2][\bigskip]{% + \long\gdef\imki@idxprologue{{#2\par}#1}} +\providecommand*{\printindex}{} +\renewcommand*{\printindex}[1][\jobname]{% + \@ifundefined{#1@idxfile}{\imki@error{#1}}{\imki@putindex{#1}}} + +\def\imki@error#1{% + \def\@tempa{#1}\def\@tempb{\jobname}% + \ifx\@tempa\@tempb + \let\imki@optarg\@empty + \else + \def\imki@optarg{[#1]}% + \fi + \PackageError{imakeidx} + {Misplaced \protect\printindex\imki@optarg} + {You are not making this index, as no appropriate + \protect\makeindex\MessageBreak + command has been issued in the preamble.}} +\def\imki@clearpage{% + \@ifundefined{chapter} + {\clearpage} % article and similar classes + {\@ifundefined{if@openright} + {\cleardoublepage} + {\if@openright + \cleardoublepage + \else + \clearpage + \fi} + }} +\def\imki@check@indexname{\indexname} +\providecommand*\imki@maybeaddtotoc{} +\def\imki@finalmessage#1{% + \expandafter\edef\csname imki@message#1\endcsname + {\imki@program\imki@options#1.idx} + \AtEndDocument{\PackageWarning{imakeidx}{% + Remember to run \imki@engine\space again after calling\MessageBreak + `\@nameuse{imki@message#1}'\imki@shellwarn\@gobble}}} +\def\imki@splitindexmessage{% + \AtEndDocument{\PackageWarningNoLine{imakeidx}{% + Remember to run \imki@engine\space again after calling\MessageBreak + `splitindex' and processing the indices\imki@shellwarn}}} +\def\imki@makeindexname{makeindex} +\def\imki@decide{% + \@tempswafalse + \ifimki@splitindex % splitindex is not "safe" + \ifnum\imki@shellescape=\@ne\@tempswatrue\fi + \else + \ifx\imki@program\imki@makeindexname % nor is texindy + \ifnum\imki@shellescape=\tw@\@tempswatrue\fi + \fi + \ifnum\imki@shellescape=\@ne\@tempswatrue\fi + \fi + \ifKV@imki@noautomatic + \@tempswafalse + \fi} +\def\imki@putindexsplit#1{% + \ifimki@nonewpage\else + \imki@clearpage + \fi + \immediate\closeout\csname #1@idxfile\endcsname + \let\imki@indexname\indexname % keep \indexname + \@nameuse{imki@set@#1}\imki@decide + \if@tempswa % we can call the external program + \imki@exec{\imki@program\imki@options#1.idx}% + \else + \imki@finalmessage{#1}% + \fi + \ifKV@imki@intoc + \def\imki@maybeaddtotoc{\@nameuse{phantomsection}% + \addcontentsline{toc}{\imki@toclevel}{\imki@title}}% + \else + \def\imki@maybeaddtotoc{}% + \fi + \ifx\imki@title\imki@check@indexname\else + \def\indexname{\imki@title}% + \fi + \@input@{#1.ind} + \let\indexname\imki@indexname % restore \indexname +} + +\newif\ifimki@splitdone +\def\imki@putindexunique#1{% + \ifimki@nonewpage\else + \imki@clearpage + \fi + \let\imki@indexname\indexname % keep \indexname + \@nameuse{imki@set@#1}\imki@decide + \if@tempswa % we can call the external program + \ifimki@splitdone\else + \immediate\closeout\@indexfile + \imki@exec{splitindex \imki@splitindexoptions\space\jobname.idx}% + \global\imki@splitdonetrue + \fi + \else + \ifimki@splitdone\else + \imki@splitindexmessage\global\imki@splitdonetrue + \fi + \fi + \if@tempswa % we can call the external program + \imki@exec{\imki@program\imki@options\jobname-#1.idx}% + \fi + \ifKV@imki@intoc + \def\imki@maybeaddtotoc{\@nameuse{phantomsection}% + \addcontentsline{toc}{\imki@toclevel}{\imki@title}}% + \else + \def\imki@maybeaddtotoc{}% + \fi + \ifx\imki@title\imki@check@indexname\else + \def\indexname{\imki@title}% + \fi + \@input@{\jobname-#1.ind} + \let\indexname\imki@indexname % restore \indexname +} +\ifimki@splitindex + \let\imki@startidx\imki@startidxunique + \let\@wrindex\imki@wrindexunique + \let\imki@putindex\imki@putindexunique + \let\imki@startidxsplit\@undefined + \let\imki@wrindexsplit\@undefined + \let\imki@putindexsplit\@undefined +\else + \let\imki@startidx\imki@startidxsplit + \let\@wrindex\imki@wrindexsplit + \let\imki@putindex\imki@putindexsplit + \let\imki@startidxunique\@undefined + \let\imki@wrindexunique\@undefined + \let\imki@putindexunique\@undefined +\fi +%% +%% Copyright 2010 Claudio Beccari <claudio dot beccari at gmail dot it> +%% Copyright 2010 Enrico Gregorio <Enrico dot Gregorio at univr dot it> +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "author-maintained" +%% +%% This work consists of this file imakeidx.dtx, a README file +%% and the derived files imakeidx.sty and imakeidx.pdf. +%% +%% +%% End of file `imakeidx.sty'. |