2

I m using mdframed as header. Now i want to reduce the space between header and first line on page. How can i reduce the space?

 \documentclass{article}
 \usepackage{array,multirow}
 \usepackage[table]{xcolor}
 \usepackage{fancyhdr}
 \usepackage[framemethod=TikZ]{mdframed}
 \usepackage[top=2cm, bottom=2cm, left=1cm, right=1cm]{geometry}
 \pagestyle{fancy}
 \fancyhf{} % sets both header and footer to nothing 
 \renewcommand{\headrulewidth}{0pt}
 \fancyfoot{}
 \begin{document}

 \arrayrulecolor{white}


 \definecolor{textcol}{rgb}{.118, .565, 1.00}   


 \fancyhead[C]{% 
 \begin{mdframed}[linecolor=blue!60,roundcorner=3pt] 
 \parbox[t]{0.333\textwidth}{\raggedright XXX }% 
 \parbox[t]{0.333\textwidth}{\centering \thepage}%  
 \parbox[t]{0.333\textwidth}{\raggedleft YYY} 
 \end{mdframed}% 
} 

Some text 

\end{document}
  • 1
    It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. – Peter Grill Jan 16 '13 at 6:45
3

You can do it with reducing headsep using geometry package.

 \documentclass{article}
 \usepackage{array,multirow}
 \usepackage[table]{xcolor}
 \usepackage{fancyhdr}
 \usepackage[framemethod=TikZ]{mdframed}
 \usepackage[top=2cm, bottom=2cm, left=1cm, right=1cm,headsep=4pt]{geometry}  %% adjust here
 \pagestyle{fancy}
 \fancyhf{} % sets both header and footer to nothing 
 \renewcommand{\headrulewidth}{0pt}
 \fancyfoot{}
 \begin{document}

 \arrayrulecolor{white}


 \definecolor{textcol}{rgb}{.118, .565, 1.00}   


 \fancyhead[C]{% 
 \begin{mdframed}[linecolor=blue!60,roundcorner=3pt] 
 \parbox[t]{0.333\textwidth}{\raggedright XXX }% 
 \parbox[t]{0.333\textwidth}{\centering \thepage}%  
 \parbox[t]{0.333\textwidth}{\raggedleft YYY} 
 \end{mdframed}% 
} 

Some text 

\end{document}

However, reducing headsep will spoil the consistency and elegance.

enter image description here

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.