Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my thesis and use the book class under PhDthesisPSnPDF.

I would like to remove the dots in table of contents only for a particular entry like "Appendix". All the entries for chapter and section in the table of contents have dots and page numbers, I need to get rid of page number and the dots for the appendix in the TOC. Is there way to do?

share|improve this question
    
Can You please add a link to the PhDthesisPSnPDF? Is it this one? –  Kurt Sep 12 '12 at 18:45
    
Hi Kurt, you are right this is the one i use. –  user6629 Sep 12 '12 at 19:00
    
But the linked PDF does not show any dots for chapters. So what packages are you including that is causing these dots to appear for chapters? –  Werner Sep 12 '12 at 19:21

1 Answer 1

up vote 12 down vote accepted

A heading command like \section{A} writes a line into the .toc file that looks like this:

\contentsline {section}{\numberline {1.1}A}{2}

when this is read back in \contentsline{section} simply expands to \l@section and that is then the command that picks up the remaining arguments and produces the toc entry. Most often (but not always) this command is defined as a special instance of \@dottedcontentsline, e.g., in the book class you find:

\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}

So to get rid of the dots in some cases there are different approaches possible and the depend on how things are defined and which entries you have to change in reality.

Plan A

Assuming that your toc uses \@dottedtoclinethen to get rid of the dots we can redefine \@dotsep to have a very high number. Assuming further, that we only want to change the sections at the end of the toc and we do not need to have dots appearing later on again. Then the following in front of the appendix in the source document will do the trick:

\makeatletter
\addtocontents{toc}{\def\string\@dotsep{100}}
\makeatother

This will write \def\@dotsep{100} into the toc file and from that point on the dots are gone.

If you need them back at a later point issue

\makeatletter
\addtocontents{toc}{\def\string\@dotsep{4.5}}  % 4.5 might be a different value in your class
\makeatother

Plan B

Make the heading commands in the appendix area or whenever you want a different toc style not write \contentsline{section}but, say, \contentsline{appsection} and then define \l@appsection to format the toc entry according to the desired style.

For this one would need to look for the places in the heading commands that issue \addcontentsline and change that code.

Fairly elaborate but much more general.

share|improve this answer
    
Frank, thank your for your great answer. Plan A did the trick. The appendix chapter was at the very end of the TOC so need to turn it on again. I was looking a solution for so long :) –  user6629 Sep 12 '12 at 21:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.