I want to create a report for my project and I wrote a code but it is showing some error in table of contents. The page numbering goes fine in the beginning but as chapter 1 starts its shows the numbering as 2 but in the document the page numbering is 1. The document should be about 50 pages. Here is the sample of the code I wrote:
\documentclass[12pt,a4paper]{report}
\usepackage{lipsum}
\usepackage[explicit]{titlesec}
\titleformat{\chapter}[display]{\bfseries\centering}{\huge Chapter \thechapter}{1em}{\Huge #1}
\usepackage{pgf}
\usepackage{pgfpages}
\pgfpagesdeclarelayout{boxed}
{
\edef\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
}
\pgfpageslogicalpageoptions{1}
{
border code=\pgfsetlinewidth{2pt}\pgfstroke,%changes the width of border
border shrink=\pgfpageoptionborder,%
resized width=.95\pgfphysicalwidth,%change the size of border
resized height=.95\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%make the border to
display in center
}%
}
\pgfpagesuselayout{boxed}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[a4paper,left=1.5in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{graphicx}
\begin{document}
\begin{center}
\thispagestyle{empty}
\parskip=8pt%
\vspace*{1\parskip}%
\textbf{SYNCHRONOUS \& ASYNCHRONOUS DESIGN}
\textbf{Project Title}
A Project Report Submitted in Partial Fulfillment of the Requirements for the Degree of
\parskip=20pt
\textbf{Course}
\parskip=4pt
\textbf{Branch}
\textit{By}
\parskip=8pt%
\textbf{Name of Student}
\textbf{College ID}
\begin{figure}[ht]
\includegraphics[width=2.2098cm, height=2.2098cm]{image1}
\centering
\label{4}
\end{figure}
\textit{Under the supervision of}
\parskip=24pt%
\textbf{Guide Name}
\parskip=4pt
\textbf{Guide Designation}
\textbf{Company Address}
\begin{figure}[ht]
\includegraphics[width=2.8cm, height=2.8cm]{image}
\centering
\label{7}
\end{figure}
\textbf{College Department}\\
\textbf{College name}\\
\textbf{College Address}\\
\textbf{Jan-June (2020)}
\end{center}
\addcontentsline{toc}{chapter}{CERTIFICATE}
\chapter*{CERTIFICATE}
\pagenumbering{roman}
This is the certificate.
\addcontentsline{toc}{chapter}{ACKNOWLEDGMENT}
\chapter*{ACKNOWLEDGMENT}
Acknowledgment
\addcontentsline{toc}{chapter}{ABSTRACT}
\chapter*{ABSTRACT}
Abstract goes here.....
\addcontentsline{toc}{chapter}{CONTENTS}
\tableofcontents
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables
\chapter{INTRODUCTION}
\pagenumbering{arabic}
Introduction
\section{section}
\subsection{part}
\end{document}
I tried different solutions available online but none of them works for me. Can someone help me with this?
\phantomsectionmight help with your numbering problem - see this answer – fcbsd Mar 27 '20 at 16:33\pgfpagesuselayout{boxed}--- don't use it and the ToC numbering is correct. I can't help with the\pgfpagesuselayoutcode but I don't like the result --- in your MWE the page numbers in the ToC extend into the black border. – Peter Wilson Mar 27 '20 at 18:46\nofilesand compile again). Arguably this is not a very convenient solution (and it can be called a bug inpgfpages, especially forlogical pages=1), but it works. – Marijn Mar 30 '20 at 13:07\addcontentslineshould come after the chapter title. For the list of figures etc. it should come before, but you should clear the page first so\addcontentslineknows a new page is about to start. With that I get the following result: https://imgur.com/a/I25NT8r with the following code: – Marijn Mar 31 '20 at 07:53\pgfpagesuselayout{boxed}\nofiles[...]\chapter*{CERTIFICATE} \pagenumbering{roman} \addcontentsline{toc}{chapter}{CERTIFICATE} certificate \chapter*{ACKNOWLEDGMENT} \addcontentsline{toc}{chapter}{ACKNOWLEDGMENT} Ack. \chapter*{ABSTRACT} \addcontentsline{toc}{chapter}{ABSTRACT} Abstract \cleardoublepage \addcontentsline{toc}{chapter}{CONTENTS} \tableofcontents \cleardoublepage \addcontentsline{toc}{chapter}{LIST OF FIGURES} \listoffigures \cleardoublepage \addcontentsline{toc}{chapter}{LIST OF TABLES} \listoftables \chapter{INTRODUCTION} \pagenumbering{arabic} Intro– Marijn Mar 31 '20 at 07:56