3

I have used fancyhdr package for giving header and footer for my report work and to give header and footer for chapter name beginning, I have used this code:

\makeatletter
\let\ps@plain\ps@fancy
\makeatother

This code works to insert header and footer for chapter beginning. But it also adds header and footer for TOC, LOF and LOT. I don't need header and footer for those. Can anyone help me with this.

Thanks in advance.

1
  • Welcome to TeX.SE!
    – Mico
    Commented Jun 13, 2014 at 12:29

2 Answers 2

2

You can define two different page styles: one for the TOC, LOF and LOT and another for the main text.

\documentclass{report}

\usepackage{fancyhdr}

\fancypagestyle{front}{% style for TOC, LOF, LOT
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \cfoot{\thepage}
}
\fancypagestyle{main}{% style for the mainmatter
  \fancyhf{}
  \renewcommand\headrulewidth{.4pt}
  \fancyhead[C]{\slshape \leftmark}
  \fancyfoot[C]{\thepage}
}
\makeatletter
  \newcommand\frontpagestyle{\cleardoublepage\pagestyle{front}\let\ps@plain\ps@front}
  \newcommand\mainpagestyle{\cleardoublepage\pagestyle{main}\let\ps@plain\ps@main}
\makeatother

\usepackage{blindtext}
\begin{document}
\frontpagestyle% switch to the pagestyle front
\tableofcontents
\listoffigures
\listoftables

\mainpagestyle% switch to the pagestyle main
\Blinddocument\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{positioning}

\begin{document}
0

Switch from pagestyle{fancy} to pagestyle{plain} for the parts where you don't want the headers and footers. E.g. a few lines extracted from my thesis:

%This stuff at the front with roman numbering
%--------------------------------------------
\pagestyle{plain} 
\pagenumbering{roman}

\tableofcontents
\listoffigures
\listoftables

%Main thesis text with arabic numbering
%--------------------------------------
\pagenumbering{arabic}
\pagestyle{fancy}

This is the main text now

I actually think that the commands \frontmatter and \mainmatter might do exactly this, and I intend to look into that in due course. I'm not sure if they're available in all classes though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .