Page LayoutHeader Footer Margins

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Header Footer Margins

Post by nkal »

Hi,

I want my document header and footer to be wider than the main body of the text. How can I do that? I am using fancyheadings package currently.

Thank you,
NKal

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
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header Footer Margins

Post by localghost »

The fancyheadings package is obsolete. Change to titlesec and study Section 5 (Page styles, p. 12ff) of its manual. If you want to use fancyhdr, take a look at Section 12 (The width of the headers and footers, p. 12f) of the according manual.


Best regards and welcome to the board
Thorsten
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Header Footer Margins

Post by nkal »

Thank you, Thorsten.

I used the titlesec package. I am still not able to make the header and footer go longer than the text on both sides. I have some more packages added. This is what I have in my code so far in regard to the header & footer:

Code: Select all

\usepackage{fancyheadings}
\usepackage{ifthen}
\usepackage{titlesec}

\setlength{\oddsidemargin}{0.25in}
\setlength{\hoffset}{0.2in}
\setlength{\textwidth}{5.8in}
\setlength{\topmargin}{0.6in}
\setlength{\voffset}{-0.5in}
\setlength{\textheight}{8.8in}

\pagestyle{fancy}
\headheight 30pt
\footskip 40pt

\rhead{}
\lhead{\fancyplain{}{\ifthenelse{\thepage=1}{}{\textbf{\parbox{6.5in}{\fontsize{11pt}{30pt}\fontfamily{phv}\selectfont{\footnotesize{I Want a wide header  \hspace{0.4in} XXXX}\small{100010} \hspace{0.7in} \small{PAGE} \small{\thepage}} \\ }}}}}
\rhead{\fancyplain{}{\ifthenelse{\thepage=1}{}{\parbox{6.5in}{\fontsize{11pt}{0pt}\fontfamily{phv}\selectfont{\hspace{4.2in}\small{ \textbf{Checking Report 2}}} }}}}

\cfoot{}
\lfoot{\parbox{6.3in}{\fontsize{11pt}{0pt}\fontfamily{phv}\selectfont{\textbf{WASHINGTON (CNN) -- The federal government is at risk of being unable to fight off attacks on the nation's computer networks unless it strengthens its cyber-security work force, according to a report released Wednesday.}}}}

\widenhead[0.5in][0.5in]{0.5in}{0.5in}
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Re: Header Footer Margins

Post by nkal »

O Well! I could get it to work with fancyhdr package allright!

Thank you for the references and the welcome!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header Footer Margins

Post by localghost »

Your are still loading the obsolete fancyheadings package and you set up your headers and footers with it. Although you additionally load the titlesec package, you don't use it. Moreover you should only use one of those packages. Looking at your header and footer setup, I suggest to use fancyhdr because it will be easier to translate your setup to its syntax. Please refer to its manual for detailed explanations. Especially Section 12 (The width of the headers and footers, p. 12f) is of interest for you.
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Header Footer Margins

Post by nkal »

Hello Thorsten,

I could get the right margins for the header and footer. However, I have a new issue now. The head separation increases from page 2 to 3. The whole text shifts downwards after the header on page 3. So the position of the header does not change but rest everything moves almost 24 pt downwards vertically.

May be my textwidth and other margins dont add up. I have the code included.

Would you know a possible reason for this?

Thanks a ton!
NKal

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mitpress}
\usepackage{chicago}
\usepackage{alltt}
\usepackage{fancyhdr}
\usepackage[dvips]{graphicx}
\usepackage{ulem}
\usepackage{ifthen}

% ******************* page settings *****************************************
\newdimen\dummy
\dummy=\oddsidemargin
\setlength{\oddsidemargin}{0.25in}
\setlength{\hoffset}{0.2in}
\setlength{\textwidth}{5.8in}
\setlength{\topmargin}{0.6in}
\setlength{\voffset}{-0.5in}
\setlength{\textheight}{8.8in}


% ******************* HEADER & FOOTER ******************************************
\pagestyle{fancy}
\headheight 0.33in
\headsep 0.25in
%\footskip 40pt

\rhead{}
\lhead{\fancyplain{}{\ifthenelse{\thepage=1}{}{\textbf{\parbox{6.8in}{\fontsize{11pt}{30pt}\fontfamily{phv}\selectfont{\footnotesize{I Want a wide header  \hspace{0.4in} XXXX}\small{100010} \hspace{0.7in} \small{PAGE} \small{\thepage}} \\ }}}}}
\rhead{\fancyplain{}{\ifthenelse{\thepage=1}{}{\parbox{6.8in}{\fontsize{11pt}{0pt}\fontfamily{phv}\selectfont{\hspace{4.2in}\small{ \textbf{Checking Report 2}}} }}}}

\cfoot{}
\lfoot{\parbox{6.8in}{\fontsize{11pt}{0pt}\fontfamily{phv}\selectfont{\textbf{WASHINGTON (CNN) -- The federal government is at risk of being unable to fight off attacks on the nation's computer networks unless it strengthens its cyber-security work force, according to a report released Wednesday.}}}}

\fancyhfoffset[L]{0.5in}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}

% BODY TEXT HERE

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header Footer Margins

Post by localghost »

Forget all the stuff concerning the page settings and set up the page dimensions with geometry. Note that mitpress also affects the page dimensions and think about if you really need that package.

Omit the dvips driver option for the graphicx package. It detects on its own which compiler is running and loads the right driver automatically.
nkal
Posts: 17
Joined: Fri Jul 10, 2009 8:57 pm

Re: Header Footer Margins

Post by nkal »

Thank you, Thorsten. I removed all the redundant packages. Though the body text and footer are still jumping downwards from page 3 on, I guess its okay.
Post Reply