0

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
\lhead{Project tile}
\renewcommand{\headrulewidth}{2.0pt}% Width of the top line
\renewcommand{\footrulewidth}{1.0pt} 
\setlength{\headheight}{13.6pt}%used to remove the \fancyhf{} \headheight error
\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?

0

1 Answer 1

2

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
\lhead{Project tile}
\renewcommand{\headrulewidth}{2.0pt}% Width of the top line
\renewcommand{\footrulewidth}{1.0pt} 
\setlength{\headheight}{13.6pt}%used to remove the \fancyhf{} \headheight error
\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
    includeheadfoot,
    headsep=5mm,
    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).

2
  • 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
    Commented Mar 9, 2017 at 16:13
  • @UniStuffz I've edited my answer to reduce the white space
    – Skillmon
    Commented Mar 9, 2017 at 16:20

You must log in to answer this question.

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