From 727529239a8ebcc7fb0f03433d941cd5ffb1ae54 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 3 Mar 2010 00:04:38 +0000 Subject: idxlayout update (2mar10) git-svn-id: svn://tug.org/texlive/trunk@17293 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/idxlayout/idxlayout.dtx | 162 +++++++++++++++------ 1 file changed, 121 insertions(+), 41 deletions(-) (limited to 'Master/texmf-dist/source/latex/idxlayout') diff --git a/Master/texmf-dist/source/latex/idxlayout/idxlayout.dtx b/Master/texmf-dist/source/latex/idxlayout/idxlayout.dtx index 3e2ea493016..fb56758ecfe 100644 --- a/Master/texmf-dist/source/latex/idxlayout/idxlayout.dtx +++ b/Master/texmf-dist/source/latex/idxlayout/idxlayout.dtx @@ -61,7 +61,7 @@ % % \fi % -% \CheckSum{354} +% \CheckSum{383} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -83,13 +83,13 @@ % % \GetFileInfo{idxlayout.sty} % -% \DoNotIndex{\@minus,\@plus,\begin,\begingroup,\csname,\def,\else,\end} -% \DoNotIndex{\endgroup,\endcsname,\endinput,\expandafter,\fi,\hspace} -% \DoNotIndex{\ifcase,\ifcsname,\item,\let,\MessageBreak} +% \DoNotIndex{\@minus,\@plus,\begin,\begingroup,\csname,\def,\edef} +% \DoNotIndex{\else,\end,\endgroup,\endcsname,\endinput,\expandafter} +% \DoNotIndex{\fi,\hspace,\ifcase,\ifcsname,\item,\let,\MessageBreak} % \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newlength} -% \DoNotIndex{\nobreak,\or,\p@,\par,\ProvidesPackage,\relax} +% \DoNotIndex{\@nameuse,\nobreak,\or,\p@,\par,\ProvidesPackage,\relax} % \DoNotIndex{\renewcommand,\renewenvironment,\RequirePackage} -% \DoNotIndex{\setcounter,\setlength,\tw@,\vspace,\z@} +% \DoNotIndex{\setcounter,\setlength,\the,\tw@,\vspace,\z@} % % \title{The \ila/ package\thanks{This document corresponds to % \ila/~\fileversion, dated \filedate.}} @@ -221,13 +221,13 @@ % index of first lines in a book of poetry'' \cite[p. % \textsc{xxix}]{Wil09}. % -% \changes{v0.4a}{2010/01/24}{New option \textsf{unbalanced}} -% % \item[unbalanced]\SpecialOptIndex{unbalanced} A boolean option that, % if enabled, switches off the balancing of columns on the last index % page. The default value is \textsf{false}. You may simply specify % \textsf{unbalanced}, which is equivalent to \textsf{unbalanced=true}. % +% \changes{v0.4a}{2010/01/24}{New option \textsf{unbalanced}} +% % \item[columnsep]\SpecialOptIndex{columnsep} The space between index % columns. The default value is 35\,pt. As this is required for % compatibility rather than suggested by typographic considerations, you @@ -310,6 +310,14 @@ % between a possible prenote and the first index entry. The default % value is one times the value of \textsf{initsep}. % +% \item[columnnote]\SpecialOptIndex{columnnote} A boolean option that +% controls whether a possible prenote is typeset as part of the first +% index column. The default value is \textsf{false}. You may simply +% specify \textsf{columnnote}, which is equivalent to +% \textsf{columnnote=true}. +% +% \changes{v0.4b}{2010/03/01}{New option \textsf{columnnote}} +% % \item[minspace]\SpecialOptIndex{minspace} The vertical space needed on % the current page to prevent the index from starting a new page. The % default value is 80\,pt. You may want to increase the value of @@ -330,8 +338,10 @@ % % \item[totoc]\SpecialOptIndex{totoc} A boolean option that controls % whether the index is included in the table of contents. The default -% value is \textsf{false}. You may simply specify \textsf{totoc}, which -% is equivalent to \textsf{totoc=true}. +% value is set according to the standard behaviour of the document class +% (\textsf{true} for \mem/, \textsf{false} for other classes). You may +% simply specify \textsf{totoc}, which is equivalent to +% \textsf{totoc=true}. % % \end{description} % @@ -372,8 +382,8 @@ % % \ila/ has been tested with the standard classes \textsf{article}, % \textsf{book} and \textsf{report} (v1.4h), the \KOMA/-classes -% \textsf{scrartcl}, \textsf{scrbook} and \textsf{scrreprt} (v3.04a) and -% the \mem/ class (v1.61803398c). It is responsive to their +% \textsf{scrartcl}, \textsf{scrbook} and \textsf{scrreprt} (v3.05) and +% the \mem/ class (v1.618033988c). It is responsive to their % index-related options and commands: % % \begin{itemize} @@ -393,9 +403,16 @@ % option \textsf{columns}.) % % \item The \KOMA/ command |\setindexpreamble| and the \mem/ command -% |\preindexhook| are supported. Note that both of them operate -% independently of the \ila/ commands |\setindexprenote| and -% |\noindexprenote|. +% |\preindexhook| are supported.\footnote{Because these command do not +% automatically insert vertical space between their argument and the +% first index entry, they have been made to operate independently of the +% \ila/ commands \texttt{\textbackslash setindexprenote} and +% \texttt{\textbackslash noindexprenote}. With \ila/ v0.4b and the +% \textsf{scrartcl} class, \texttt{\textbackslash setindexpreamble} will +% correctly typeset the preamble as part of the first index column.} +% +% \changes{v0.4b}{2010/03/01}{Corrected emulation of +% \texttt{\textbackslash setindexpreamble}} % % \end{itemize} % @@ -411,9 +428,14 @@ % a typographic point of view. See \cite[pp. 86--87]{Koh08} for % details.} % -% The packages \textsf{multind} (from 1991) and \textsf{index} (from -% 1995/2004) are not supported. If you're feeling so lucky as to use -% \textsf{index}, load it before \ila/. +% \changes{v0.4b}{2010/03/01}{Package \textsf{index} now supported} +% +% The \textsf{index} package also has to be loaded before \ila/. You may +% use the newly-defined second optional argument of |\printindex| to +% override the prenote text of |\setindexprenote| for individual +% indexes. +% +% The package \textsf{multind} (from 1991) is not supported. % % The \textsf{ragged2e} package must be loaded before \ila/ in order to % use the option \textsf{justific=RaggedRight}. @@ -481,7 +503,7 @@ % Announce the name and version of the package, which requires \LaTeXe. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{idxlayout}[2010/01/24 v0.4a Configurable index layout] +\ProvidesPackage{idxlayout}[2010/03/01 v0.4b Configurable index layout] % \end{macrocode} % Besides \textsf{multicol}, we require the packages \textsf{kvoptions} % (to conveniently specify options as key--value pairs) and @@ -693,6 +715,11 @@ \renewcommand{\indexspace}{\par\vspace{\ila@initsep}} % \end{macrocode} % \end{macro} +% The boolean option \textsf{columnnote} controls whether a possible +% prenote is placed within the first index column. +% \begin{macrocode} +\DeclareBoolOption{columnnote} +% \end{macrocode} % \begin{macro}{\indexfont} % The ``radio button'' key \textsf{font} produces an appropriate % definition of |\indexfont|. @@ -760,7 +787,7 @@ % \end{macro} % \end{macro} % \end{macro} -% \subsection{Emulating specific document classes} +% \subsection{Emulating specific document classes and packages} % % \begin{macro}{\ila@classtype} % We store the type of document class we use, differentiating between @@ -831,13 +858,13 @@ \ila@defradiokey[true]{totoc}{tc}% % \end{macrocode} % Again, |\ila@prologue| is very much a recoding exercise. Note that the -% \textsf{KOMA-script}-command |\idx@@heading| is responsive to -% |\KOMAoptions| and therefore to our key \textsf{totoc}. For -% \textsf{scrbook} and \textsf{scrreprt}, we only use -% |\setchapterpreamble| if |\index@preamble| is not defined as |\relax|. -% Thus, we avoid excessive vertical space between the index heading and -% the first entry. For \textsf{scrartcl}, we drop the special pagestyle -% of the first index page. +% \KOMA/-command |\idx@@heading| is responsive to |\KOMAoptions| and +% therefore to our key \textsf{totoc}. For \textsf{scrbook} and +% \textsf{scrreprt}, we only use |\setchapterpreamble| if +% |\index@preamble| is not defined as |\relax|. Thus, we avoid excessive +% vertical space between the index heading and the first entry. For +% textsf{scrartcl}, we drop the special pagestyle of the first index +% page and also (for the moment) do not use |\index@preamble|. % \begin{macrocode} \def\ila@prologue{% \ifundef{\chapter}{% @@ -850,7 +877,6 @@ \idx@@heading{\indexname}% \@mkboth{\indexname}{\indexname}% \ifundef{\chapter}{% - \index@preamble }{% \thispagestyle{\indexpagestyle}% }% @@ -884,6 +910,34 @@ } \fi % \end{macrocode} +% \begin{macro}{\ila@packindadjust} +% If the \textsf{index} package is loaded, the command +% |\ila@packindadjust| will~-- in accordance with the settings for +% individual indexes~-- redefine |\indexname| and (depending on the +% state of |\index@prologue| which stores the optional argument of +% |\printindex|) reset the argument of |\setindexprenote|. Because the +% \mem/ class (with built-in features similar to those of the +% \textsf{index} package) feigns the presence of the package, +% |\ila@packindadjust| is also let to |\relax| if the reported package +% date is newer than that of the last official version (v4.2beta). +% \begin{macrocode} +\@ifpackageloaded{index}{% + \@ifpackagelater{index}{2004/01/21}{% + \let\ila@packindadjust\relax + }{% + \def\ila@packindadjust{% + \edef\indexname{\the\@nameuse{idxtitle@\@indextype}}% + \ifdefempty{\index@prologue}{% + }{% + \setindexprenote{\index@prologue}% + }% + }% + }% +}{% + \let\ila@packindadjust\relax +} +% \end{macrocode} +% \end{macro} % Having defined the option \textsf{totoc}, we are able to process our % options. % \begin{macrocode} @@ -922,32 +976,58 @@ \setlength{\columnsep}{\indexcolsep}% \setlength{\columnseprule}{\indexrule}% % \end{macrocode} +% The necessary adjustments to the \textsf{index} package are carried +% out. +% \begin{macrocode} + \ila@packindadjust +% \end{macrocode} +% \begin{macro}{\ila@prologueplus} % If a single-column index is requested, we simply execute -% |\ila@prologue|, switch to |\indexfont| and typeset a possible -% prenote. In case of two or more columns, we do all this inside the -% first optional argument of a properly chosen |multicols| (or, if the -% boolean option \textsf{unbalanced} is enabled, |multicols*|) -% environment and specify the value of \textsf{minspace} as its second -% optional argument. +% |\ila@prologue|, switch to |\indexfont| and (if the boolean option +% \textsf{columnnote} is disabled) typeset a possible prenote. In case +% of two or more columns, we do all this inside the first optional +% argument of a properly chosen |multicols| (or, if the boolean option +% \textsf{unbalanced} is enabled, |multicols*|) environment and specify +% the value of \textsf{minspace} as its second optional argument. % \begin{macrocode} + \def\ila@prologueplus{% + \ila@prologue + \indexfont + \ifbool{ila@columnnote}{% + }{% + \ila@prenote + }% + }% \ifnumcomp{\theidxcols}{<}{\tw@}{% - \ila@prologue\indexfont\ila@prenote + \ila@prologueplus }{% \ifbool{ila@unbalanced}{% - \begin{multicols*}{\theidxcols}% - [\ila@prologue\indexfont\ila@prenote][\ila@minspace]% + \begin{multicols*}{\theidxcols}[\ila@prologueplus][\ila@minspace]% }{% - \begin{multicols}{\theidxcols}% - [\ila@prologue\indexfont\ila@prenote][\ila@minspace]% + \begin{multicols}{\theidxcols}[\ila@prologueplus][\ila@minspace]% }% }% % \end{macrocode} +% \end{macro} % We set |\parskip| to 0\,pt plus 0.3\,pt (exactly as in the standard -% classes), switch to the proper justification and~-- last, but not -% least~-- redefine |\item|. +% classes) and switch to the proper justification. For the +% \textsf{scrartcl} class, we append its index preamble. We also typeset +% a possible prenote in case \textsf{columnnote} is enabled. Last, but +% not least, we redefine |\item|. % \begin{macrocode} \setlength{\parskip}{\z@ \@plus 0.3\p@}% \indexjustific + \ifundef{\chapter}{% + \ifundef{\index@preamble}{% + }{% + \index@preamble\par\nobreak + }% + }{% + }% + \ifbool{ila@columnnote}{% + \ila@prenote + }{% + }% \let\item\@idxitem % \end{macrocode} % At the end of |theindex|, we close a possible |multicols| (or -- cgit v1.2.3