From 6b0dcb9e80b278925d59a4f25e7881269eba8c54 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Wed, 29 Jul 2015 09:14:36 +0200 Subject: [PATCH] Place the index in the table of content. --- myclass.cls | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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/ -- 2.51.0