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.

If I did

\setcounter{chapter}{-1}
\chapter{Introduction}

then I get Chapter 0 Introduction. I just want the word Introduction, and I want it also in the contents when I use

 \tableofcontents

How can I do that?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

If you're working in the book documentclass, then you should use the starred version of \chapter to obtain a chapter without the counter visible. See

\documentclass{book}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction} \markboth{INTRODUCTION}{} \lipsum[1-5]
\chapter{First chapter} \lipsum[6-10]
\chapter{Second chapter} \lipsum[11-15]
\chapter{Last chapter} \lipsum[16-20]
\end{document}​

The addition of \markboth{...}{...} ensures that the correct page heading is followed as with the other regular (unstarred) \chapter{...} commands.

share|improve this answer
    
As @Seamus suggests, you need to compile this at least twice in order for the table of contents entries to be picked up by \tableofcontents. –  Werner Jul 18 '11 at 17:19
    
what is lipsum? –  Peter E Jul 18 '11 at 17:20
    
@Peter The lipsum package is just a package to produce dummy text. It's not required for the solution. –  Alan Munn Jul 18 '11 at 17:22
    
The lipsum package is a LaTeX package for adding dummy text to your document. I just wanted to set up a reasonable-sized document, so I added some dummy text between the chapters. Also, here's some detailed information on the \addcontentsline command. –  Werner Jul 18 '11 at 17:24
1  
You might also want to add \chaptermark{Introduction} to get correct headers. –  lockstep Jul 18 '11 at 17:26
\documentclass{article}

\begin{document}

\tableofcontents
\section*{Introduction}

\addcontentsline{toc}{section}{Introduction}

\section{This is a section}

\end{document}

This needs to be run twice for the introduction to appear.

How LaTeX does tables of contents and similar things (tables of figures...) is that each time it finds a thing of the relevant sort (in this case a section command) it writes that information to a file (in this case file.toc if your main file is file.tex). What \addcontentsline does is it tells LaTeX to pay attention to this extra thing that it wouldn't normally add to the file. The three arguments are (roughly) what file to add the thing to, what sort of thing it is and what to actually add to the file at that point.

Then when it sees \tableofcontents it reads file.toc and outputs the table of contents. (This is why it won't show up on the first run through: it's read \tableofcontents already by the time it gets to \addcontentsline!)

For books, use \chapter* instead of \section* and change section to chapter in the \addcontentsline command

share|improve this answer
    
I'm working with the documentclass book and where there is the introduction in the up part of the page I read CONTENTS because before of the introduction I have the contents, how can I avoid that? –  Peter E Jul 18 '11 at 17:22
    
@Peter E does my edit help or is something else going on? –  Seamus Jul 18 '11 at 17:25

In the »book« class you can divide your document into three parts (front, main, back). This has some effects that should do what you want.

\documentclass[11pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
  \frontmatter
  \tableofcontents

  \chapter{Introduction}

  \mainmatter
  \chapter{Theorie}
  \chapter{Practice}

  \appendix
  \chapter{Notes}

  \backmatter
  \begin{thebibliography}{9}
    \bibitem{key} Bibliogrpahy Item
  \end{thebibliography}
\end{document}
share|improve this answer
2  
Depending on how the Introduction chapter page numbers are supposed to work, this may need some further adjustment, because the \frontmatter material uses lower case roman numbers by default. –  Alan Munn Jul 18 '11 at 18:33

The easiest way to do this is to set the secnumdepth to -1 before the introduction chapter and then set it to whatever value you need for the subsequent chapters after the introduction chapter:

\documentclass{book}

\begin{document}
\frontmatter
\tableofcontents
\setcounter{secnumdepth}{-1}
\mainmatter
\chapter{Introduction}
\setcounter{secnumdepth}{3} % or some other value
\chapter{First Chapter}
\end{document}
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.