0

I am changing a pre-built template for my thesis. There is a main file named thesis.tex in which all the chapter files, references files and appendices files are included. The structure of this file is as follows

\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{chapter4}
\include{chapter5}
\include{chapter6}
\include{chapter7}


% NEED TO CHANGE THE SECTION NUMBER FOR REFERENCES ACCORDINGLY
\addcontentsline{toc}{chapter}{8 \hskip 3.55em References}

\bibliographystyle{IEEEtran}  
\bibliography{references}

% COMMENT THE LINES ABOUT APPENDIX OUT IF YOU DO NOT HAVE THIS SECTION.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                 %
%                            APPENDICES                           %
%                                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage\pagestyle{plain}
\theappendix

% NEED TO CHANGE THE SECTION NUMBER FOR REFERENCES ACCORDINGLY.
\addcontentsline{toc}{chapter}{9 \hskip 3.55em Appendices}

\include{appendix1}
%\include{appendix2}
\include{appendix3}

Problem:
The problem is with the appendices section. My first appedix contains some sections and figures. When i add this section to main file, the contents of this appendix are shown wrongly under other chapter in table of contents.

enter image description here

As you can see that the contents of Appendix are being shown under references chapter. I want them to be shown either under appendices section or completely hide them. What could be the possible solution?

  • Aside: You can/should use \addcontentsline{toc}{chapter}{\protect\numberline{8} References} and \addcontentsline{toc}{chapter}{\protect\numberline{9} Appendices}. – Werner Nov 11 '18 at 5:39
  • Nothing seems amiss with your placement of the appendix within the ToC. Did you compile at least twice to ensure that the ToC entries have settled? – Werner Nov 11 '18 at 5:39
  • I am using sharelatex for editing and I have compiled many times in a single session, also downloaded the pdf. Same issue persists. – Rafay Zia Mir Nov 11 '18 at 6:26
  • Perhaps you can share a link to the project. It's difficult to assess the issue without seeing something we can work with fully. – Werner Nov 11 '18 at 6:56
0

An explanation of the behavior is eg in https://tex.stackexchange.com/a/386799. But the OP there uses a KOMA-Script class and its \addchaptertocentry command.

Suggestion: Replacing \include{appendix1} by \input{appendix1} should solve your issue.


If you really must use \include, then load package scrlfile and use:

\BeforeFile{appendix1.tex}{\addcontentsline{toc}{chapter}{9 \hskip 3.55em Appendices}}%  needs package scrlfile
\include{appendix1}

BTW: Your manual setting of the chapter number looks strange.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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