Text Formattingwrong page number in toc

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
shenoivis
Posts: 4
Joined: Mon Mar 23, 2015 6:53 am

wrong page number in toc

Post by shenoivis »

Dear fourm,
I am getting wrong entry in table of contents. also the list of abbrevations is not in its front pages position in toc. please any one help in this regard.the code i use for your reference please.
also, is there any method to suppress the figures that are in appendices not to enter the list of figures.

Code: Select all

\documentclass[a4paper,12pt,oneside]{report}
\usepackage{fontspec}
 \setmainfont{Times New Roman}
\setcounter{secnumdepth}{5}
\usepackage{setspace}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{array,book tabs,multirow}
\usepackage{ragged2e}
\usepackage{indentfirst}
\usepackage{verbatim}
\usepackage[margin=1in]{geometry}
%added by vshenoi
\usepackage{titlesec}
%added by vshenoi
\usepackage[author year]{natbib}
%\usepackage{url}
%\usepackage{rotating}
%\usepackage{longtable}
%\usepackage[flushleft]{threeparttable}
%\usepackage[flushleft,referable]{threeparttablex}
\usepackage[titletoc,toc,title,page]{appendix}
\usepackage{floatrow}
\usepackage[singlelinecheck=true % <-- important
]{caption}
\usepackage{float}
\restylefloat{table}
\floatplacement{table}{H}
\floatsetup[table]{capposition=top}
%added by vshenoi
\renewcommand{\chaptername}{\textbf {CHAPTER}}{\Large}
\titlespacing*{\chapter}{0pt}{0.5in}{0.3in}
\titleformat{\chapter}[display]
        {\bfseries\Large\centering}{\chaptertitlename\ \thechapter}{0pt}{\Large\uppercase}
\titleformat{\section}{\large\bfseries}{\thesection}{1em}{\Large\uppercase}
%added by vshenoi
\renewcommand{\arraystretch}{1}
\newcolumntype{L}{>{\centering\arraybackslash}m{4cm}}
\newcolumntype{M}[1]{>{\arraybackslash}m{#1}}
\renewcommand{\arraystretch}{1}
\newcolumntype{L}{>{\centering\arraybackslash}m{4cm}}
\newcolumntype{M}[1]{>{\arraybackslash}m{#1}}
\renewcommand{\bibname}{Reference}
\oddsidemargin -0.1in
\textheight 9.2in
\textwidth 6.5in
\begin{document}
%\frontmatter

\pagenumbering{roman}
\include{title}
\include{Bc}
\include{certificate}
\include{ack}
\cleardoublepage\addtocontents{toc}{\textbf{CHAPTER NO.} \hfill \textbf{TITLE}\hfill \textbf{PAGE NO.}\par}

\setcounter{page}{5}
\cleardoublepage
\include{abstract}
\cleardoublepage\addcontentsline{toc}{chapter}{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ABSTRACT}
\listoffigures
\cleardoublepage\addcontentsline{toc}{chapter}{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~List of Figures}
\listoftables
\cleardoublepage\addcontentsline{toc}{chapter}{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~List of Tables}
\tableofcontents
%\mainmatter
\doublespacing
\clearpage\pagenumbering{arabic}
%\justify
\include{1_introduction}
\include{2_systemanalysis}
\include{3_systemdesign}
\include{4_chapter}
\include{5_chapter}
\end{document}
Last edited by Stefan Kottwitz on Tue Mar 24, 2015 5:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

wrong page number in toc

Post by Johannes_B »

Hi and welcome, you are including files in your document, that i don't have. Result is a three page pdf, but all the page numbers in the toc are correct. Please try to present a minimal test case that lets us see the real problem.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
shenoivis
Posts: 4
Joined: Mon Mar 23, 2015 6:53 am

wrong page number in toc

Post by shenoivis »

Dear fourm,

earlier code

Code: Select all

#######################################################
\include{abstract}
\cleardoublepage\addcontentsline{toc}{chapter}~~~~~~~~~~~~~~~~~ABSTRACT}
#######################################################
i changed the order of the \addcontentsline and included \phantomsection which solved the problem
the new code is

Code: Select all

******************************************
\clearpage\phantomsection\addcontentsline{toc}{chapter}{~~~~~~ABSTRACT}
\include{abstract}
******************************************
Thank you Stefan K andJohannes B
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: wrong page number in toc

Post by Stefan Kottwitz »

Great, that it works, and thank you for telling the solution!

Stefan
LaTeX.org admin
Post Reply