[Tex/LaTex] Page numbering error in table of contents

page-numberingtable of contents

I'm preparing my thesis report. My table of contents starts from roman page number (iii) and has a total of 3 pages. But unfortunately the last page of toc shows page number (iii) again. Same is the case for the lof (3 pages). I am using \documentclass[a4paper,12pt]{report}. I'm a beginner in LaTeX, so please help me.

\documentclass[a4paper,12pt]{report}

\setcounter{tocdepth}{3}
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents
\pagenumbering{roman}\setcounter{page}{3}
\clearpage

\addcontentsline{toc}{chapter}{Summary}
\pagenumbering{roman}
\setcounter{page}{6}    
\chapter*{Summary}    
\clearpage

\listoffigures
\pagestyle{plain}
\pagenumbering{roman}
\setcounter{page}{7}
\addcontentsline{toc}{chapter}{\listfigurename}
\clearpage

\listoftables
\pagenumbering{roman}
\setcounter{page}{10}
\addcontentsline{toc}{chapter}{\listtablename}
\clearpage

Best Answer

You shouldn't give repeated \pagenumbering{roman} commands: LaTeX just knows the page numbers.

Be careful to issue the \addcontentsline command at the right time, that is, after a new page has been started.

\documentclass[a4paper,12pt]{report}

\setcounter{tocdepth}{3}

\begin{document}

\cleardoublepage % if some contents comes before
\pagenumbering{roman}\setcounter{page}{3}
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

\cleardoublepage

\addcontentsline{toc}{chapter}{Summary}
\chapter*{Summary}    

\cleardoublepage

\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\cleardoublepage

\addcontentsline{toc}{chapter}{\listtablename}
\listoftables

\cleardoublepage

\pagenumbering{arabic}

\def\one{%
  \chapter{Something}
  \section{A}
  some text
  \section{A}
  some text
  \begin{figure}
  \caption{Whatever}
  \end{figure}
  \section{A}
  some text
  \begin{table}
  \caption{Whatever}
  \end{table}
}
\def\many{\one\one\one\one\one\one\one\one\one\one\one\one\one\one\one}

\many % make as much contents as to produce three pages in the toc

\end{document}

You can vastly simplify the input by using the tocbibind package and the book class.

\documentclass[a4paper,12pt,oneside]{book}
\usepackage{tocbibind}

\setcounter{tocdepth}{3}
\pagestyle{plain} % this is what report uses

\begin{document}

\frontmatter
\setcounter{page}{3}

\tableofcontents

\chapter{Summary}    

\listoffigures

\listoftables

\mainmatter

\def\one{%
  \chapter{Something}
  \section{A}
  some text
  \section{A}
  some text
  \begin{figure}
  \caption{Whatever}
  \end{figure}
  \section{A}
  some text
  \begin{table}
  \caption{Whatever}
  \end{table}
}
\def\many{\one\one\one\one\one\one\one\one\one\one\one\one\one\one\one}

\many

\end{document}

enter image description here