1

On first page of Table of Contents there is no header and footer, but on the second page there are a header and a footer.

My question: I don't need any numbering and header/footer on table of content. How can I have the entire table of contents (not only its first page) appear with no header or footer, and have them start at Chapter 1?

\documentclass[tikz,table,twoside,12pt,a4paper]{report}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}
\usepackage{array,tabularx}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[ruled, vlined, linesnumbered]{algorithm2e}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\usepackage{setspace}
\usepackage{subfigure}
\usepackage{subfig}
\usepackage[top=3.5cm, bottom=3.5cm, left=3.5cm, right=2.75cm]{geometry}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{fancyvrb}
\usepackage{color}
\textwidth14cm
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}

\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all}

\usepackage[Lenny]{fncychap}%Sonny, Lenny, Glenn, Conny, Rejne, Bjornstrup and Bjarne
\usepackage{cite}
\usepackage{rotfloat}
\usepackage{subfloat}
\usepackage[titletoc]{appendix}
% load package with ``framed'' and ``numbered'' option.
\usepackage[numbered,autolinebreaks,useliterate]{mcode}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[R]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}

\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}


\begin{document}

\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\title{\textbf{THESIS NAME}\\
\begin{figure}[ht]
\centering
\includegraphics[width=0.5\textwidth]{logo.eps}
\end{figure}
}

\date{}
\author{\textbf{SUBMITTED BY:}\\\textbf{STUDENT NAME}
\vspace{5mm}
\\
\textbf{Supervised By}\\
\textbf{NAME}\quad
\vspace{10mm}
\\
\textbf{DEPARTMENT OF COMPUTER SCIENCE} \\\textbf{NAME OF UNIVERSITY}        \\\textbf{Session:2012-2013} }
\maketitle

\null
\vfill
\null
\vfill
\onehalfspacing
\newpage
\pagenumbering{roman}
\chapter* {PROJECT APPROVAL}
SAKASLJFSAJFKSAJFJEIJ S\KJ\\\\
\newline
COMMITTEE\\\\
\newline
\begin{flushleft}
External Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Internal Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Chairman: \line(1,0){250}
 \end{flushleft}
 \begin{flushleft}
 Comments: \line(1,0){250}
 \end{flushleft}

\chapter* {DEDICATION}
 KSAHDSAFH ASK JFASKJF

\chapter* {ABSTRACT}
 XCLSCSAJFSAFOSAFISADKFLASKFL;ASKSAKFLKSALKFS

\chapter* {ACKNOWLEDGEMENT}
LSAFLDSFJ SDAFJIASFAS JFSJAF SFSFAUI DSAF
\chapter* {AUTHOR'S DECLARATION}
ABC
\newline
Signature of Authors\\
\newline
ABC: \xblackout{forty       two}\\
\newline
ABC: \xblackout{forty     two}\\
\newline
Date: \xblackout{forty     two}\\



\newpage
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\tableofcontents

\pagenumbering{arabic}
\input{ch1}
\input{ch2}
\input{ch3}
\input{ch4}
\input{ch5}
\input{ch6}
\input{ch7}
\input{ch8}


\addcontentsline{toc}{section}{\textbf{Bibliography}}
\bibliographystyle{plain}
\bibliography{bibk}


\end{document} 

enter image description here

  • 2
    That is done on purpose. tableofcontents uses a \clearpage and \thispagestyle{empty}, so no headers/footers and page numbers are shown – user31729 Jun 20 '14 at 12:12
  • 2
    Please post a MWE also, your document is by far not a minimal WE... and it is not working too ;-), so its just an E... – user31729 Jun 20 '14 at 12:13
  • @Christian Hupfer MWE stand for? – Micky K Jun 20 '14 at 12:19
  • MWE = minimally working example, see Welcome to TeX.SX! please – user31729 Jun 20 '14 at 12:22
  • 1
    @LaTeXKhan While an image is always useful to help understanding what the question is about, it cannot replace a clearly formulated question, written in proper english. If Christian had no interest, he wouldn't have answered. And if I had no interest, I wouldn't have editted the question to save it from being closed. I agree though that our messages are not really constructive and should be deleted now. – T. Verron Jun 20 '14 at 14:45
3

I do not know whether this output is intended, but I \relaxed basically the \thispagestyle{} command within a \renewcommand{\tableofcontents}, so that actually headers etc. are applied.

Edit: The first version of this question was quite unclear or even contradicting, so I used this answer, but I will not update it.

