Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing a paper with the article document class. The first page contains a large footer than other pages. I want to make it filled with text like the other pages and contains the same footer. a minimal working code is:

\documentclass[11pt]{article}
%\usepackage[width=5cm,height=20cm]{geometry}
\usepackage[b5paper,lmargin=2cm,rmargin=2cm,tmargin=2.5cm,bmargin=4.3cm]{geometry}
\usepackage{graphicx} % for pdf, bitmapped graphics files
%\usepackage{indentfirst}
\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}  % assumes amsmath package installed
%\usepackage{deleq} % to divide on equation
%\usepackage{bbm} % to represent the space dimension
%\usepackage{bbding} % to represent the space dimension
\usepackage{dsfont} %to represent the space dimension
\usepackage{color}
\usepackage{algorithm}
\setcounter{secnumdepth}{3}
\usepackage{multicol}%%%%%%%%%%%%
%\usepackage{lipsum}%%%%%%%%%%%%%%%%%%%
\usepackage{theorem}
\newtheorem{theorem}{Theorem}
\newcounter{tempcount}
\graphicspath{{figures/}}

\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{titlesec}
\titleformat{\section}[block]
  {\fontsize{12}{15}\bfseries\rmfamily}
  {\thesection}
  {1em}
  {}
\titleformat{\subsection}[hang]
  {\fontsize{12}{15}\itshape\rmfamily}
  {\thesubsection}
  {1em}
  {}
\titleformat{\subsubsection}[hang]
  {\fontsize{12}{15}\itshape\rmfamily}
  {\thesubsubsection}
  {1em}
  {}  
%\usepackage{fontspec}
%\setmainfont{Times New Roman}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{} %\fancyfoot[LE,RO]{\thepage}
%\fancyhead[L] {\thepage\\}CO,CE
%\fancyhead[le,ro]{}
\fancyhead[le,ro]{\thepage\\ \it{LPVIOID-Toolbox .}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
%\headsep=10pt
\footskip=13pt

\titlespacing\section{0pt}{6pt}{6pt}
\titlespacing\subsection{0pt}{6pt}{6pt}
\titlespacing\subsubsection{0pt}{6pt}{6pt}

\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\newcommand{\ParGraph}{\\ \indent}
\usepackage[noblocks]{authblk}
\title{\bfseries \fontsize{13}{15}\selectfont
LPVIOID- toolbox}

\author[ ]{\bfseries \fontsize{11}{13}\selectfont Mustafa Rabeei}
\affil[ ]{\itshape \fontsize{10}{15}\selectfont Electrical Engineering Department.
 E-mails: {\tt eng.mustafa.rabeay@gmail. }}

\usepackage{lipsum}

\begin{document}
\date{}
\graphicspath{{figures/}}
\maketitle
\thispagestyle{fancy}
%\thispagestyle{empty}
%\pagestyle{empty}
%\pagestyle{headings}
\setcounter{page}{1}

\pagenumbering{arabic}

\section{the first section}
\lipsum
\section{the second section}
\lipsum[1-10]
\end{document}
share|improve this question
    
Actually I did. Most of the code is a preamble containing the used packages. I leaved it since it affects the header, footer and titles. I want the solution not to make a conflict with any of the settings used. –  user16558 Jun 29 '13 at 1:57
    
Yikes. Alrighty then. I can't be sure, but I think TeX has moved it up slightly to align with the bottom of the text rather than leave a small bit of whitespace there. Either leaving a fair amount of space or no space kind of thing. –  Sean Allred Jun 29 '13 at 2:05
1  
Duplicate of tex.stackexchange.com/questions/59988/… –  mforbes Jun 29 '13 at 2:28
add comment

1 Answer

The problem is a duplicate of question: fancyhdr - anomalous behaviour on first page. You customize the header so that it has two lines (by including a line-break \\).

The solution is to manually set the \headheight to be large enough with a command like

\setlength{\headheight}{25.2pt}

or, as suggested in the documentation when including a multi-line header,

\addtolength{\headheight}{\baselineskip}

If you want a more complete solution that works automatically after several runs, look at heiko-oberdiek's answer to a related question.

Details

The issue is that fancyhdr does not "look a head" to see what content will appear in the header on each page before it typesets it. This content is potentially dynamic, and can therefore have different heights, hence it simply checks to see if the current height will fit in the allocated \headheight space on each page. If not, it emits a warning with the current height of the header and suggests that you set the \headheight to a larger value.

See also the discussion in this answer.

Here is a minimal example demonstrating the problem.

\documentclass[11pt]{article}
\newcommand{\hdrparams}{%
  textheight=\the\textheight, voffset=\the\voffset,
  headheight=\the\headheight, headsep=\the\headsep}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[c]{\hdrparams}
\usepackage{lipsum}

%\setlength{\headheight}{26pt}  % Hack that fixes the problem.
\begin{document}
\thispagestyle{fancy}
\section{the first section}
\lipsum
\section{the second section}
\lipsum[1-10]
\end{document}

On the first page \headheight=12pt while on the rest \headheight=25.2842pt. This value can be deduced from the warning message from latex the compile output and log:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 25.2842pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

References

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.