2

I am writing my thesis. How can I add the chapter of Introduction without number?

I am using:

\documentclass[11pt, twoside, a4paper]{book}

\input introduction   
\addcontentsline{toc}{chapter}{Introduction} 

It works but the problem is that in the table of content it shows Introduction in page 3 while it starts in page 1. enter image description here

Anybody knows why?

  • I think that you are using \section{introduction} in your introduction.tex file. Use \section*{introduction} instead to ignore the regular numeration of the chapters. Then use the \addcontentsline. – Sina Ahmadi Dec 15 '17 at 19:53
  • @Sina I am using \chapter*{Introduction} – Majid Dec 15 '17 at 19:55
  • 2
    Can you please leave an MWE so that I can run your code? – Sina Ahmadi Dec 15 '17 at 19:58
  • 1
    Please tell us what's in introduction.tex. – Mico Dec 15 '17 at 20:16
  • 1
    That's all that's in the file? What exactly are you trying to achieve? – Mico Dec 15 '17 at 20:27
3

Your problem seems to be related to page numbering. You should probably use roman numbers for your first pages and use Arabic numbers from where you really start your thesis. If so, you can use \frontmatter and \mainmatter commands. The pages after the first command and before the second command will be numbered with lowercase Roman numerals. Then, \mainmatter will restart the page counter and change the style to Arabic numbers.

Here is an MWE:

\documentclass[11pt, twoside, a4paper]{book}
\usepackage{lipsum} 
\usepackage[utf8]{inputenc}

\begin{document}

\frontmatter

\addcontentsline{toc}{chapter}{Foreword}
\lipsum[1-3]

\tableofcontents

\mainmatter

\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction} 
\lipsum[1-2]

\chapter{My research plan}
\lipsum[3-4]

\chapter{Methodology}
\lipsum[5-6]

\end{document}

Which creates the following table of contents:

enter image description here

  • I am exactly using \frontmatter and \mainmatter commands. My latex cannot find \usepackage{lipsum} and so I cannot use the comments \lipsum – Majid Dec 15 '17 at 21:00
  • I try to put a picture of the text – Majid Dec 15 '17 at 21:00
1

The problem stems from \chapter* being executing at the start of your introduction.tex, yet you only issue the \addcontentsline after the entire introduction.tex has been read in.

The following code attempts to circumvent all of this by redefining \chapter in such a way that it will issue \addcontentsline at the appropriate time so your ToC entries are correct.

The redefinition of \chapter allows you to use the starred version together with an optional argument as well as a mandatory one. The optional argument will be used for the ToC entry, even if you use it with \chapter*:

enter image description here

\documentclass{book}

% Create a dummy introduction.tex
\usepackage{filecontents,lipsum}
\begin{filecontents*}{introduction.tex}
\chapter*{Introduction}
\sloppy\lipsum[1-50]
\end{filecontents*}

\usepackage{xparse}

\let\oldchapter\chapter
\RenewDocumentCommand{\chapter}{s o m}{%
  \IfBooleanTF{#1}
    {% \chapter*
      \oldchapter*{#3}%
      \IfValueTF{#2}
        {% \chapter*[.]{..}
        \addcontentsline{toc}{chapter}{#2}%
        }{% \chapter*{..}
        \addcontentsline{toc}{chapter}{#3}%
        }%
    }{% \chapter
      \IfValueTF{#2}
        {% \chapter[.]{..}
        \oldchapter[#2]{#3}%
        }{% \chapter{..}
        \oldchapter{#3}%
        }%
    }%
}
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{{%
  \let\chapter\oldchapter
  \oldtableofcontents
}}

\begin{document}

\tableofcontents

\input{introduction}

\end{document}
  • I added the command that you mentioned and it just replaced my introduction with something strange!!!!! – Majid Dec 16 '17 at 18:47
  • @Majid: I did write in my comments that I create a "dummy introduction.tex" for use in my example. Did that overwrite your introduction.tex? Hopefully not... – Werner Dec 16 '17 at 19:01
  • Yes it did :))) But fortunately I had a backup! – Majid Dec 16 '17 at 19:06
  • @Majid: Did my code solve your problem? – Werner Dec 16 '17 at 19:09
  • Not completely. I mean a new problem appears. Now it is in page 1 in the table of content. But it is counted as a single page. I mean it is counted like 1-2, 1-2, 1-2 Problem must be something else. I try to see which command is not correct! – Majid Dec 16 '17 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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