Remove unnumbered chapters from TOC

hyperrefindexingtable of contents

I'm using a template my college provided to write my thesis in Latex, and i'm having a minor issue with autoref adding unwanted chapters to the TOC (index), the relevant bit are as such I believe

The code can be seen here:

sty page

main page

chapter to be included in TOC

chapter not to be included in TOC

I tried following this link from stackoverflow, and this post, but I can't seem to figure out the problem, specially because it only started appearing after I used the package hyperref to include the labels in chapters. I know that by doing \chapter*{}, however that does not seem to work since I included hyperref

The index appears like this:

index appear like this

But I don't want the unnumbered entries to appear (I mean Resumo, abstract, Indice, Lista de Tabelas and Lista de Figuras)

Best Answer

After reading the sty file your school provided, I found the following lines:

\newcommand{\myTocXX}[2]
   {
   \chapter*{#1\@mkboth{Conteúdo}{CONTENTS}}
   \addcontentsline{toc}{chapter}{#1}
   \@starttoc{#2}
   }

\newcommand{\myTableOfContents}
   { \myTocXX{Índice}{toc} }

So I guess your college really wants the unnumbered chapters to be in the TOC since they especially put it in the .sty. So I wouldn't recommend you to change it but anyway.

By redefining the \myTocXX macro, you can achieve what you want, you just have to put the following lines before begin{document}:

\makeatletter
\renewcommand{\myTocXX}[2]
   {
   \chapter*{#1\@mkboth{Conteúdo}{CONTENTS}}
   \@starttoc{#2}
   }
\makeatother

And here's my output:

My LaTeX output for the answer

Related Question