2

The page number indicated in the contents sections and the actual page number do not match up. Contents page

The Abstract should start at page i, List of abbreviations should start on page iv. While Acknowledgements, Contents, and list of figures are numbered correctly, the list figures is on a completely different scheme !

I have been using ..

\documentclass[12pt, parskip=full]{report}
\usepackage[doublespacing]{setspace}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[letterpaper, left=1.5in, right=1in, top=1in, bottom=1in,]{geometry}
\usepackage{adjustbox}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}

\usepackage{tocbibind}

\begin{document}
\maketitle

\pagenumbering{roman}   
\input{abstr}
\addcontentsline{toc}{chapter}{Abstract}

\input{ack}
\addcontentsline{toc}{chapter}{Acknowledgements}

\input{abbrev}
\addcontentsline{toc}{chapter}{List of Abbreviations}

\tableofcontents
\listoffigures
\listoftables


\pagenumbering{arabic}  
\part{Introduction}
\input{intro}

For the chapters titled Abstract, Acknowledgements and List of Abbreviations, I'm using the command:

\*chapter{Chapter Name}

Any help as to how to get the page numbering correctly would be really appreciated. Thanks in advance !

EDIT: Page number of the section List of Tables have been corrected by using

\clearpage

after

\listoftables
3
  • 2
    Welcome to TeX.SE. Surely, you mean \chapter*, not \*chapter. And the \addcontentsline commands are too late then, they occur after \input. They should put right after \chapter*
    – user31729
    Commented Feb 15, 2018 at 19:38
  • Sorry about that, I did mean \chapter*. And putting \addcontentsline' right after \chapter*` fixed the problem. Thank you so much !
    – YesBerry
    Commented Feb 15, 2018 at 20:04
  • You could also use this: github.com/johannesbottcher/unnumberedtotoc
    – Johannes_B
    Commented Mar 30, 2018 at 7:18

1 Answer 1

1

In order for the chapter title and its corresponding entry in the ToC to have the same page number, the issue of \chapter* and \addcontentsline should be done on the same page (\chapter already includes a call to \addcontentsline so they will appear on the same page).

Using

\input{<chapter-file>.tex}
\addcontentsline{toc}{chapter}{<chapter title>}

will only work if the contents of <chapter-file>.tex doesn't exceed the setting of a single page. And this is rarely the case for a "chapter", in general.

Your solution would be one of the following approaches:

  1. Include the line

    \addcontentsline{toc}{chapter}{<chapter title>}
    

    as part of your <chapter-file>.tex immediately following the \chapter* command.

  2. If you don't have access to <chapter-file>.tex, or wish to keep the chapter text separate from layout constructions, you can also use

    \cleardoublepage
    \addcontentsline{toc}{chapter}{<chapter title>}
    \input{<chapter-file>}
    

    Since \addcontentsline doesn't set any content, the \chapter* issued within \input{<chapter-file>} will still occur on the same page and therefore provide the correct page within the ToC.

  3. Automate the process by using switches: \addstarchaptertotoc starts the insertion of \chapter*'s titles into the ToC while \removestarchapterfromtoc reverts to the old format where \chapter* is not added to the ToC.

    Here is the code you'd need to automate this process (with some help from xparse):

    \usepackage{xparse}
    
    \let\oldchapter\chapter % Copy \chapter into \oldchapter
    \NewDocumentCommand{\starchaptotoc}{s o m}{%
      \IfBooleanTF{#1}
        {\oldchapter*{#3}% \chapter*
         \addcontentsline{toc}{chapter}{#3}% Add chapter title to ToC
        }
        {\IfValueTF{#2}
          {\oldchapter[#2]{#3}}% \chapter[.]{..}
          {\oldchapter{#3}}% \chapter{..}
        }%
    }
    
    \newcommand{\addstarchaptertotoc}{\renewcommand{\chapter}{\starchaptotoc}}
    \newcommand{\removestarchapterfromtoc}{\renewcommand{\chapter}{\oldchapter}}
    

I'd probably go with option (2).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .