[Tex/LaTex] Distance between top edge of paper and header

fancyhdrgeometryheader-footermargins

EDIT : Please apologize me. I forget to add two lines to MWE I think very essential to handle the problems. Please re-check the MWE.

There is parameter defining distance between bottom edge of top margin and first baseline of body, called \topskip. Existence of such parameter encourage me to search for parameter defining distance between top edge of paper to (first line of) header text. The aim is to set such a distance to 1.5cm.

At first, I think \voffset could be used, from fancyhdr documentation. After some experiment, including elimination of extra 1 inch to 2.1 cm, I find that it will create kind of inconsistency on top margin with option-setting in geometry package loading. Before setting \voffset, the top margin (distance from top edge of paper to body) is 3 cm. After setting, the margin shrink 0.6 cm roughly.

Moving \voffset setting before \geometry loading has no effect. Setting \headheight to eliminate too-small-warning, adding \includeheadfoot option as suggested by this make top-margin larger than 3 cm.

The requirement is, to make the distance between top edge of paper to top edge of header text 1.5 cm, meanwhile preserving top margin of paper 3cm.

Note that top margin here is distance between top edge of paper to top edge of paragraph/text body/main

Here is MWE before setting \headheight and \includeheadfoot.

\documentclass[12pt, a4paper, onecolumn, oneside, final]{report}

\newlength{\theDistance}
\setlength{\theDistance}{1.5cm}
\addtolength{\theDistance}{-2.1cm} %instead 1 inch extra in fancyhdr documentation
\setlength{\voffset}{\theDistance}
%\usepackage[paper=a4paper,headheight=0pt,left=4cm,top=3cm,right=3cm,bottom=3cm,showframe]{geometry}
\usepackage[paper=a4paper,headheight=27.1pt,left=4cm,top=3cm,right=3cm,bottom=3cm, includeheadfoot, showframe]{geometry}
\setlength{\footskip}{0.5cm}
\setlength{\topskip}{8.2pt}    

\usepackage{fancyhdr}
\fancypagestyle{plain}
{% 
    \fancyhf{}% 
    \fancyfoot[C]{\thepage}% 
    \fancyfoot[R]{\footnotesize {\fontfamily{phv}\selectfont{\bo{Dummy University}}}} 
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}%

\begin{document}
Some text blah blah blah
\end{document}    

Best Answer

Set headsep=1.05cm, headheight=0.75cm, top=1.2cm. The sum of them is 3cm and the layout is the one you want.

MWE (I've added two lines, one at 1.5cm and one at 3cm just to show that it works, remove them):

\documentclass[12pt, a4paper, onecolumn, oneside, final]{report}

\usepackage[paper=a4paper,headsep=1.05cm,headheight=0.75cm,left=4cm,top=1.2cm,right=3cm,bottom=3cm,includeheadfoot]{geometry}
\setlength{\footskip}{0.5cm}
\setlength{\topskip}{8.2pt}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\begin{document}
\section{test}
Some text blah blah blah

% this is just to show the correct layout

\begin{tikzpicture}[remember picture, overlay]
    \draw ($(current page.north west) +(0,-1.5cm)$) --
          ($(current page.north east) +(0,-1.5cm)$);
    \draw ($(current page.north west) +(0,-3cm)$) --
          ($(current page.north east) +(0,-3cm)$);
\end{tikzpicture}

\end{document}

Output:

enter image description here