]> granicus.if.org Git - python/commitdiff
Added support for storing information to build a module index.
authorFred Drake <fdrake@acm.org>
Fri, 2 Jan 1998 02:57:41 +0000 (02:57 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 2 Jan 1998 02:57:41 +0000 (02:57 +0000)
Enhance the "theindex" environment to add an entry to the table of contents.

Doc/myformat.sty

index c502c31f5d0d040672d8b530a81a03bbfd78ab55..e4c9ff571c9a5a7478767d8731954a7f367e709f 100644 (file)
 \newcommand{\refbimodindex}[1]{\refmodule{#1}{built-in }}
 \newcommand{\refstmodindex}[1]{\refmodule{#1}{standard }}
 
+% support for the module index
+\newwrite\modindexfile
+\openout\modindexfile=modules.idx
+
 % Add the defining entry for a module
-\newcommand{\defmodindex}[2]{\index{#1@{\tt#1} (#2module)|textbf}}
+\newcommand{\defmodindex}[2]{\index{#1@{\tt#1} (#2module)|textbf}%
+  \write\modindexfile{#1 \thepage}}
 \newcommand{\bimodindex}[1]{\defmodindex{#1}{built-in }}
 \newcommand{\stmodindex}[1]{\defmodindex{#1}{standard }}
 
 \newenvironment{seealso}[0]{{\bf See Also: }}{\par}
 \newcommand{\seemodule}[2]{\ref{module-#1}: {\tt #1} (#2)}
 \newcommand{\seetext}[1]{\par{#1}}
+
+% Fix the theindex environment to add an entry to the Table of Contents;
+% this is much nicer than just having to jump to the end of the book and
+% flip around, especially with multiple indexes.
+%
+\let\OldTheindex=\theindex
+\def\theindex{%
+  \OldTheindex%
+  \addcontentsline{toc}{chapter}{\indexname}%
+}