我使用 mdframed 作为页眉。现在我想减少页眉和页面第一行之间的间距。如何减少间距?
\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
您可以通过headsep
使用geometry
包减少来实现此目的。
\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}
然而,减少headsep
会破坏一致性和优雅性。