1

I could not figured out why I'm getting different positions of headers and footers in different pages (please see MWE below). Any help in this regard will be highly appreciated. Thanks

\documentclass[12pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm, headheight=3pt, footskip=3pt}


\usepackage{calligra}
\usepackage{amssymb}
\usepackage{pifont}

\usepackage{setspace}

\usepackage{marvosym} 
\usepackage{wasysym}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{hyperref}
\hypersetup{colorlinks=true,citecolor=blue, linkcolor=blue}

\fancyhf{}
\fancyhead[C]{
\begin{minipage}[t]{1\columnwidth}
\vspace{-0.4cm}\hspace{-0.0cm}\begin{minipage}[t]{0.15\paperwidth}%
\vspace{0bp}
\includegraphics[width=3.2cm,height=3.1cm]{Test}%
\end{minipage}
\hspace{0.05cm}\begin{minipage}[t]{0.6\paperwidth}%
\vspace{0bp}
\begin{center}
\textbf{\Huge{Journal of University\\and College\\}}
\textbf{\large{Recognized By XYZ\\}}
\textbf{\LARGE{Review Pro-forma\\}}
\large{(For ASDFG)}
\end{center}
\end{minipage}
\end{minipage}
%\noindent\makebox[\linewidth]{\rule{\paperwidth}{1.5pt}}
\vspace{0.0cm}
}

\fancyfoot[C]{
 \vspace*{-4.0cm} 
  \noindent\makebox[\linewidth]{\rule{\paperwidth}{0.75pt}} 
  \textbf{\Large{University \& College\\}}
ASDDDDDDDDDDD DDDDDDDDDDDDD FFFFFFFFFFFFFFFFFFFFFFFFF fffffffffffffffff ggg\\
\small{jjjjjjjjjjjj kkkkkkkkkkkkkk lllllllllllllllllll mmmmmmmmmmmmmmmmmm nnnnnnnnnnnnnnn oooooooooooooo ppppppppp}
}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength\headheight{3.0cm}


\pagestyle{fancy}

\makeatletter
\let\ps@plain\ps@fancy 
\makeatother


\usepackage{babel}
\usepackage{blindtext}

\begin{document}

\blindtext[10]

\newpage{}

\blindtext[1]

\end{document}

Test.png is given below.

Test

4
  • You are getting a warning in the log concerning the headheight. Read it, follow the instructions.
    – Johannes_B
    Mar 9 '16 at 7:32
  • Wow, a bounty for that question. You are getting a warning in the log concerning the headheight. Read it, follow the instructions.
    – Johannes_B
    Mar 10 '16 at 7:04
  • Having a closer look at the example: Scrap all that useless definitions and start from scratch. Nesting of minipages (percent paperwidth in columnwidth) and wildely using vertical and horizontal spacing. Your question is not why is it different but how can i do it.
    – Johannes_B
    Mar 10 '16 at 7:07
  • @Johannes_B: Would highly appreciate if you guide me how to do it. Thanks
    – MYaseen208
    Mar 10 '16 at 10:22
2
+50

A few points: You import packages several times, and you also set various parameters more than once, which is somewhat confusing. Generally, I would advise against using geometry and fancyhdr in the same document. Well, that's just a matter of taste, but it does make matters more complicated.

Instead of using the vanilla article class, consider using scrartcl from the KOMA-script packages. It allows to you to set the page geometry and customize headers and footers. Its syntax is also much nicer than fancyhdr and the likes.

That being said, here is a take at your document. Is this what you were looking for?

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\usepackage[a4paper]{geometry}
\geometry{verbose, left=2cm, right=2cm, top=20mm, bottom=8cm}
\usepackage{setspace}

\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{graphicx}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength\headheight{116pt}

\fancyhf{}
\fancyhead[C]{
\begin{minipage}[t]{1\columnwidth}
\vspace{-0.4cm}\hspace{-0.0cm}\begin{minipage}[t]{0.15\paperwidth}%
\vspace{0bp}
\includegraphics[width=3.2cm,height=3.1cm]{Test}%
\end{minipage}
\hspace{0.05cm}\begin{minipage}[t]{0.6\paperwidth}%
\vspace{0bp}
\begin{center}
\textbf{\Huge{Journal of University\\and College\\}}
\textbf{\large{Recognized By XYZ\\}}
\textbf{\LARGE{Review Pro-forma\\}}
\large{(For ASDFG)}
\end{center}
\end{minipage}
\end{minipage}
%\noindent\makebox[\linewidth]{\rule{\paperwidth}{1.5pt}}
\vspace{0.0cm}
}

\fancyfoot[C]{
\centerline{\hskip-4cm\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.75pt}}}
\textbf{\Large{University \& College\\}}
ASDDDDDDDDDDD DDDDDDDDDDDDD FFFFFFFFFFFFFFFFFFFFFFFFF fffffffffffffffff ggg\\
\small{jjjjjjjjjjjj kkkkkkkkkkkkkk lllllllllllllllllll mmmmmmmmmmmmmmmmmm nnnnnnnnnnnnnnn oooooooooooooo ppppppppp}
}

\pagestyle{fancy}

\usepackage{blindtext}

\begin{document}

\blindtext[20]

\end{document}

(Also the top and bottom margins are very narrow; are you sure that is what you want?)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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