]> pere.pagekite.me Git - text-free-culture-lessig.git/commitdiff
Place the index in the table of content.
authorPetter Reinholdtsen <pere@hungry.com>
Wed, 29 Jul 2015 07:14:36 +0000 (09:14 +0200)
committerPetter Reinholdtsen <pere@hungry.com>
Wed, 29 Jul 2015 07:14:36 +0000 (09:14 +0200)
myclass.cls

index a2aca9882726564cd7d8277058e0eba4a25fbcb1..f6b10c1b5ac9dd78b7acfb3ce57ccdb1d2f8d432 100644 (file)
@@ -5,6 +5,32 @@
 \LoadClassWithOptions{report}
 % report, book, memoir, scrreprt or scrbook ?
 
+% Put the index in the TOC
+\makeatletter
+\let\stdindex=\theindex
+\let\endstdindex=\endtheindex
+\renewenvironment{theindex}{
+  \begin{stdindex}
+  \@ifundefined{chapter}{}{
+    % To not have the number, replace by:
+    % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
+    \ifnum \c@secnumdepth >\z@
+      \ifnum \value{part} >\z@
+        \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
+      \else
+        \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
+      \fi
+    \else
+      \addcontentsline{toc}{chapter}{\indexname}
+    \fi
+  }
+}{
+  \end{stdindex}
+}
+\makeatother
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 % From
 % https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/