X-Git-Url: https://pere.pagekite.me/gitweb/text-free-culture-lessig.git/blobdiff_plain/016623e8d77936c16742bde21f669b410be15064..6b0dcb9e80b278925d59a4f25e7881269eba8c54:/myclass.cls?ds=inline

diff --git a/myclass.cls b/myclass.cls
index a2aca98..f6b10c1 100644
--- a/myclass.cls
+++ b/myclass.cls
@@ -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/
 
