I want to have a variety of page styles used throughout my document, with different header and footer formats / content.
I'm having trouble with getting the footer to not flow off the page.
The work-around I have used is to set the positioning absolutely, as per example below:
\documentclass[12pt, a4paper]{article}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage[margin=2cm, includefoot]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage{mdwlist}
\usepackage{titlesec}
\fancypagestyle{firstpagestyle}
{
\fancyhf{} % clear all header and footer fields
\chead{
\LARGE \textbf{Common Header} \\
\small diff header line 1 \\
\small diff header line 2 \\
}
\cfoot{\thepage \ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{2pt}
\setlength\headheight{60pt}
\setlength{\footskip}{15pt}
}
\fancypagestyle{otherpagesstyle} {
\fancyhf{} % clear all header and footer fields
\chead{
\LARGE \textbf{Common Header} \\ \small
}
\cfoot{\thepage \ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{2pt}
\setlength{\headheight}{33pt}
\setlength{\footskip}{42pt}
}
\pagestyle{otherpagesstyle}
%==============================================
\begin{document}
\thispagestyle{firstpagestyle}
%==============================================
\subsection*{Section0}
\vspace{-0.4em}
\blindtext
%==============================================
\subsection*{Section1}
\vspace{-0.4em}
\hrule
\vspace{1em}
\blinditemize
\blindtext
\blinditemize
\blindtext
%==============================================
\subsection*{Section2}
\vspace{-0.4em}
\hrule
\vspace{1em}
\blindtext
\blinditemize
\blindtext
\blinditemize
\blindtext
\blinditemize
\blindtext
\end{document}
However I'm not satisfied with this solution as it doesn't seem like it will scale well for more complicated documents, not to mention coupling between the header / footer / text area, so that a change to one will possibly require a (manually calculated) change to all.
I have tried to alter the textheight attribute per pagestyle but 'firstpagestyle' doesn't seem to overload the default settings (eg \pagestyle{otherpagesstyle}
)....
Is there a neater way to do this?
\headheight
and\footskip
as part of the page style. Bad things happen.\headheight is too small
?