# How to space the header and footer to sit on the text box, without the white space between the header,footer and text?

Due to the details of my project, I can't have any header/footer text beyond 2.0cm. Since the outer margins reject my geometry code, is there any way to make the headers and footers sit exactly on the border of the text box?

\documentclass[11pt]{article}

\usepackage{sectsty,fancyhdr}
\sectionfont{\LARGE\bfseries}%this will keep the formating of sections
\usepackage{geometry}
\usepackage{lipsum}%remove

\pagestyle{fancy}
\fancyhf{}
\rhead{} % right side of upper footer
\renewcommand{\headrulewidth}{2.0pt}% Width of the top line
\renewcommand{\footrulewidth}{1.0pt}
\rfoot{Page \thepage}% opposite of above
\lfoot{\leftmark}% show the name of section

\geometry{% margin settings
paper=a4paper,
inner=2.0cm, % Inner margin
outer=2.0cm, % Outer margin
bindingoffset=0.0cm, % Binding offset
top=2.0cm, % Top margin
bottom=2.0cm, % Bottom margin
showframe,% show how the type block is set on the page
}

\makeatletter
\renewcommand{\sectionmark}[1]{%this avoids the \makecaptical of footers
\markboth{\ifnum \c@secnumdepth>\z@%this allowes symbols in foorters
\thesection\hskip 1em\relax
\fi #1}{}}
\makeatother

\begin{document}

\section{Introduction}
\subsection{Super introduction}
\lipsum[4-11]%remove
\end{document}


Any ideas?

There is an option called includeheadfoot for the geometry. To additionally change the space between the head and the text you might use headsep and for the space between the foot and the text footskip:

\documentclass[11pt]{article}

\usepackage{sectsty,fancyhdr}
\sectionfont{\LARGE\bfseries}%this will keep the formating of sections
\usepackage{geometry}
\usepackage{lipsum}%remove

\pagestyle{fancy}
\fancyhf{}
\rhead{} % right side of upper footer
\renewcommand{\headrulewidth}{2.0pt}% Width of the top line
\renewcommand{\footrulewidth}{1.0pt}
\rfoot{Page \thepage}% opposite of above
\lfoot{\leftmark}% show the name of section

\geometry{% margin settings
paper=a4paper,
inner=2.0cm, % Inner margin
outer=2.0cm, % Outer margin
bindingoffset=0.0cm, % Binding offset
top=2.0cm, % Top margin
bottom=2.0cm, % Bottom margin
showframe,% show how the type block is set on the page
footskip=5mm
}

\makeatletter
\renewcommand{\sectionmark}[1]{%this avoids the \makecaptical of footers
\markboth{\ifnum \c@secnumdepth>\z@%this allowes symbols in foorters
\thesection\hskip 1em\relax
\fi #1}{}}
\makeatother

\begin{document}

\section{Introduction}
\subsection{Super introduction}
\lipsum[4-11]%remove
\end{document}


This results in the foot and head being inside of the specified textheight (outside of the top and bottom margins).

• It's good, but there's still the same amount of white space between the outer and inner margins. So its "shifted" the problem. I'm trying to get the header and footer on the boundary of the current text box, without the white space between the header, footer and the text. – UniStuffz Mar 9 '17 at 16:13
• @UniStuffz I've edited my answer to reduce the white space – Skillmon Mar 9 '17 at 16:20