我正在创建一个文档,其中页眉中有一个框,页脚中还有另一个框。
但我希望顶部框的底部和页眉规则之间以及底部框的顶部和页脚规则之间有相同的空间。
以下是一个例子:
\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}
我尝试更改选项中的所有值layout
,但没有一个值可以更改 C 和页眉规则之间的间距fbox
或 Gfbox
和页脚规则之间的间距。我在网上没有找到有关此类设置的任何信息。
有人可以帮我解决这个问题吗?
答案1
如果你打开\setlength{\footskip}{1.5cm}
序言中的命令,你就可以实现你想要做的事情
答案2
完整代码
\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}
答案3
我找到了一个解决方案,即在标尺上添加垂直空间vspace
。我认为这很有用,因此这里是代码:
\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}