2

% Also, how can I reduce the spacing between the front matter in table of contents.

\documentclass[a4paper, 12pt]{report}

\usepackage{fancyhdr}   
\usepackage{titlesec}

\titleformat{\chapter}[display]
 {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-20pt}{20pt}



\pagenumbering{roman}


\begin{document}

\chapter*{\underline{CANDIDATE'S DECLARATION}}%
\addcontentsline{toc}{chapter}{\numberline{}Candidate's Declaration}%
xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

xxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

xxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

\par\noindent\rule{\textwidth}{0.4pt}

\chapter*{\underline{CERTIFICATE}}%
\addcontentsline{toc}{chapter}{\numberline{}Certificate}%
This is to certify that the above statement made by the candidate is correct to best of my knowledge and belief.
\\
\\
\\
\\
\\
\begin{flushright}
xxxxxxxxxxxxxxx\\
 Professor\\
xxxxxxxxxxxxxx\\
xxxxxxxxxxx
\end{flushright}

\tableofcontents

\pagenumbering{arabic}

\chapter{Introduction}

\end{document}

and in center

  • If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). – Mensch Aug 2 '19 at 18:13
1

Well, you can redefine \cleardoublepage and \clearpage to do nothing to get no new page for your second \chapter*{}. To get both chapters centered you have to add \centering in the \titleformat and redefine it after you need not centering any more ...

Please see the following code (dirty hack!):

\documentclass[a4paper, 12pt]{report}

\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{showframe}% <============ to visualize typing area and margins

\titleformat{\chapter}[display]
 {\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
%                          ^^^^^^^^^^  <================================
\titlespacing*{\chapter}{0pt}{-20pt}{20pt}



\pagenumbering{roman}


\begin{document}

\chapter*{\underline{CANDIDATE'S DECLARATION}}%
\addcontentsline{toc}{chapter}{\numberline{}Candidate's Declaration}%
xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

xxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

xxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxx\\

\par\noindent\rule{\textwidth}{0.4pt}\vspace{\baselineskip} % <=====

{\let\cleardoublepage\relax % <=====================================
\let\clearpage\relax % <============================================
\chapter*{\underline{CERTIFICATE}}%
\addcontentsline{toc}{chapter}{\numberline{}Certificate}%
}

This is to certify that the above statement made by the candidate is correct to best of my knowledge and belief.
\vspace{2cm} % <========================================================
\begin{flushright}
xxxxxxxxxxxxxxx\\
 Professor\\
xxxxxxxxxxxxxx\\
xxxxxxxxxxx
\end{flushright}

\titleformat{\chapter}[display] % <=====================================
 {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\tableofcontents

\pagenumbering{arabic}

\chapter{Introduction}

\end{document}

and the result (please see that you should not use several \\ to get a vertical space, use \vspace{2cm} instead and change the value to your needs):

resulting pdf

As you can see (package showframe shows the typing area in the pdf, delete/comment it for real printing) your first chapter is a little bit too long, Certificate is centered, Contents is not centered.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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