0

I'm creating a document with a box in the header and an other one in the footer.

But I would like to have the same space between the bottom of the top box and header rule and between the top of the bottom box and the footer rule.

Here is an example:

\documentclass[onecolumn,twoside,openright,a4paper,11pt]{report}    

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

\usepackage{xcolor} 
\usepackage{blindtext}
\usepackage{lipsum}


%\usepackage[top=2.25cm, bottom=1.5cm, left=2.25cm, right=2.25cm]{geometry} 

\usepackage{layout}
%\setlength{\hoffset}{1cm}          % 1
%\setlength{\voffset}{1cm}          % 2
%\setlength{\oddsidemargin}{0.5cm}  % 3 
%\setlength{\evensidemargin}{-0.5cm}    
%\setlength{\topmargin}{.cm}        % 4
%\setlength{\headheight}{17pt}      % 5 
%\setlength{\headsep}{.5cm}         % 6 
%\setlength{\textheight}{1cm}       % 7 
%\setlength{\textwidth}{1cm}        % 8
%\setlength{\marginparsep}{1cm}     % 9
%\setlength{\marginparwidth}{1cm}   % 10 
%\setlength{\footskip}{1.5cm}       % 11 
%\setlength{\marginparpush}{1cm}    % 12
\setlength{\parindent}{57pt}

\usepackage{fancyhdr}   
\fancyhf{}

\lhead[\textcolor{black}{A}]{\textcolor{gray}{B}}
\chead{\textcolor{red}{\fbox{C}}}               
\rhead[\textcolor{black}{D}]{\textcolor{gray}{E}}       
\lfoot[\textcolor{gray}{page \thepage}]{\textcolor{gray}{F}}    
\cfoot{\textcolor{red}{\fbox{G}}}                               
\rfoot[\textcolor{black}{\today}]{\textcolor{gray}{page \thepage / }}       

\fancyhfoffset{50pt}
\renewcommand{\headrule}{{%
    \color{red}\hrule \headwidth \headrulewidth \vskip-\headrulewidth}}
\renewcommand\footrulewidth{\headrulewidth}
\renewcommand{\footrule}{{%
     \color{blue}\vskip-\footruleskip\vskip-\footrulewidth
\hrule \headwidth \footrulewidth\vskip\footruleskip}}

\pagestyle{fancy}       

\begin{document}        
\lipsum \lipsum 
\end{document}

I tried to change all the values in the layout options but none of them change the space between the C fbox and the header rule or between the G fbox and the footer rule. I found nothing on the Internet about this kind of settings.

Someone can help me to solve this ?

0

if you open up the \setlength{\footskip}{1.5cm} command in preamble you can achieve what you wanted to do

  • 3
    A full example would make this a real answer. – user31729 Aug 23 '14 at 6:05
0

Full Code

\documentclass[onecolumn,twoside,openright,a4paper,11pt]{report}    

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

\usepackage{xcolor} 
\usepackage{blindtext}
\usepackage{lipsum}


%\usepackage[top=2.25cm, bottom=1.5cm, left=2.25cm, right=2.25cm]{geometry} 

\usepackage{layout}
%\setlength{\hoffset}{1cm}          % 1
%\setlength{\voffset}{1cm}          % 2
%\setlength{\oddsidemargin}{0.5cm}  % 3 
%\setlength{\evensidemargin}{-0.5cm}    
%\setlength{\topmargin}{.cm}        % 4
%\setlength{\headheight}{17pt}      % 5 
%\setlength{\headsep}{.5cm}         % 6 
%\setlength{\textheight}{1cm}       % 7 
%\setlength{\textwidth}{1cm}        % 8
%\setlength{\marginparsep}{1cm}     % 9
%\setlength{\marginparwidth}{1cm}   % 10 
\setlength{\footskip}{1.5cm}       % 11 
%\setlength{\marginparpush}{1cm}    % 125
\setlength{\parindent}{57pt}

\usepackage{fancyhdr}   
\fancyhf{}

\lhead[\textcolor{black}{A}]{\textcolor{gray}{B}}
\chead{\textcolor{red}{\fbox{C}}}               
\rhead[\textcolor{black}{D}]{\textcolor{gray}{E}}       
\lfoot[\textcolor{gray}{page \thepage}]{\textcolor{gray}{F}}    
\cfoot{\textcolor{red}{\fbox{G}}}                               
\rfoot[\textcolor{black}{\today}]{\textcolor{gray}{page \thepage / }}       

\fancyhfoffset{50pt}
\renewcommand{\headrule}{{%
    \color{red}\hrule \headwidth \headrulewidth \vskip-\headrulewidth}}
\renewcommand\footrulewidth{\headrulewidth}

\renewcommand{\footrule}{{%
     \color{blue}\vskip-\footruleskip-\vskip-\footrulewidth
\hrule \headwidth \footrulewidth\vskip\footruleskip}}

\pagestyle{fancy}       

\begin{document}        
\lipsum \lipsum 
\end{document}
  • 1
    Please edit your other answer and add the code there instead of posting a new one. – jubobs Aug 23 '14 at 11:16
  • That is a good try but not really what I expected. Maybe I didn't make it clear. What I would like to change is the space between the red box created by the line \chead{\textcolor{red}{\fbox{C}} and the red line created by the line \renewcommand{\headrule}{{ \color{red}\hrule \headwidth \headrulewidth \vskip-\headrulewidth}} the command \setlength{\footskip}{1.5cm} allows to change the space between the main text (here \lipsum) and the footer, so this is not the same things. – R. N Aug 24 '14 at 19:09
0

I found a solution by adding a vertical space vspace to the ruler. I think this can be useful, thus here is the code:

\documentclass[onecolumn,twoside,openright,a4paper,11pt]{report}    
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}    
\usepackage{xcolor} 
\usepackage{blindtext}
\usepackage{lipsum}

\usepackage{fancyhdr}   
\fancyhf{}

\lhead[\textcolor{black}{A}]{\textcolor{gray}{B}}
\chead{\textcolor{red}{\fbox{C}}}               
\rhead[\textcolor{black}{D}]{\textcolor{gray}{E}}       
\lfoot[\textcolor{gray}{page \thepage}]{\textcolor{gray}{F}}    
\cfoot{\textcolor{red}{\fbox{G}}}                               
\rfoot[\textcolor{black}{\today}]{\textcolor{gray}{page \thepage / }}       

\renewcommand{\headrule}{{%
  \vpace{3pt}  \color{red}\hrule \headwidth \headrulewidth \vskip-\headrulewidth}}

\renewcommand{\footrule}{{%
 \color{blue}\vskip-\footruleskip-\vskip-\footrulewidth
  \hrule \headwidth \footrulewidth\vskip\footruleskip}}

\pagestyle{fancy}       

\begin{document}        
\lipsum \lipsum 
\end{document}

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.