以前曾问过这个问题的各种版本,但它们要么有特殊问题(例如标题页),要么我根本无法理解答案。
这是我的乳胶的开始:
\documentclass[12pt]{article}
\usepackage{fancyhdr}
\textwidth = 7 in
\textheight = 9.5 in
\oddsidemargin = -0.25 in
\evensidemargin = 0.0 in
\topmargin = -0.25 in
\headheight = 0.0 in
\headsep = 0.0 in
\parskip = 0.1 in
\parindent = 0.0 in
\pagestyle{fancy}
\lhead{}
\rhead{my name}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\begin{document}
结果是第一页的页眉覆盖了文本,但页码位置很好。其余所有页面的页眉都很好,但页码位置太低。有人能帮忙吗?
答案1
当你编译代码时,你会收到以下警告:
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 14.49998pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
因此,您必须提供适当headheight
且更好的方法来实现这一点,即通过geometry
包:
\documentclass[12pt]{article}
\usepackage{fancyhdr}
\usepackage{geometry}
\geometry{text={7in,9.5in}
,headheight=15pt
}
%\textwidth = 7 in
%\textheight = 9.5 in
%\oddsidemargin = -0.25 in
%\evensidemargin = 0.0 in
%\topmargin = -0.25 in
%\headheight = 0.0 in
%\headsep = 0.0 in
\setlength{\parskip}{0.1in}
\setlength{\parindent}{0.0in}
\pagestyle{fancy}
\lhead{}
\rhead{my name}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
对于你的情况,理想的做法是使用
\geometry{text={7in,9.5in}
,headheight=15pt
,headsep=0.1in
,includehead
}