The important lines are

\let\LaTeXStandardTOC\tableofcontents%
\renewcommand{\tableofcontents}{%
\begingroup
\renewcommand{\thispagestyle}[1]{%
\relax% Do nothing at all
}%
\LaTeXStandardTOC%
\endgroup
}%

The renewcommand{\thispagestyle} to do nothing must be grouped, so that it is effective only there and works as expected when other calls to that command occur.


\documentclass[tikz,table,twoside,12pt,a4paper]{report}
\usepackage{blindtext}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}
\usepackage{array,tabularx}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[ruled, vlined, linesnumbered]{algorithm2e}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\usepackage{setspace}
\usepackage{subfigure}
\usepackage{subfig}
\usepackage[top=3.5cm, bottom=3.5cm, left=3.5cm, right=2.75cm]{geometry}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{fancyvrb}
\usepackage{color}
\textwidth14cm
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}

\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all}

\usepackage[Lenny]{fncychap}%Sonny, Lenny, Glenn, Conny, Rejne, Bjornstrup and Bjarne
\usepackage{cite}
\usepackage{rotfloat}
\usepackage{subfloat}
\usepackage[titletoc]{appendix}
% load package with ``framed'' and ``numbered'' option.
%\usepackage[numbered,autolinebreaks,useliterate]{mcode}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[R]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}

\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}


\begin{document}

\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\title{\textbf{THESIS NAME}\\
\begin{figure}[ht]
\centering
%\includegraphics[width=0.5\textwidth]{logo.eps}
\end{figure}
}

\date{}
\author{\textbf{SUBMITTED BY:}\\\textbf{STUDENT NAME}
\vspace{5mm}
\\
\textbf{Supervised By}\\
\textbf{NAME}\quad
\vspace{10mm}
\\
\textbf{DEPARTMENT OF COMPUTER SCIENCE} \\\textbf{NAME OF UNIVERSITY}        \\\textbf{Session:2012-2013} }
\maketitle

\null
\vfill
\null
\vfill
\onehalfspacing
\newpage
\pagenumbering{roman}
\chapter* {PROJECT APPROVAL}
%SAKASLJFSAJFKSAJFJEIJ S\KJ\\\\
%\newline
COMMITTEE\\ % \\
\newline
\begin{flushleft}
External Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Internal Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Chairman: \line(1,0){250}
 \end{flushleft}
 \begin{flushleft}
 Comments: \line(1,0){250}
 \end{flushleft}

\chapter* {DEDICATION}
 KSAHDSAFH ASK JFASKJF

\chapter* {ABSTRACT}
 XCLSCSAJFSAFOSAFISADKFLASKFL;ASKSAKFLKSALKFS

\chapter* {ACKNOWLEDGEMENT}
LSAFLDSFJ SDAFJIASFAS JFSJAF SFSFAUI DSAF
\chapter* {AUTHOR'S DECLARATION}
ABC
\newline
Signature of Authors\\
\newline
ABC: \xblackout{forty       two}\\
\newline
ABC: \xblackout{forty     two}\\
\newline
Date: \xblackout{forty     two}\\

\newpage
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\tableofcontents

\pagenumbering{arabic}

\chapter{Number 1}
\blindtext
\chapter{Number 2}
\section{1}
\section{2}
\section{3}
\section{4}
\section{5}
\section{6}
\section{7}
\section{8}
\section{9}

\blindtext

\chapter{Number 3}
\blindtext

\chapter{Number 4}
\blindtext

\chapter{Number 5}
\blindtext

\chapter{Number 6}
\blindtext

\chapter{Number 7}
\section{1}
\section{2}
\section{3}

\blindtext

\chapter{Number 8}
\blindtext


%\input{ch1}
%\input{ch2}
%\input{ch3}
%\input{ch4}
%\input{ch5}
%\input{ch6}
%\input{ch7}
%\input{ch8}


\addcontentsline{toc}{section}{\textbf{Bibliography}}
\bibliographystyle{plain}
\bibliography{bibk}


\end{document}

enter image description here

Note I had to comment some lines to make the example compile!

Edit Solution without header and footer for TOC If \pagestyle{fancy} is active while \tablecontents is to be shipped out, there is no wonder that this will hold for the second and following pages of the TOC too. So shift the \pagestyle to a place afterwards, apply a \clearpage before.

\documentclass[tikz,table,twoside,12pt,a4paper]{report}
\usepackage{blindtext}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}
\usepackage{array,tabularx}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[ruled, vlined, linesnumbered]{algorithm2e}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\usepackage{setspace}
\usepackage{subfigure}
\usepackage{subfig}
\usepackage[top=3.5cm, bottom=3.5cm, left=3.5cm, right=2.75cm]{geometry}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{fancyvrb}
\usepackage{color}
\textwidth14cm
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}

\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all}

\usepackage[Lenny]{fncychap}%Sonny, Lenny, Glenn, Conny, Rejne, Bjornstrup and Bjarne
\usepackage{cite}
\usepackage{rotfloat}
\usepackage{subfloat}
\usepackage[titletoc]{appendix}
% load package with ``framed'' and ``numbered'' option.
%\usepackage[numbered,autolinebreaks,useliterate]{mcode}

\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[R]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}

\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}


\begin{document}

\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\title{\textbf{THESIS NAME}\\
\begin{figure}[ht]
\centering
%\includegraphics[width=0.5\textwidth]{logo.eps}
\end{figure}
}

\date{}
\author{\textbf{SUBMITTED BY:}\\\textbf{STUDENT NAME}
\vspace{5mm}
\\
\textbf{Supervised By}\\
\textbf{NAME}\quad
\vspace{10mm}
\\
\textbf{DEPARTMENT OF COMPUTER SCIENCE} \\\textbf{NAME OF UNIVERSITY}        \\\textbf{Session:2012-2013} }
\maketitle

\null
\vfill
\null
\vfill
\onehalfspacing
\newpage
\pagenumbering{roman}
\chapter* {PROJECT APPROVAL}
%SAKASLJFSAJFKSAJFJEIJ S\KJ\\\\
%\newline
COMMITTEE\\ % \\
\newline
\begin{flushleft}
External Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
Internal Examiner: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Comments: \line(1,0){250}
\end{flushleft}
\begin{flushleft}
 Chairman: \line(1,0){250}
 \end{flushleft}
 \begin{flushleft}
 Comments: \line(1,0){250}
 \end{flushleft}

\chapter* {DEDICATION}
 KSAHDSAFH ASK JFASKJF

\chapter* {ABSTRACT}
 XCLSCSAJFSAFOSAFISADKFLASKFL;ASKSAKFLKSALKFS

\chapter* {ACKNOWLEDGEMENT}
LSAFLDSFJ SDAFJIASFAS JFSJAF SFSFAUI DSAF
\chapter* {AUTHOR'S DECLARATION}
ABC
\newline
Signature of Authors\\
\newline
ABC: \xblackout{forty       two}\\
\newline
ABC: \xblackout{forty     two}\\
\newline
Date: \xblackout{forty     two}\\


\let\LaTeXStandardTOC\tableofcontents%
\renewcommand{\tableofcontents}{%
\begingroup
\renewcommand{\thispagestyle}[1]{%
\relax% Do nothing at all
}%
\LaTeXStandardTOC%
\endgroup
}%

\newpage
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\clearpage
\tableofcontents

\clearpage%
\pagestyle{fancy}


\pagenumbering{arabic}

\chapter{Number 1}
\blindtext
\chapter{Number 2}
\section{1}
\section{2}
\section{3}
\section{4}
\section{5}
\section{6}
\section{7}
\section{8}
\section{9}

\blindtext

\chapter{Number 3}
\blindtext

\chapter{Number 4}
\blindtext

\chapter{Number 5}
\blindtext

\chapter{Number 6}
\blindtext

\chapter{Number 7}
\section{1}
\section{2}
\section{3}

\blindtext

\chapter{Number 8}
\blindtext


%\input{ch1}
%\input{ch2}
%\input{ch3}
%\input{ch4}
%\input{ch5}
%\input{ch6}
%\input{ch7}
%\input{ch8}


\addcontentsline{toc}{section}{\textbf{Bibliography}}
\bibliographystyle{plain}
\bibliography{bibk}


\end{document} 

enter image description here

  • I don't need header n footer as well as also numbering on Table of content. – Micky K Jun 20 '14 at 12:48
  • @LaTeXKhan: So, what was your question then? – user31729 Jun 20 '14 at 12:53
  • my Question is that I don't need any numbering and header footer on table of content. Just simply show me Table of Content and from Chapter 1 is start the numbering with header n footer. – Micky K Jun 20 '14 at 13:05
  • @LaTeXKhan: That is not stated in your question ;-) – user31729 Jun 20 '14 at 13:31

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.