Page LayoutFancyhdr redesign plain problem

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
wim
Posts: 3
Joined: Fri May 08, 2009 2:24 pm

Fancyhdr redesign plain problem

Post by wim »

Hi all, I want to use fancyhdr to have header and footer for all my pages. When I redesign the plain pagestyle, not all pages have the new look. Am I missing something here?

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,8pt]{report}
\usepackage[a4paper]{geometry}
\setlength{\textwidth} {374pt}
\setlength{\hoffset} {22pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancypagestyle{plain}{%
\fancyhf{}
\setlength{\headheight}{1cm}
\setlength{\headwidth}{\textwidth}
\fancyhead[L]{\footnotesize left head}
\fancyhead[R]{\footnotesize right head}
\fancyfoot[L]{\footnotesize \nouppercase{\leftmark}}
\fancyfoot[C]{\footnotesize \nouppercase{\rightmark}}
\fancyfoot[R]{\footnotesize \thepage}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.1pt}
}
\begin{document}
\chapter{Lorum}
Lorem ipsum dolor sit amet.
\vspace{500pt}
\section{Maecenas}
Mi Aliquam convallis scelerisque.
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The second page shows the 'old, default' header and footer layout. How is this possible? And more important how to have all pages have the same layout. (also the table of contents)?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Fancyhdr redesign plain problem

Post by Stefan Kottwitz »

Hi wim,

you've changed the plain page style, but not the fancy style, that's used too. With \pagestyle{fancy} you decided to use the fancy page style. The plain page style will be used on chapter starting pages.

Perhaps have a look at Modifying plain page style. There's described how you could use the same page style everywhere.

Stefan
LaTeX.org admin
wim
Posts: 3
Joined: Fri May 08, 2009 2:24 pm

Fancyhdr redesign plain problem

Post by wim »

Hi Stefan,

Thanks for answering.

I've looked at \let\ps@plain\ps@fancy which doesn't seem to work for me.

Further more, I've tried all kind of combinations of
\pagestyle{fancy}
\fancypagestyle{plain}{my style declarations}

also with leaving out the first line but none of these give me the correct result.

I have found a solution. I have to declare the style declarations again for the default (fancy?) page style:
\pagestyle{fancy}
\fancypagestyle{plain}{my style declarations}
{my style declarations}


This give me the same fancy page layout on the first page and all subsequent pages of the same chapter.

Here is my complete document:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,8pt]{report}
\usepackage[a4paper]{geometry}
\setlength{\textwidth} {374pt}
\setlength{\hoffset} {22pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancypagestyle{plain}{%
\fancyhf{}
\setlength{\headheight}{1cm}
\setlength{\headwidth}{\textwidth}
\fancyhead[L]{\footnotesize left head}
\fancyhead[R]{\footnotesize right head}
\fancyfoot[L]{\footnotesize \nouppercase{\leftmark}}
\fancyfoot[C]{\footnotesize \nouppercase{\rightmark}}
\fancyfoot[R]{\footnotesize \thepage}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.1pt}
}
\fancyhf{}
\setlength{\headheight}{1cm}
\setlength{\headwidth}{\textwidth}
\fancyhead[L]{\footnotesize left head}
\fancyhead[R]{\footnotesize right head}
\fancyfoot[L]{\footnotesize \nouppercase{\leftmark}}
\fancyfoot[C]{\footnotesize \nouppercase{\rightmark}}
\fancyfoot[R]{\footnotesize \thepage}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.1pt}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I have a solution, but it is not clear to me how this works and why it couldn't be done with one style declaration.

Wim
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Fancyhdr redesign plain problem

Post by localghost »

wim wrote:[...] I have a solution, but it is not clear to me how this works and why it couldn't be done with one style declaration. [...]
Usually chapter pages have a different layout to mark them and segregate them optically from the rest of the document in case a reader just browses the document.


Best regards
Thorsten
Post Reply