From: Petter Reinholdtsen Date: Wed, 29 Jul 2015 07:14:36 +0000 (+0200) Subject: Place the index in the table of content. X-Git-Tag: edition-2015-10-10~388 X-Git-Url: https://pere.pagekite.me/gitweb/text-free-culture-lessig.git/commitdiff_plain/6b0dcb9e80b278925d59a4f25e7881269eba8c54?hp=016623e8d77936c16742bde21f669b410be15064 Place the index in the table of content. --- 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/