| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `idxlayout.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 2010--2012 by Thomas Titz <[email protected]> |
| 6 |
% |
| 7 |
% Permission is granted to distribute and/or modify this work under the |
| 8 |
% terms of the LaTeX Project Public License (LPPL), version 1.3c or |
| 9 |
% later. |
| 10 |
% |
| 11 |
% The LPPL maintenance status of this work is "maintained". |
| 12 |
% |
| 13 |
% This work consists of the files idxlayout.dtx, idxlayout.ins and |
| 14 |
% README and the derived files idxlayout.pdf and idxlayout.sty. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
% |
| 20 |
%<*driver> |
| 21 |
\documentclass{ltxdoc} |
| 22 |
\EnableCrossrefs |
| 23 |
\CodelineIndex |
| 24 |
\RecordChanges |
| 25 |
% \OnlyDescription |
| 26 |
\GlossaryPrologue{% |
| 27 |
\section*{{Change History}}% |
| 28 |
\markboth{{Change History}}{{Change History}}% |
| 29 |
\vspace{-\multicolsep}% |
| 30 |
} |
| 31 |
\newcommand*{\SpecialOptIndex}[1]{% |
| 32 |
\index{#1={\protect\sffamily#1} (option)|usage}% |
| 33 |
\index{options:>#1={\protect\sffamily#1}|usage}% |
| 34 |
} |
| 35 |
\usepackage[columns=3,columnsep=15pt,indentunit=15pt,minspace=100pt,% |
| 36 |
font=small]{idxlayout} |
| 37 |
\renewcommand*{\indexjustific}{% |
| 38 |
\setlength{\parindent}{0pt}% |
| 39 |
\setlength{\rightskip}{15pt}% |
| 40 |
\setlength{\parfillskip}{-15pt}% |
| 41 |
} |
| 42 |
\setindexprenote{% |
| 43 |
\normalsize% |
| 44 |
Numbers written in italic refer to the page where the corresponding |
| 45 |
entry is described; numbers underlined refer to the |
| 46 |
\ifbool{codeline@index}{code line of the }{}% |
| 47 |
definition; numbers in roman refer to the |
| 48 |
\ifbool{codeline@index}{code lines }{pages }% |
| 49 |
where the entry is used.% |
| 50 |
} |
| 51 |
\usepackage[bottom]{footmisc} |
| 52 |
\addtolength{\skip\footins}{5pt} |
| 53 |
\usepackage{array,booktabs,caption,enumitem,graphicx,url,varioref} |
| 54 |
\frenchspacing |
| 55 |
\def\ila/{\textsf{idxlayout}} |
| 56 |
\def\KOMA/{\textsf{KOMA-Script}} |
| 57 |
\def\mem/{\textsf{memoir}} |
| 58 |
\widowpenalty=10000 |
| 59 |
\begin{document} |
| 60 |
\DocInput{idxlayout.dtx} |
| 61 |
\end{document} |
| 62 |
%</driver> |
| 63 |
% |
| 64 |
% \fi |
| 65 |
% |
| 66 |
% \CheckSum{397} |
| 67 |
% |
| 68 |
% \CharacterTable |
| 69 |
% {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 |
| 70 |
% Lower-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 |
| 71 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 72 |
% Exclamation \! Double quote \" Hash (number) \# |
| 73 |
% Dollar \$ Percent \% Ampersand \& |
| 74 |
% Acute accent \' Left paren \( Right paren \) |
| 75 |
% Asterisk \* Plus \+ Comma \, |
| 76 |
% Minus \- Point \. Solidus \/ |
| 77 |
% Colon \: Semicolon \; Less than \< |
| 78 |
% Equals \= Greater than \> Question mark \? |
| 79 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 80 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 81 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 82 |
% Right brace \} Tilde \~} |
| 83 |
% |
| 84 |
% \changes{v0.4}{2010/01/10}{Initial public release} |
| 85 |
% |
| 86 |
% \GetFileInfo{idxlayout.sty} |
| 87 |
% |
| 88 |
% \DoNotIndex{\@minus,\@plus,\begin,\begingroup,\csname,\def,\edef} |
| 89 |
% \DoNotIndex{\else,\end,\endgroup,\endcsname,\endinput,\expandafter} |
| 90 |
% \DoNotIndex{\fi,\hspace,\ifcase,\ifcsname,\item,\let,\MessageBreak} |
| 91 |
% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newlength} |
| 92 |
% \DoNotIndex{\@nameuse,\nobreak,\or,\p@,\par,\ProvidesPackage,\relax} |
| 93 |
% \DoNotIndex{\renewcommand,\renewenvironment,\RequirePackage} |
| 94 |
% \DoNotIndex{\setcounter,\setlength,\the,\tw@,\vspace,\z@} |
| 95 |
% \DoNotIndex{\boolfalse,\booltrue,\ifbool,\providecommand} |
| 96 |
% |
| 97 |
% \title{The \ila/ package\thanks{This document corresponds to |
| 98 |
% \ila/~\fileversion, dated \filedate.}} |
| 99 |
% \author{Thomas Titz\thanks{E-mail: \texttt{[email protected]}}} |
| 100 |
% \maketitle |
| 101 |
% |
| 102 |
% \begin{abstract} |
| 103 |
% \noindent The \ila/ package offers a key--value interface to configure |
| 104 |
% index layout parameters, e.\,g. allowing for three-column indexes or |
| 105 |
% for ``parent'' items and their affiliated subitems being typeset as a |
| 106 |
% single paragraph. The package is responsive to the index-related |
| 107 |
% options and commands of the \KOMA/- and \mem/ classes. |
| 108 |
% \end{abstract} |
| 109 |
% |
| 110 |
% \section{Introduction} |
| 111 |
% |
| 112 |
% Every once a while, questions pop up on \textsf{comp.text.tex} or |
| 113 |
% other \LaTeX-related newsgroups on how to change properties of the |
| 114 |
% index layout. The most common request is for an index with three |
| 115 |
% instead of two columns. The answer to this~-- although not necessarily |
| 116 |
% the implementation~-- is simple: Use a \texttt{multicols} environment. |
| 117 |
% An example in the \LaTeX\ Companion \cite[pp. 679--680]{Mit04} shows |
| 118 |
% how to do it. |
| 119 |
% |
| 120 |
% Besides being cumbersome for unversed \LaTeX\ users,\footnote{In the |
| 121 |
% words of user InsideMan on \textsf{mrunix.de}, November 27, 2009 |
| 122 |
% (authors translation): ``I didn't believe this to be so laborious. I'd |
| 123 |
% rather have guessed there is a package option to cater for it.''} the |
| 124 |
% do-it-yourself approach is prone to break index-related options the |
| 125 |
% document class might provide (e.\,g. for including the index in the |
| 126 |
% table of contents). To address this, the \ila/ package offers a |
| 127 |
% key--value interface to configure index layout parameters while |
| 128 |
% emulating and extending the relevant functionality of the standard, |
| 129 |
% \KOMA/- and \mem/ classes. |
| 130 |
% |
| 131 |
% Note that \ila/ stays on the \LaTeX\ side of things. If you want to |
| 132 |
% add letter headings to each index group or to change the delimiter |
| 133 |
% between keyword and first page number, you still have to provide a |
| 134 |
% corresponding \textsf{MakeIndex} style file. |
| 135 |
% |
| 136 |
% \begin{figure} |
| 137 |
% \centering |
| 138 |
% \scalebox{0.83}{% |
| 139 |
% \begin{minipage}{125mm} |
| 140 |
% \columnsep 15pt |
| 141 |
% \raggedcolumns |
| 142 |
% \begin{multicols}{3} |
| 143 |
% |
| 144 |
% \idxlayout{columns=1,font=normalsize,justific=raggedright} |
| 145 |
% \noindexprenote |
| 146 |
% |
| 147 |
% \newcommand{\fakeindex}{% |
| 148 |
% \begin{theindex} |
| 149 |
% \item Dion, 2, 3, 5, 8, 13, 21, 1957--1960 |
| 150 |
% \subitem and the Belmonts, 1957--1960 |
| 151 |
% |
| 152 |
% \end{theindex} |
| 153 |
% } |
| 154 |
% |
| 155 |
% \fakeindex |
| 156 |
% \idxlayout{itemlayout=relhang} |
| 157 |
% \fakeindex |
| 158 |
% \idxlayout{itemlayout=singlepar} |
| 159 |
% \fakeindex |
| 160 |
% \idxlayout{columns=3,itemlayout=abshang,font=small} |
| 161 |
% |
| 162 |
% \end{multicols} |
| 163 |
% \end{minipage} |
| 164 |
% } |
| 165 |
% \caption{Option \textsf{itemlayout} with values \textsf{abshang}, |
| 166 |
% \textsf{relhang} and \textsf{singlepar}} |
| 167 |
% \label{fig:itemlayout} |
| 168 |
% \end{figure} |
| 169 |
% |
| 170 |
% \section{Using the \ila/ package} |
| 171 |
% |
| 172 |
% \subsection{Default behaviour} |
| 173 |
% |
| 174 |
% If you just add |\usepackage{idxlayout}| to your document preamble, |
| 175 |
% the package will keep up the index-related behaviour of the document |
| 176 |
% class while correcting bugs and taking advantage of \textsf{multicol} |
| 177 |
% features. This amounts to the following changes: |
| 178 |
% |
| 179 |
% \begin{itemize} |
| 180 |
% |
| 181 |
% \item Columns will be balanced on the last index page. |
| 182 |
% |
| 183 |
% \item If you are using a class that lacks the |\chapter| command (or |
| 184 |
% \mem/ with the option \textsf{article}), the index will basically |
| 185 |
% behave like a normal |\section*|, i.\,e. it will not automatically |
| 186 |
% start a new page.\footnote{However, if you typeset your document in |
| 187 |
% \textsf{twocolumn} mode, \ila/ will temporarily switch to |
| 188 |
% \textsf{onecolumn}, causing a page break in the process.} The first |
| 189 |
% index page will also not use a special pagestyle like \textsf{plain} |
| 190 |
% appropriate only for chapter headings. |
| 191 |
% |
| 192 |
% \item When on top of the page, the vertical positioning of the index |
| 193 |
% heading will not differ from that of other headings typeset in |
| 194 |
% \textsf{onecolumn} mode, i.\,e. \LaTeX\ bug 3126 (|\twocolumn| |
| 195 |
% interfering with |\topskip|) will be avoided. |
| 196 |
% |
| 197 |
% \item With the standard classes \textsf{article}, \textsf{book} and |
| 198 |
% \textsf{report}, the space between index columns will be 35\,pt as |
| 199 |
% intended.\footnote{In the current version (v1.4h) of these classes, |
| 200 |
% the length \texttt{\textbackslash columnsep} is set to 35\,pt, but |
| 201 |
% only after \texttt{\textbackslash twocolumn} has been triggered. The |
| 202 |
% \KOMA/- and \mem/ classes have either corrected or never introduced |
| 203 |
% this bug. See \cite{col05} for details.} |
| 204 |
% |
| 205 |
% \end{itemize} |
| 206 |
% |
| 207 |
% \subsection{Options and commands} |
| 208 |
% |
| 209 |
% The options provided by \ila/ use the key--value interface |
| 210 |
% `\meta{key}=\meta{value}'. Set them with |
| 211 |
% |\usepackage[|\meta{options}|]{idxlayout}|. For boolean options, the |
| 212 |
% default value is \textsf{false}, and specifying \meta{key} is |
| 213 |
% equivalent to \meta{key}\textsf{=true}. |
| 214 |
% |
| 215 |
% \begin{description}[font=\sffamily] |
| 216 |
% |
| 217 |
% \item[columns]\SpecialOptIndex{columns} The number of columns used for |
| 218 |
% typesetting the index. The permitted values range from 1 to 10, the |
| 219 |
% default value is 2. A single-column index is e.\,g. suitable ``for an |
| 220 |
% index of first lines in a book of poetry'' \cite[p. |
| 221 |
% \textsc{xxix}]{Wil09}. |
| 222 |
% |
| 223 |
% \item[unbalanced]\SpecialOptIndex{unbalanced} A boolean option that, |
| 224 |
% if enabled, switches off the balancing of columns on the last index |
| 225 |
% page. |
| 226 |
% |
| 227 |
% \changes{v0.4a}{2010/01/24}{New option \textsf{unbalanced}} |
| 228 |
% |
| 229 |
% \item[columnsep]\SpecialOptIndex{columnsep} The space between index |
| 230 |
% columns. The default value is 35\,pt. As this is required for |
| 231 |
% compatibility rather than suggested by typographic considerations, you |
| 232 |
% may want to reduce the value of \textsf{columnsep} to, say, 1 to 1.5 |
| 233 |
% times the value of \textsf{indentunit}. |
| 234 |
% |
| 235 |
% \item[rule]\SpecialOptIndex{rule} The thickness of a vertical rule |
| 236 |
% between index columns. The default value is 0\,pt, i.\,e. no rule. |
| 237 |
% |
| 238 |
% \item[itemlayout]\SpecialOptIndex{itemlayout} The layout of index |
| 239 |
% items, subitems and subsubitems. The permitted values, which are |
| 240 |
% described below, are \textsf{abshang}, \textsf{relhang} and |
| 241 |
% \textsf{singlepar}. The default value is \textsf{abshang} (which |
| 242 |
% corresponds to standard \LaTeX\ behaviour). See |
| 243 |
% figure~\vref{fig:itemlayout} for examples of the various layouts. |
| 244 |
% |
| 245 |
% \begin{description}[font=\normalfont\sffamily] |
| 246 |
% |
| 247 |
% \item[abshang] Index items feature a hanging indentation of value |
| 248 |
% \textsf{hangindent}. Subitems and subsubitems resemble items except |
| 249 |
% that their first line is indented by the values of \textsf{subindent} |
| 250 |
% and \textsf{subsubindent}, respectively. |
| 251 |
% |
| 252 |
% \item[relhang] Differing from \textsf{abshang}, the hanging |
| 253 |
% indentations of subitems and subsubitems equal the sum of |
| 254 |
% \textsf{hangindent} and the respective first-line indentations. |
| 255 |
% |
| 256 |
% \item[singlepar] ``Parent'' items and their affiliated subitems |
| 257 |
% (and, if present, subsubitems) are typeset as a single paragraph, with |
| 258 |
% a semicolon plus an interword space being used as the default |
| 259 |
% delimiter.\footnote{This blends in well with the default behaviour of |
| 260 |
% \textsf{MakeIndex} to put a comma plus an interword space between |
| 261 |
% keyword and first page number.} |
| 262 |
% |
| 263 |
% \end{description} |
| 264 |
% |
| 265 |
% \item[indentunit]\SpecialOptIndex{indentunit} A length that serves as |
| 266 |
% a building block for other indentation lengths. The default value is |
| 267 |
% 20\,pt. You may want to match the value of \textsf{indentunit} with |
| 268 |
% that of the \TeX\ length |\parindent|. The default values of the |
| 269 |
% options \textsf{hangindent}, \textsf{subindent} and |
| 270 |
% \textsf{subsubindent} will be set in accordance with the chosen values |
| 271 |
% of \textsf{itemlayout} and \textsf{indentunit} (see |
| 272 |
% table~\vref{tab:indents}). |
| 273 |
% |
| 274 |
% \item[hangindent]\SpecialOptIndex{hangindent} Use this option to |
| 275 |
% override the default value of \textsf{hangindent}. |
| 276 |
% |
| 277 |
% \item[subindent]\SpecialOptIndex{subindent} Use this option to |
| 278 |
% override the default value of \textsf{subindent}. |
| 279 |
% |
| 280 |
% \item[subsubindent]\SpecialOptIndex{subsubindent} Use this option to |
| 281 |
% override the default value of \textsf{subsubindent}. |
| 282 |
% |
| 283 |
% \begin{table} |
| 284 |
% \centering |
| 285 |
% \small |
| 286 |
% \caption{Default values of options \textsf{hangindent}, |
| 287 |
% \textsf{subindent} and \textsf{subsubindent}} |
| 288 |
% \begin{tabular}{>{\centering\hspace{0pt}}p{22mm}ccc} |
| 289 |
% \toprule |
| 290 |
% Value of option \\ \textsf{itemlayout} & \multicolumn{3}{c}{Default |
| 291 |
% value (multiple of \textsf{indentunit})} \\ |
| 292 |
% \cmidrule(l){2-4} |
| 293 |
% & \textsf{hangindent} & \textsf{subindent} & \textsf{subsubindent }\\ |
| 294 |
% \midrule |
| 295 |
% \textsf{abshang} & 2 & 1 & 1.5 \\ |
| 296 |
% \textsf{relhang} & 1.5 & 1 & 2 \\ |
| 297 |
% \textsf{singlepar} & 1 & -- & -- \\ |
| 298 |
% \bottomrule |
| 299 |
% \end{tabular} |
| 300 |
% \label{tab:indents} |
| 301 |
% \end{table} |
| 302 |
% |
| 303 |
% \item[initsep]\SpecialOptIndex{initsep} The vertical space inserted |
| 304 |
% between index groups with differing initial letters. The default value |
| 305 |
% is 10\,pt plus 5\,pt minus 3\,pt. |
| 306 |
% |
| 307 |
% \item[notesep]\SpecialOptIndex{notesep} The vertical space inserted |
| 308 |
% between a possible prenote and the first index entry. The default |
| 309 |
% value is one times the value of \textsf{initsep}. |
| 310 |
% |
| 311 |
% \item[columnnote]\SpecialOptIndex{columnnote} A boolean option that |
| 312 |
% controls whether a possible prenote is typeset as part of the first |
| 313 |
% index column. |
| 314 |
% |
| 315 |
% \changes{v0.4b}{2010/03/01}{New option \textsf{columnnote}} |
| 316 |
% |
| 317 |
% \item[minspace]\SpecialOptIndex{minspace} The vertical space needed on |
| 318 |
% the current page to prevent the index from starting a new page. The |
| 319 |
% default value is 80\,pt. You may want to increase the value of |
| 320 |
% \textsf{minspace} if the index includes a prenote containing several |
| 321 |
% lines. |
| 322 |
% |
| 323 |
% \item[font]\SpecialOptIndex{font} The font used for typesetting the |
| 324 |
% index. The permitted values are \textsf{current} (i.\,e. the font in |
| 325 |
% effect at the time of |\printindex|), \textsf{normalsize}, |
| 326 |
% \textsf{small} and \textsf{footnotesize}. The default value is |
| 327 |
% \textsf{current}. |
| 328 |
% |
| 329 |
% \item[justific]\SpecialOptIndex{justific} The justification of index |
| 330 |
% columns. The permitted values are \textsf{standard} (i.\,e. left and |
| 331 |
% right margin justified), \textsf{raggedright} and \textsf{RaggedRight} |
| 332 |
% (which uses the correspondent command of the automatically loaded |
| 333 |
% \textsf{ragged2e} package).\footnote{Before \ila/ v0.4c, |
| 334 |
% \textsf{justific=RaggedRight} erroneously utilized |
| 335 |
% \texttt{\textbackslash raggedright}.} The default value is |
| 336 |
% \textsf{standard}. |
| 337 |
% |
| 338 |
% \changes{v0.4c}{2010/06/26}{Corrected option \textsf{justific!= |
| 339 |
% RaggedRight}} |
| 340 |
% |
| 341 |
% \changes{v0.4c}{2010/06/26}{Package \textsf{ragged2e} now loaded |
| 342 |
% automatically} |
| 343 |
% |
| 344 |
% \item[totoc]\SpecialOptIndex{totoc} A boolean option that controls |
| 345 |
% whether the index is included in the table of contents. The default |
| 346 |
% value of this option is set according to the standard behaviour of the |
| 347 |
% document class (\textsf{true} for \mem/, \textsf{false} for other |
| 348 |
% classes). |
| 349 |
% |
| 350 |
% \end{description} |
| 351 |
% |
| 352 |
% \DescribeMacro{\setindexprenote} |
| 353 |
% \DescribeMacro{\noindexprenote} |
| 354 |
% Use the command |\setindexprenote|\{\meta{Some text}\} to typeset |
| 355 |
% explanatory text after the index heading. As a default, the prenote |
| 356 |
% (which may span several paragraphs) is set in the same font as the |
| 357 |
% index. Font changes within the argument of |\setindexprenote| won't |
| 358 |
% affect the index proper. A vertical space controlled by the |
| 359 |
% \textsf{notesep} option is inserted between the prenote and the first |
| 360 |
% index entry. With multiple indexes, use the command |\noindexprenote| |
| 361 |
% to reset the prenote text to empty and to take care of the proper |
| 362 |
% spacing between index heading and first entry. |
| 363 |
% |
| 364 |
% \DescribeMacro{\idxlayout} |
| 365 |
% The command |\idxlayout|, which takes a comma-separated list of |
| 366 |
% key--value options as argument, allows to change index layout |
| 367 |
% parameters within the document. A typographically sound example is |
| 368 |
% provided by \cite{Mit04} which typesets a general index in two columns |
| 369 |
% and then switches to three columns for an index of names. |
| 370 |
% |
| 371 |
% \DescribeMacro{\indexfont} |
| 372 |
% \DescribeMacro{\indexjustific} |
| 373 |
% If the permitted values of the options \textsf{font} and |
| 374 |
% \textsf{justific} do not cover your needs, you can resort to |
| 375 |
% redefining the commands |\indexfont| and |\indexjustific|, e.\,g. by |
| 376 |
% including |\renewcommand*{\indexfont}{\tiny\bfseries}| in your |
| 377 |
% document preamble.\footnote{See the file |idxlayout.dtx| for the |
| 378 |
% redefinition of \texttt{\textbackslash indexjustific} carried out in |
| 379 |
% order to use \ila/ with the \textsf{ltxdoc} class.} |
| 380 |
% |
| 381 |
% \DescribeMacro{\indexsubsdelim} |
| 382 |
% Redefine the command |\indexsubsdelim| if you happen to dislike the |
| 383 |
%default delimiter used with the option \textsf{itemlayout=singlepar}. |
| 384 |
% |
| 385 |
% \DescribeMacro{\indexstheadcase} |
| 386 |
% In the standard classes, the index header is typeset using |
| 387 |
% |\MakeUppercase|. \ila/ allows you to change this by redefining |
| 388 |
% |\indexstheadcase|. |
| 389 |
% |
| 390 |
% \changes{v0.4d}{2010/03/01}{Added \texttt{\textbackslash |
| 391 |
% indexstheadcase}} |
| 392 |
% |
| 393 |
% \subsection{Compatibility issues and notes} |
| 394 |
% |
| 395 |
% \ila/ has been tested with the standard classes \textsf{article}, |
| 396 |
% \textsf{book} and \textsf{report} (v1.4h), the \KOMA/-classes |
| 397 |
% \textsf{scrartcl}, \textsf{scrbook} and \textsf{scrreprt} (v3.10a) and |
| 398 |
% the \mem/ class (v3.6j). It is responsive to their index-related |
| 399 |
% options and commands: |
| 400 |
% |
| 401 |
% \changes{v0.4d}{2012/03/30}{Adapted emulation of \textsf{theindex} to |
| 402 |
% \KOMA/ v3.10} |
| 403 |
% |
| 404 |
% \begin{itemize} |
| 405 |
% |
| 406 |
% \item The \KOMA/ options for including the index in the table of |
| 407 |
% contents (e.\,g. \textsf{index=totoc}) and the respective \mem/ |
| 408 |
% commands (e.\,g. |\indexintoc|) are recognized and can be mixed with |
| 409 |
% the \ila/ option \textsf{totoc}. |
| 410 |
% |
| 411 |
% \item The \mem/ lengths |\indexcolsep| and |\indexrule| are supported, |
| 412 |
% and it is possible to alternate between setting these lengths and |
| 413 |
% using the respective \ila/ options \textsf{columnsep} and |
| 414 |
% \textsf{rule}. |
| 415 |
% |
| 416 |
% \item The \mem/ commands |\onecolindex| and |\twocolindex| are |
| 417 |
% recognized. (For an index with three or more columns, use the \ila/ |
| 418 |
% option \textsf{columns}.) |
| 419 |
% |
| 420 |
% \item The \KOMA/ command |\setindexpreamble| and the \mem/ command |
| 421 |
% |\preindexhook| are supported.\footnote{Because these commands do not |
| 422 |
% automatically insert vertical space between their argument and the |
| 423 |
% first index entry, they have been made to operate independently of the |
| 424 |
% \ila/ commands \texttt{\textbackslash setindexprenote} and |
| 425 |
% \texttt{\textbackslash noindexprenote}. With \ila/ v0.4b and the |
| 426 |
% \textsf{scrartcl} class, \texttt{\textbackslash setindexpreamble} will |
| 427 |
% correctly typeset the preamble as part of the first index column.} |
| 428 |
% |
| 429 |
% \changes{v0.4b}{2010/03/01}{Corrected emulation of |
| 430 |
% \texttt{\textbackslash setindexpreamble}} |
| 431 |
% |
| 432 |
% \end{itemize} |
| 433 |
% |
| 434 |
% When using \ila/ together with the \textsf{splitidx} package, issue |
| 435 |
% the \textsf{splitidx} command |\extendtheindex| only after having |
| 436 |
% loaded \ila/. |
| 437 |
% |
| 438 |
% If you use the \textsf{tocbibind} package, you must load it before |
| 439 |
% \ila/. The influence of \textsf{tocbibind} on including the index in |
| 440 |
% the table of contents will be removed, so use the \ila/ option |
| 441 |
% \textsf{totoc} instead.\footnote{Just in case you ask, numbering the |
| 442 |
% index heading is not supported by \ila/ because it is a bad idea from |
| 443 |
% a typographic point of view. See \cite[pp. 86--87]{Koh08} for |
| 444 |
% details.} |
| 445 |
% |
| 446 |
% Another package which must not be loaded after \ila/ is |
| 447 |
% \textsf{imakeidx} which allows to create indexes during the main |
| 448 |
% typesetting run. |
| 449 |
% |
| 450 |
% The \textsf{index} package also has to be loaded before \ila/. You may |
| 451 |
% use the newly-defined second optional argument of |\printindex| to |
| 452 |
% override the prenote text of |\setindexprenote| for individual |
| 453 |
% indexes. |
| 454 |
% |
| 455 |
% \changes{v0.4b}{2010/03/01}{Package \textsf{index} now supported} |
| 456 |
% |
| 457 |
% The \textsf{multind} package (from 1991) is not supported. |
| 458 |
% |
| 459 |
% As \ila/ is based on the \textsf{multicol} package, the appearance of |
| 460 |
% the index is affected by any \textsf{multicol} parameter not |
| 461 |
% overridden by \ila/. Use the command |\raggedcolumns| if you aim at |
| 462 |
% typesetting the index on a grid. |
| 463 |
% |
| 464 |
% \StopEventually{% |
| 465 |
% |
| 466 |
% \bibliographystyle{plain} |
| 467 |
% |
| 468 |
% \begin{thebibliography}{9} |
| 469 |
% |
| 470 |
% \bibitem{col05} |
| 471 |
% ``columnsep in theindex (TLC2 and memoir)''. |
| 472 |
% Series of messages on \textsf{comp.text.tex}, May 22--29, 2005. |
| 473 |
% \url{http://groups.google.com/group/comp.text.tex/browse_thread/thread/937744003315b784} |
| 474 |
% (accessed January 2, 2010). |
| 475 |
% |
| 476 |
% \bibitem{dec09} |
| 477 |
% ``\textbackslash DeclareStringOption''. |
| 478 |
% Series of messages on \textsf{comp.text.tex}, December 14, 2009. |
| 479 |
% \url{http://groups.google.com/group/comp.text.tex/browse_thread/thread/1fb53938ac0026c5} |
| 480 |
% (accessed January 2, 2010). |
| 481 |
% |
| 482 |
% \bibitem{Koh08} |
| 483 |
% Kohm, Markus and Jens-Uwe Morawski. |
| 484 |
% \emph{KOMA-Script: Eine Sammlung von Klassen und Paketen f\"ur |
| 485 |
% \LaTeXe}. 3\textsuperscript{rd} edition. |
| 486 |
% Berlin: lehmanns media, 2008. |
| 487 |
% |
| 488 |
% \bibitem{Mit04} |
| 489 |
% Mittelbach, Frank and Michel Goossens. |
| 490 |
% \emph{The \LaTeX\ Companion}. 2\textsuperscript{nd} edition. |
| 491 |
% Boston: Addison-Wesley, 2004. |
| 492 |
% |
| 493 |
% \bibitem{Wil09} |
| 494 |
% Wilson, Peter. |
| 495 |
% \emph{The memoir class for configurable typesetting: User guide}. |
| 496 |
% 8\textsuperscript{th} edition. |
| 497 |
% Published by the author, 2009. |
| 498 |
% \url{http://www.ctan.org/tex-archive/macros/latex/contrib/memoir/memman.pdf} |
| 499 |
% (accessed January 2, 2010). |
| 500 |
% |
| 501 |
% \bibitem{Wri09} |
| 502 |
% Wright, Joseph and Christian Feuers\"anger. |
| 503 |
% ``Implementing key--value input: An introduction''. |
| 504 |
% \emph{TUGboat} 30.1 (2009), pp.~110--122. |
| 505 |
% \url{http://www.tug.org/TUGboat/tb30-1/tb94wright-keyval.pdf} |
| 506 |
% (accessed March 30, 2012). |
| 507 |
% |
| 508 |
% \end{thebibliography} |
| 509 |
% |
| 510 |
% \PrintIndex |
| 511 |
% \PrintChanges |
| 512 |
% |
| 513 |
% } |
| 514 |
% |
| 515 |
% \section{The package code} |
| 516 |
% |
| 517 |
% \subsection{Preliminaries} |
| 518 |
% |
| 519 |
% Announce the name and version of the package, which requires \LaTeXe. |
| 520 |
% \begin{macrocode} |
| 521 |
\NeedsTeXFormat{LaTeX2e} |
| 522 |
\ProvidesPackage{idxlayout}[2012/03/30 v0.4d Configurable index layout] |
| 523 |
% \end{macrocode} |
| 524 |
% Besides \textsf{multicol}, we require the packages \textsf{kvoptions} |
| 525 |
% (to conveniently specify options as key--value pairs) and |
| 526 |
% \textsf{etoolbox} (e.\,g. for length assignments and boolean switch |
| 527 |
% handling). We also need \eTeX, whose presence is tested by |
| 528 |
% \textsf{etoolbox}. |
| 529 |
% \begin{macrocode} |
| 530 |
\RequirePackage{etoolbox,kvoptions,multicol} |
| 531 |
% \end{macrocode} |
| 532 |
% We use \texttt{ila@} as a short prefix to internal macros defined by |
| 533 |
% \textsf{kvoptions}. |
| 534 |
% \begin{macrocode} |
| 535 |
\SetupKeyvalOptions{family=ila,prefix=ila@} |
| 536 |
% \end{macrocode} |
| 537 |
% \begin{macro}{\ila@defradiokey} |
| 538 |
% \textsf{kvoptions} does not provide ``radio buttons''~-- options that |
| 539 |
% take a list of three or more values with associated functions and |
| 540 |
% yield an error message if an unknown value is given. However, in a |
| 541 |
% series of messages on \textsf{comp.text.tex} \cite{dec09}, Heiko |
| 542 |
% Oberdiek (author of \textsf{kvoptions}) and Joseph Wright showed how |
| 543 |
% radio button keys can be created using |\define@key| (from the |
| 544 |
% \textsf{keyval} package, which is loaded by \textsf{kvoptions}) and |
| 545 |
% the \eTeX\ primitive |\ifcsname|. What follows is basically a |
| 546 |
% shameless rip-off of Heikos and Josephs good advice. |
| 547 |
% |
| 548 |
% The command |\ila@defradiokey| takes one optional and two mandatory |
| 549 |
% arguments. The first mandatory argument is the key to be defined, the |
| 550 |
% second is a ``short key'' which must be used as a second prefix after |
| 551 |
% |ila@| when defining the functions associated with each value. The |
| 552 |
% optional argument specifies a default value ``which is then used if |
| 553 |
% the user does not supply one'' \cite[p.~111]{Wri09}. |
| 554 |
% \begin{macrocode} |
| 555 |
\newcommand*{\ila@defradiokey}[3][]{% |
| 556 |
\define@key{ila}{#2}[#1]{% |
| 557 |
\ifcsname ila@#3@##1\endcsname |
| 558 |
\csname ila@#3@##1\expandafter\endcsname |
| 559 |
\else |
| 560 |
\PackageError{idxlayout}{Unknown value ##1 for option #2}% |
| 561 |
\fi |
| 562 |
}% |
| 563 |
} |
| 564 |
% \end{macrocode} |
| 565 |
% \end{macro} |
| 566 |
% \subsection{Options and commands} |
| 567 |
% \begin{macro}{\theidxcols} |
| 568 |
% \begin{macro}{\onecolindex} |
| 569 |
% \begin{macro}{\twocolindex} |
| 570 |
% We define the key \textsf{columns} to control the number of index |
| 571 |
% columns and initially set it to 2. (Actually, we use the counter |
| 572 |
% |idxcols| to store the number so that anything but an integer will |
| 573 |
% yield a \LaTeX\ error message.) If the \mem/ class is used, we check |
| 574 |
% the state of its boolean switch |onecolindex| and set \textsf{columns} |
| 575 |
% accordingly. We also append code to |\onecolindex| and |\twocolindex| |
| 576 |
% so that these \mem/ commands will set \textsf{columns} to the |
| 577 |
% respective number. |
| 578 |
% \begin{macrocode} |
| 579 |
\newcounter{idxcols} |
| 580 |
\define@key{ila}{columns}{\setcounter{idxcols}{#1}} |
| 581 |
\setkeys{ila}{columns=2} |
| 582 |
\@ifclassloaded{memoir}{% |
| 583 |
\ifbool{onecolindex}{% |
| 584 |
\setkeys{ila}{columns=1}% |
| 585 |
}{% |
| 586 |
}% |
| 587 |
\appto{\onecolindex}{\setkeys{ila}{columns=1}}% |
| 588 |
\appto{\twocolindex}{\setkeys{ila}{columns=2}}% |
| 589 |
% \end{macrocode} |
| 590 |
% \end{macro} |
| 591 |
% \end{macro} |
| 592 |
% \end{macro} |
| 593 |
% \begin{macro}{\indexcolsep} |
| 594 |
% \begin{macro}{\indexrule} |
| 595 |
% If any other class than \mem/ is used, we define the lengths |
| 596 |
% |\indexcolsep| and |\indexrule| and set them to appropriate values. |
| 597 |
% The keys \textsf{columnsep} and \textsf{rule} will be responsible for |
| 598 |
% changing these lengths. We don't set these keys here in order not to |
| 599 |
% override any changes carried out before loading \ila/. |
| 600 |
% \begin{macrocode} |
| 601 |
}{% |
| 602 |
\newlength{\indexcolsep}% |
| 603 |
\setlength{\indexcolsep}{35\p@}% |
| 604 |
\newlength{\indexrule}% |
| 605 |
\setlength{\indexrule}{\z@}% |
| 606 |
} |
| 607 |
\define@key{ila}{columnsep}{\setlength{\indexcolsep}{#1}} |
| 608 |
\define@key{ila}{rule}{\setlength{\indexrule}{#1}} |
| 609 |
% \end{macrocode} |
| 610 |
% \end{macro} |
| 611 |
% \end{macro} |
| 612 |
% \textsf{kvoptions} is used to define the boolean option |
| 613 |
% \textsf{unbalanced} which is responsible for switching off the |
| 614 |
% \textsf{multicol} balancing output routine. |
| 615 |
% \begin{macrocode} |
| 616 |
\DeclareBoolOption{unbalanced} |
| 617 |
% \end{macrocode} |
| 618 |
% \begin{macro}{\ila@indentunit} |
| 619 |
% The key \textsf{indentunit} is defined and set using \textsf{keyval} |
| 620 |
% commands so that its associated length can be used to set other |
| 621 |
% lengths. |
| 622 |
% \begin{macrocode} |
| 623 |
\newlength{\ila@indentunit} |
| 624 |
\define@key{ila}{indentunit}{\setlength{\ila@indentunit}{#1}} |
| 625 |
\setkeys{ila}{indentunit=20\p@} |
| 626 |
% \end{macrocode} |
| 627 |
% \end{macro} |
| 628 |
% \begin{macro}{\ila@hangindent} |
| 629 |
% \begin{macro}{\ila@subindent} |
| 630 |
% \begin{macro}{\ila@subsubindent} |
| 631 |
% We use \textsf{kvoptions} again to define the keys |
| 632 |
% \textsf{hangindent}, \textsf{subindent} and \textsf{subsubindent}. |
| 633 |
% Setting their default values is deferred to the definition of the |
| 634 |
% functions of the ``radio button'' key \textsf{itemlayout}. |
| 635 |
% \begin{macrocode} |
| 636 |
\DeclareStringOption{hangindent} |
| 637 |
\DeclareStringOption{subindent} |
| 638 |
\DeclareStringOption{subsubindent} |
| 639 |
% \end{macrocode} |
| 640 |
% \end{macro} |
| 641 |
% \end{macro} |
| 642 |
% \end{macro} |
| 643 |
% \begin{macro}{\@idxitem} |
| 644 |
% |\@idxitem| is only slightly changed: Its hanging indentation is |
| 645 |
% controlled by the key \textsf{hangindent} instead of being a fixed |
| 646 |
% value. |
| 647 |
% \begin{macrocode} |
| 648 |
\renewcommand{\@idxitem}{\par\setlength{\hangindent}{\ila@hangindent}} |
| 649 |
% \end{macrocode} |
| 650 |
% \end{macro} |
| 651 |
% \begin{macro}{\subitem} |
| 652 |
% \begin{macro}{\subsubitem} |
| 653 |
% The redefinitions of |\subitem| and |\subsubitem| have to be done |
| 654 |
% separately for each permitted value of \textsf{itemlayout}. |
| 655 |
% Beforehand, we have to set the values of \textsf{hangindent}, |
| 656 |
% \textsf{subindent} and \textsf{subsubindent} to appropriate multiples |
| 657 |
% of \textsf{indentunit}. |
| 658 |
% \begin{macrocode} |
| 659 |
\def\ila@it@abshang{% |
| 660 |
\renewcommand*{\ila@hangindent}{2\ila@indentunit}% |
| 661 |
\renewcommand*{\ila@subindent}{\ila@indentunit}% |
| 662 |
\renewcommand*{\ila@subsubindent}{1.5\ila@indentunit}% |
| 663 |
\renewcommand{\subitem}{\@idxitem\hspace*{\ila@subindent}}% |
| 664 |
\renewcommand{\subsubitem}{\@idxitem\hspace*{\ila@subsubindent}}% |
| 665 |
} |
| 666 |
% \end{macrocode} |
| 667 |
% \end{macro} |
| 668 |
% \end{macro} |
| 669 |
% Defining the function of \textsf{relhang} also starts with setting |
| 670 |
% various indentation values. |\deflength| from the \textsf{etoolbox} |
| 671 |
% package comes in handy for the calculation of the hanging indentations |
| 672 |
% of |\subitem| and |\subsubitem|. |
| 673 |
% \begin{macrocode} |
| 674 |
\def\ila@it@relhang{% |
| 675 |
\renewcommand*{\ila@hangindent}{1.5\ila@indentunit}% |
| 676 |
\renewcommand*{\ila@subindent}{\ila@indentunit}% |
| 677 |
\renewcommand*{\ila@subsubindent}{2\ila@indentunit}% |
| 678 |
\renewcommand{\subitem}{% |
| 679 |
\par |
| 680 |
\deflength{\hangindent}{\ila@hangindent + \ila@subindent}% |
| 681 |
\hspace*{\ila@subindent}% |
| 682 |
}% |
| 683 |
\renewcommand{\subsubitem}{% |
| 684 |
\par |
| 685 |
\deflength{\hangindent}{\ila@hangindent + \ila@subsubindent}% |
| 686 |
\hspace*{\ila@subsubindent}% |
| 687 |
}% |
| 688 |
} |
| 689 |
% \end{macrocode} |
| 690 |
% \begin{macro}{\indexsubsdelim} |
| 691 |
% For \textsf{singlepar}, only the value of \textsf{hangindent} needs to |
| 692 |
% be set. We define |\subitem| and |\subsubitem| as |\unskip| (to remove |
| 693 |
% the space generated by the preceding linebreak in the |ind|-file) plus |
| 694 |
% |\indexsubsdelim| which stores the delimiter. |
| 695 |
% \begin{macrocode} |
| 696 |
\newcommand*{\indexsubsdelim}{; } |
| 697 |
\def\ila@it@singlepar{% |
| 698 |
\renewcommand*{\ila@hangindent}{\ila@indentunit}% |
| 699 |
\renewcommand{\subitem}{\unskip\indexsubsdelim}% |
| 700 |
\renewcommand{\subsubitem}{\unskip\indexsubsdelim}% |
| 701 |
} |
| 702 |
% \end{macrocode} |
| 703 |
% \end{macro} |
| 704 |
% At last, we define the ``radio button'' key \textsf{itemlayout}, which |
| 705 |
% defaults to \textsf{abshang}. |
| 706 |
% \begin{macrocode} |
| 707 |
\ila@defradiokey{itemlayout}{it} |
| 708 |
\setkeys{ila}{itemlayout=abshang} |
| 709 |
% \end{macrocode} |
| 710 |
% \begin{macro}{\ila@initsep} |
| 711 |
% \begin{macro}{\ila@notesep} |
| 712 |
% \begin{macro}{\ila@minspace} |
| 713 |
% We use \textsf{keyval} commands to define and set the key |
| 714 |
% \textsf{initsep}, then \textsf{kvoptions} to define the keys |
| 715 |
% \textsf{notesep} and \textsf{minspace}, this time also specifying |
| 716 |
% default values. |
| 717 |
% \begin{macrocode} |
| 718 |
\newlength{\ila@initsep} |
| 719 |
\define@key{ila}{initsep}{\setlength{\ila@initsep}{#1}} |
| 720 |
\setkeys{ila}{initsep=10\p@ \@plus 5\p@ \@minus 3\p@} |
| 721 |
\DeclareStringOption[\ila@initsep]{notesep} |
| 722 |
\DeclareStringOption[80\p@]{minspace} |
| 723 |
% \end{macrocode} |
| 724 |
% \end{macro} |
| 725 |
% \end{macro} |
| 726 |
% \end{macro} |
| 727 |
% \begin{macro}{\indexspace} |
| 728 |
% The fixed vertical space inserted by |\indexspace| is replaced by the |
| 729 |
% value of \textsf{initsep}. |
| 730 |
% \begin{macrocode} |
| 731 |
\renewcommand{\indexspace}{\par\vspace{\ila@initsep}} |
| 732 |
% \end{macrocode} |
| 733 |
% \end{macro} |
| 734 |
% The boolean option \textsf{columnnote} controls whether a possible |
| 735 |
% prenote is placed within the first index column. |
| 736 |
% \begin{macrocode} |
| 737 |
\DeclareBoolOption{columnnote} |
| 738 |
% \end{macrocode} |
| 739 |
% \begin{macro}{\indexfont} |
| 740 |
% The ``radio button'' key \textsf{font} produces an appropriate |
| 741 |
% definition of |\indexfont|. |
| 742 |
% \begin{macrocode} |
| 743 |
\newcommand*{\indexfont}{} |
| 744 |
\def\ila@fo@current{\renewcommand*{\indexfont}{}} |
| 745 |
\def\ila@fo@normalsize{\renewcommand*{\indexfont}{\normalsize}} |
| 746 |
\def\ila@fo@small{\renewcommand*{\indexfont}{\small}} |
| 747 |
\def\ila@fo@footnotesize{\renewcommand*{\indexfont}{\footnotesize}} |
| 748 |
\ila@defradiokey{font}{fo} |
| 749 |
\setkeys{ila}{font=current} |
| 750 |
% \end{macrocode} |
| 751 |
% \end{macro} |
| 752 |
% \begin{macro}{\indexjustific} |
| 753 |
% The ``radio button'' key \textsf{justific} is responsible for defining |
| 754 |
% |\indexjustific|. With the value \textsf{standard} selected, we (like |
| 755 |
% the \KOMA/-classes) also explicitly set |\parfillskip| to its default |
| 756 |
% value of 0\,pt plus 1\,fil. This way, resettings done outside the |
| 757 |
% |theindex| environment won't affect the justification of index |
| 758 |
% columns. We try to load the \textsf{ragged2e} package at the end of |
| 759 |
% the preamble in order to prevent option clashes. If the package is not |
| 760 |
% available, we issue a warning message and use |\raggedright| instead |
| 761 |
% of |\RaggedRight|. |
| 762 |
% \begin{macrocode} |
| 763 |
\newcommand*{\indexjustific}{} |
| 764 |
\def\ila@ju@standard{% |
| 765 |
\renewcommand*{\indexjustific}{% |
| 766 |
\setlength{\parindent}{\z@}% |
| 767 |
\setlength{\parfillskip}{\z@ \@plus 1fil}% |
| 768 |
}% |
| 769 |
} |
| 770 |
\def\ila@ju@raggedright{\renewcommand*{\indexjustific}{\raggedright}} |
| 771 |
\newcommand*{\ila@RaggedRight}{} |
| 772 |
\def\ila@ju@RaggedRight{% |
| 773 |
\renewcommand*{\indexjustific}{\ila@RaggedRight}% |
| 774 |
} |
| 775 |
\AtEndPreamble{% |
| 776 |
\IfFileExists{ragged2e.sty}{% |
| 777 |
\RequirePackage{ragged2e}% |
| 778 |
\renewcommand*{\ila@RaggedRight}{\RaggedRight}% |
| 779 |
}{% |
| 780 |
\PackageWarning{idxlayout}{% |
| 781 |
Package ragged2e not available, therefore\MessageBreak |
| 782 |
substituting command raggedright for RaggedRight\MessageBreak |
| 783 |
}% |
| 784 |
\renewcommand*{\ila@RaggedRight}{\raggedright}% |
| 785 |
}% |
| 786 |
} |
| 787 |
\ila@defradiokey{justific}{ju} |
| 788 |
\setkeys{ila}{justific=standard} |
| 789 |
% \end{macrocode} |
| 790 |
% \end{macro} |
| 791 |
% \begin{macro}{\ila@prenote} |
| 792 |
% \begin{macro}{\setindexprenote} |
| 793 |
% \begin{macro}{\noindexprenote} |
| 794 |
% We use |\setindexprenote| to specify the text of a possible prenote. |
| 795 |
% |\ila@prenote| typesets the text within a group (to keep font changes |
| 796 |
% local) and inserts the value of \textsf{notesep} as vertical space. |
| 797 |
% |\noindexprenote| defines |\ila@prenote| as |\relax| (which also means |
| 798 |
% that the control sequence test |\ifundef| will yield \textsf{true}). |
| 799 |
% \begin{macrocode} |
| 800 |
\newcommand{\ila@prenote}{} |
| 801 |
\newcommand{\setindexprenote}[1]{% |
| 802 |
\def\ila@prenote{% |
| 803 |
\begingroup#1\par\nobreak\endgroup |
| 804 |
\vspace{\ila@notesep}% |
| 805 |
}% |
| 806 |
} |
| 807 |
\newcommand*{\noindexprenote}{\let\ila@prenote\relax} |
| 808 |
\noindexprenote |
| 809 |
% \end{macrocode} |
| 810 |
% \end{macro} |
| 811 |
% \end{macro} |
| 812 |
% \end{macro} |
| 813 |
% \begin{macro}{\indexstheadcase} |
| 814 |
% The |\indexstheadcase| command allows to avoid hard-coding |
| 815 |
% |\MakeUppercase| into the index header definition (as is currently |
| 816 |
% done by the standard classes). |
| 817 |
% \begin{macrocode} |
| 818 |
\newcommand*{\indexstheadcase}{\MakeUppercase} |
| 819 |
% \end{macrocode} |
| 820 |
% \end{macro} |
| 821 |
% \subsection{Emulating specific document classes and packages} |
| 822 |
% |
| 823 |
% \begin{macro}{\ila@classtype} |
| 824 |
% We store the type of document class we use, differentiating between |
| 825 |
% the \KOMA/-classes (which define |\KOMAClassName|), the \mem/ class |
| 826 |
% and all other (notably the standard) classes. |
| 827 |
% \begin{macrocode} |
| 828 |
\newcommand*{\ila@classtype}{0} |
| 829 |
\@ifclassloaded{memoir}{% |
| 830 |
\def\ila@classtype{2}% |
| 831 |
}{% |
| 832 |
\ifundef{\KOMAClassName}{% |
| 833 |
}{% |
| 834 |
\def\ila@classtype{1}% |
| 835 |
}% |
| 836 |
} |
| 837 |
% \end{macrocode} |
| 838 |
% \end{macro} |
| 839 |
% For any but the \KOMA/- and \mem/ classes, we define the boolean |
| 840 |
% option \textsf{totoc} which is responsible for including the index in |
| 841 |
% the table of contents. If not set, this option defaults to |
| 842 |
% \textsf{false}. |
| 843 |
% \begin{macrocode} |
| 844 |
\ifcase\ila@classtype\relax |
| 845 |
\DeclareBoolOption{totoc}% |
| 846 |
% \end{macrocode} |
| 847 |
% \begin{macro}{\ila@prologue} |
| 848 |
% The command |\ila@prologue| comprises actions at the beginning of the |
| 849 |
% |theindex| environment that must be tailored to the type of document |
| 850 |
% class. For ``other'' classes, the code resembles that of the standard |
| 851 |
% classes \textsf{article}, \textsf{book} and \textsf{report}. |
| 852 |
% |
| 853 |
% Unlike |\twocolumn|, |\begin{multicols}| does not automatically insert |
| 854 |
% a pagebreak, so we use |\chapter*| instead of |\@makeschapterhead|. |
| 855 |
% With that, we also eliminate the need to set |\thispagestyle{plain}| |
| 856 |
% for classes containing the |\chapter| command. (For other classes, we |
| 857 |
% don't want the first index page to show a special pagestyle.) |
| 858 |
% Furthermore, we take our boolean option \textsf{totoc} into account. |
| 859 |
% Note that with version 6.79z of the \textsf{hyperref} package, we can |
| 860 |
% do without inserting |\phantomsection| before |\addcontentsline|. |
| 861 |
% \begin{macrocode} |
| 862 |
\def\ila@prologue{% |
| 863 |
\ifundef{\chapter}{% |
| 864 |
\section*{\indexname}% |
| 865 |
\ifbool{ila@totoc}{% |
| 866 |
\addcontentsline{toc}{section}{\indexname}% |
| 867 |
}{% |
| 868 |
}% |
| 869 |
}{% |
| 870 |
\chapter*{\indexname}% |
| 871 |
\ifbool{ila@totoc}{% |
| 872 |
\addcontentsline{toc}{chapter}{\indexname}% |
| 873 |
}{% |
| 874 |
}% |
| 875 |
}% |
| 876 |
\@mkboth{\indexstheadcase\indexname}{\indexstheadcase\indexname}% |
| 877 |
} |
| 878 |
% \end{macrocode} |
| 879 |
% \end{macro} |
| 880 |
% For the \KOMA/-classes \textsf{scrartcl}, \textsf{scrbook} and |
| 881 |
% \textsf{scrreprt}, we create \textsf{totoc} as a pseudo boolean key |
| 882 |
% using |\ila@defradiokey|. If not set, this key will respect the |
| 883 |
% default behaviour of the class plus any changes carried out before |
| 884 |
% loading \ila/. We also provide |\MakeMarkcase| to ensure compatibility |
| 885 |
% with older versions (below 3.10) of \KOMA/. |
| 886 |
% \begin{macrocode} |
| 887 |
\or |
| 888 |
\def\ila@tc@true{\KOMAoptions{index=totoc}}% |
| 889 |
\def\ila@tc@false{\KOMAoptions{index=nottotoc}}% |
| 890 |
\ila@defradiokey[true]{totoc}{tc}% |
| 891 |
\providecommand{\MakeMarkcase}[1]{#1}% |
| 892 |
% \end{macrocode} |
| 893 |
% Again, |\ila@prologue| is very much a recoding exercise. Note that the |
| 894 |
% \KOMA/-command |\idx@@heading| is responsive to |\KOMAoptions| and |
| 895 |
% therefore to our key \textsf{totoc}. For \textsf{scrbook} and |
| 896 |
% \textsf{scrreprt}, we only use |\setchapterpreamble| if |
| 897 |
% |\index@preamble| is not defined as |\relax|. Thus, we avoid excessive |
| 898 |
% vertical space between the index heading and the first entry. For |
| 899 |
% \textsf{scrartcl}, we drop the special pagestyle of the first index |
| 900 |
% page and also (for the moment) do not use |\index@preamble|. |
| 901 |
% \begin{macrocode} |
| 902 |
\def\ila@prologue{% |
| 903 |
\ifundef{\chapter}{% |
| 904 |
}{% |
| 905 |
\ifundef{\index@preamble}{% |
| 906 |
}{% |
| 907 |
\setchapterpreamble{\index@preamble}% |
| 908 |
}% |
| 909 |
}% |
| 910 |
\idx@@heading{\indexname}% |
| 911 |
\@mkboth{\MakeMarkcase{\indexname}}{\MakeMarkcase{\indexname}}% |
| 912 |
\ifundef{\chapter}{% |
| 913 |
}{% |
| 914 |
\thispagestyle{\indexpagestyle}% |
| 915 |
}% |
| 916 |
} |
| 917 |
% \end{macrocode} |
| 918 |
% For the \mem/ class, our pseudo boolean key \textsf{totoc} will also |
| 919 |
% respect prior settings. |
| 920 |
% \begin{macrocode} |
| 921 |
\or |
| 922 |
\def\ila@tc@true{\boolfalse{noindexintoc}}% |
| 923 |
\def\ila@tc@false{\booltrue{noindexintoc}}% |
| 924 |
\ila@defradiokey[true]{totoc}{tc}% |
| 925 |
% \end{macrocode} |
| 926 |
% Another recoding exercise. Note that with \mem/ and its |
| 927 |
% \textsf{article} option, |\chapter| resembles |\section|. Again, we |
| 928 |
% get rid of special pagestyles, if necessary, and use neither |
| 929 |
% |\@makeschapterhead| nor |\phantomsection|. |
| 930 |
% \begin{macrocode} |
| 931 |
\def\ila@prologue{% |
| 932 |
\chapter*{\indexname}% |
| 933 |
\ifbool{noindexintoc}{% |
| 934 |
}{% |
| 935 |
\addcontentsline{toc}{chapter}{\indexname}% |
| 936 |
}% |
| 937 |
\ifbool{artopt}{% |
| 938 |
}{% |
| 939 |
\thispagestyle{indextitlepagestyle}% |
| 940 |
}% |
| 941 |
\indexmark |
| 942 |
\preindexhook |
| 943 |
} |
| 944 |
\fi |
| 945 |
% \end{macrocode} |
| 946 |
% \begin{macro}{\ila@packindadjust} |
| 947 |
% If the \textsf{index} package is loaded, the command |
| 948 |
% |\ila@packindadjust| will~-- in accordance with the settings for |
| 949 |
% individual indexes~-- redefine |\indexname| and (depending on the |
| 950 |
% state of |\index@prologue| which stores the second optional argument |
| 951 |
% of |\printindex|) reset the argument of |\setindexprenote|. Because |
| 952 |
% the \mem/ class (with built-in features similar to those of the |
| 953 |
% \textsf{index} package) feigns the presence of the package, |
| 954 |
% |\ila@packindadjust| is also let to |\relax| if the reported package |
| 955 |
% date is newer than that of the last official version (v4.2beta). |
| 956 |
% \begin{macrocode} |
| 957 |
\@ifpackageloaded{index}{% |
| 958 |
\@ifpackagelater{index}{2004/01/21}{% |
| 959 |
\let\ila@packindadjust\relax |
| 960 |
}{% |
| 961 |
\def\ila@packindadjust{% |
| 962 |
\edef\indexname{\the\@nameuse{idxtitle@\@indextype}}% |
| 963 |
\ifdefempty{\index@prologue}{% |
| 964 |
}{% |
| 965 |
\setindexprenote{\index@prologue}% |
| 966 |
}% |
| 967 |
}% |
| 968 |
}% |
| 969 |
}{% |
| 970 |
\let\ila@packindadjust\relax |
| 971 |
} |
| 972 |
% \end{macrocode} |
| 973 |
% \end{macro} |
| 974 |
% Having defined the option \textsf{totoc}, we are able to process our |
| 975 |
% options. |
| 976 |
% \begin{macrocode} |
| 977 |
\ProcessKeyvalOptions* |
| 978 |
% \end{macrocode} |
| 979 |
% \begin{macro}{\idxlayout} |
| 980 |
% We define |\idxlayout| as a shorthand for |\setkeys{ila}|. |
| 981 |
% \begin{macrocode} |
| 982 |
\newcommand*{\idxlayout}[1]{\setkeys{ila}{#1}} |
| 983 |
% \end{macrocode} |
| 984 |
% \end{macro} |
| 985 |
% \subsection{Redefining the environment \texttt{theindex}} |
| 986 |
% |
| 987 |
% \begin{environment}{theindex} |
| 988 |
% At the beginning of |theindex|, we check if we are in |
| 989 |
% \textsf{twocolumn} mode, store the result in |@restonecol| and switch |
| 990 |
% to \textsf{onecolumn} mode, if necessary. |
| 991 |
% \begin{macrocode} |
| 992 |
\renewenvironment{theindex}{% |
| 993 |
\ifbool{@twocolumn}{% |
| 994 |
\boolfalse{@restonecol}% |
| 995 |
\onecolumn |
| 996 |
}{% |
| 997 |
\booltrue{@restonecol}% |
| 998 |
}% |
| 999 |
% \end{macrocode} |
| 1000 |
% \end{environment} |
| 1001 |
% |\multicolsep| is set to 0\,pt, again in order to avoid excessive |
| 1002 |
% vertical space after the index heading. Also, the \mem/ lengths |
| 1003 |
% |\indexcolsep| and |\indexrule| (now responsive to the \ila/ options |
| 1004 |
% \textsf{columnsep} and \textsf{rule}) are put in charge. Note that in |
| 1005 |
% order to be effective, this has to be done before opening a |
| 1006 |
% |multicols| environment. |
| 1007 |
% \begin{macrocode} |
| 1008 |
\setlength{\multicolsep}{\z@}% |
| 1009 |
\setlength{\columnsep}{\indexcolsep}% |
| 1010 |
\setlength{\columnseprule}{\indexrule}% |
| 1011 |
% \end{macrocode} |
| 1012 |
% The necessary adjustments to the \textsf{index} package are carried |
| 1013 |
% out. |
| 1014 |
% \begin{macrocode} |
| 1015 |
\ila@packindadjust |
| 1016 |
% \end{macrocode} |
| 1017 |
% \begin{macro}{\ila@prologueplus} |
| 1018 |
% If a single-column index is requested, we simply execute |
| 1019 |
% |\ila@prologue|, switch to |\indexfont| and (if the boolean option |
| 1020 |
% \textsf{columnnote} is disabled) typeset a possible prenote. In case |
| 1021 |
% of two or more columns, we do all this inside the first optional |
| 1022 |
% argument of a properly chosen |multicols| (or, if the boolean option |
| 1023 |
% \textsf{unbalanced} is enabled, |multicols*|) environment and specify |
| 1024 |
% the value of \textsf{minspace} as its second optional argument. |
| 1025 |
% \begin{macrocode} |
| 1026 |
\def\ila@prologueplus{% |
| 1027 |
\ila@prologue |
| 1028 |
\indexfont |
| 1029 |
\ifbool{ila@columnnote}{% |
| 1030 |
}{% |
| 1031 |
\ila@prenote |
| 1032 |
}% |
| 1033 |
}% |
| 1034 |
\ifnumcomp{\theidxcols}{<}{\tw@}{% |
| 1035 |
\ila@prologueplus |
| 1036 |
}{% |
| 1037 |
\ifbool{ila@unbalanced}{% |
| 1038 |
\begin{multicols*}{\theidxcols}[\ila@prologueplus][\ila@minspace]% |
| 1039 |
}{% |
| 1040 |
\begin{multicols}{\theidxcols}[\ila@prologueplus][\ila@minspace]% |
| 1041 |
}% |
| 1042 |
}% |
| 1043 |
% \end{macrocode} |
| 1044 |
% \end{macro} |
| 1045 |
% We set |\parskip| to 0\,pt plus 0.3\,pt (exactly as in the standard |
| 1046 |
% classes) and switch to the proper justification. For the |
| 1047 |
% \textsf{scrartcl} class, we append its index preamble. We also typeset |
| 1048 |
% a possible prenote in case \textsf{columnnote} is enabled. Last, but |
| 1049 |
% not least, we redefine |\item|. |
| 1050 |
% \begin{macrocode} |
| 1051 |
\setlength{\parskip}{\z@ \@plus 0.3\p@}% |
| 1052 |
\indexjustific |
| 1053 |
\ifundef{\chapter}{% |
| 1054 |
\ifundef{\index@preamble}{% |
| 1055 |
}{% |
| 1056 |
\index@preamble\par\nobreak |
| 1057 |
}% |
| 1058 |
}{% |
| 1059 |
}% |
| 1060 |
\ifbool{ila@columnnote}{% |
| 1061 |
\ila@prenote |
| 1062 |
}{% |
| 1063 |
}% |
| 1064 |
\let\item\@idxitem |
| 1065 |
% \end{macrocode} |
| 1066 |
% At the end of |theindex|, we close a possible |multicols| (or |
| 1067 |
% |multicols*|) environment and switch back to \textsf{twocolumn} mode, |
| 1068 |
% if necessary. |
| 1069 |
% \begin{macrocode} |
| 1070 |
}{% |
| 1071 |
\ifnumcomp{\theidxcols}{<}{\tw@}{% |
| 1072 |
}{% |
| 1073 |
\ifbool{ila@unbalanced}{% |
| 1074 |
\end{multicols*}% |
| 1075 |
}{% |
| 1076 |
\end{multicols}% |
| 1077 |
}% |
| 1078 |
}% |
| 1079 |
\ifbool{@restonecol}{% |
| 1080 |
}{% |
| 1081 |
\twocolumn |
| 1082 |
}% |
| 1083 |
} |
| 1084 |
% \end{macrocode} |
| 1085 |
% The end of the package. |
| 1086 |
% \begin{macrocode} |
| 1087 |
\endinput |
| 1088 |
% \end{macrocode} |
| 1089 |
% |
| 1090 |
% \Finale |
| 1091 |
\endinput |