2

I'm stuck again. -.- I'm currently creating a template for my projects works, thesis, ... and I tried to structure it with \include what really worked fine till now:

\documentclass[pdftex,12pt,oneside]{report}
\usepackage[pdftex]{graphicx}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{titlesec}
\titleformat{\section}{\Large\bfseries}{\thesection}{1em}{\textsc}
\parindent0em
\usepackage{setspace}
\usepackage[paper = a4paper, margin = 1in, includehead, showframe]{geometry}
\usepackage{fancyhdr}
\fancypagestyle{titlepage}
{....}
\fancypagestyle{dhbw}
{....}
\fancypagestyle{restriction}
{....}
\fancypagestyle{project_work}
{
    \fancyhf{}
    \fancyfoot[R]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}

\begin{document}
    \include{title_page}
    \restoregeometry
    \include{restriction_note}
    \include{progress_report}
    \restoregeometry
    \tableofcontents
    \include{introduction}
\end{document}

As you can see this is my main document and everything works fine till the TOC section. Indifferent where I insert the \pagestyle{project_work} it keeps ignoring the command and just puts the page number in the middle of the footer. The other headers contains graphics, but they'll be displayed correctly.

I searched the web and the threads, but I couldn't find any useful answer. It keeps driving me crazy and I think I'm overlooking something, but I don't know what.

  • 1
    \tableofcontents issues \thispagestyle{plain}, so you have to say also \fancypagestyle{plain}{...} adding the settings you want. – egreg Jun 21 '13 at 21:58
  • @egreg +1 for the right answer. :) I knew I was missing something. So easy and yet I overlooked it. You wanna post this as an answer? – Chris.V Jun 21 '13 at 22:10
2

The commands \tableofcontents, \listoffigures, \listoftables, \part and \chapter issue also a

\thispagestyle{plain}

command. So, if you want non standard headers and footers in the initial pages for those document parts, you need to setup

\fancypagestyle{plain}
  {<settings>}

where <settings> are what you want in the fancyhdr syntax.

|improve this answer|||||
  • Isn't there a way to do this without altering the plain style? I don't mean to alter \chapter either, but why can a \thispagestyle{...} not be overwritten by another \thispagestyle{...}? – mafp Jun 21 '13 at 22:40
  • @mafp If the TOC has more than one page, typing \tableofcontents\thispagestyle{plain} will instruct LaTeX to use the plain page style in the last TOC page. If you want to selectively alter the page style on initial pages you need to patch the commands. – egreg Jun 21 '13 at 22:42

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.