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.

Despite following many suggestions on the net, I have the following issue. I am using TeXnicCenter and MiKTeX. [I have posted the same on Latex Community Forum]. I have not used/tried the tocloft package yet. I am currently using the thesis2 class.

Objective: In my table of contents, I want a text "Chapter" without the dotted lines and the page number. Eg.,

============================================

Table of Contents

Acknowledgments ................ ii

Abstract ........................ v

Chapter

1 Introduction .................. 1

1.1 Network Design .............. 1

1.1.1 Steiner Tree Problems ..... 2

============================================

Trial-1: When I do \addcontentsline{toc}{chapter}{\protect Chapter}, it adds the required text (Chapter) to toc. But, the dotted lines and page number is present.

Trial-2: The same happens when I do \addcontentsline{toc}{chapter}{\protect \numberline{}Chapter}.

Q1) Also, I want only one-line spacing between "Chapter" and "1 Introduction". Currently, I get 2 line-spacing (like between Acknowledgments and Abstract). How do I get rid of that 2 line spacing and make it 1-line spacing?

share|improve this question
    
Did you have a look at this question tex.stackexchange.com/questions/9289/toc-without-page-numbers? –  Thorsten Apr 19 '11 at 5:24

2 Answers 2

Use \addtocontents instead of \addcontentsline, and add positive and negative vertical space as appropriate. (Note: I used the thesis2 class file available here.)

\documentclass{thesis2}

\begin{document}

\tableofcontents

\frontmatter

\chapter{Acknowledgments}

\chapter{Abstract}

\mainmatter

\addtocontents{toc}{%
 \protect\vspace{1em}% 
 \protect\noindent Chapter\protect\par
 \protect\vspace{-1em}%
}

\chapter{Introduction}

\section{Network design}

\end{document}
share|improve this answer
    
Lockstep - Many thanks for this neat solution. Really appreciate. –  srinivas Apr 19 '11 at 13:40
    
@srinivas: Please consider marking my answer as ‘Accepted’ by clicking on the tickmark below its vote count. –  lockstep Apr 19 '11 at 15:36

Here's an alternative solution based on the suggestions here. It's 'cleaner' in the sense that you don't set spacing and indentation explicitly:

\documentclass{article}
\newcommand{\notocnumsection}[1]{
  \bgroup%
  \renewcommand*{\addcontentsline}[3]{\addtocontents{##1}{\protect\contentsline{##2}{##3}{}}}%
  \section{#1}%
  \egroup
}
\begin{document}
\tableofcontents
\section{foo}
This is the foo section.
\notocnumsection{bar}
This is the bar section.
\section{baz}
This is the baz section.
\end{document} 

It does not, however, address your wish regarding spacing. But I believe you should think about changing the spacing once for all chapter-level toc entries. For that, I think the tocloft package should be useful (documentation here).

share|improve this answer

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.