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 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}
share|improve this question
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
add comment

1 Answer 1

up vote 3 down vote accepted

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

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.