我试图将正文保留在框内,但它与标题重叠。我尝试使用和\voffset
,但似乎它们没有像我预期的那样工作\headsep
\headheight
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{showframe,blindtext,fontawesome}
\usepackage{fancyhdr}
\usepackage[a4paper, nomarginpar,margin=1in]{geometry}
\pagestyle{fancy}
\rhead{
{
\fontsize{40pt}{60pt}\selectfont
Foo Bar\\
}
555\faPhone\\
555\faPhone\\
555\faPhone\\
\noindent\makebox[\linewidth]{\rule{\linewidth}{0.4pt}}
}
\begin{document}
\blindtext
\end{document}
答案1
请查看代码的日志文件。你会发现:
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 80.59785pt.
这意味着您必须添加一个命令来放大\headheight
到 81pt:
\setlength{\headheight}{81pt}
使用以下 MWE
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{blindtext,fontawesome}
\usepackage{fancyhdr}
\usepackage[showframe, nomarginpar,margin=1in]{geometry}
\pagestyle{fancy}
\rhead{
{
\fontsize{40pt}{60pt}\selectfont
Foo Bar\\
}
555\faPhone\\
555\faPhone\\
555\faPhone\\
\noindent\makebox[\linewidth]{\rule{\linewidth}{0.4pt}}
}
\setlength{\headheight}{81pt} % <=======================================
\begin{document}
\blindtext
\end{document}
得到结果:
答案2
你的头球太高了,fancyhdr
警告您这一点:
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 80.59785pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
这里重要的是,您会看到从第二页开始页眉更加合适。
下面是一个类似的例子,其中超大图像至少需要 63.60004pt;设置headheight
为65pt
就足够了:
\documentclass{article}
\usepackage{fancyhdr,graphicx,blindtext}
\usepackage{geometry}
\geometry{
margin = 1in, % Set all margins to 1in
headheight = 65pt, % Update header height to accommodate for large content
tmargin = \dimexpr1in+65pt % Update top margin to accommodate for large header content
}
\rhead{\includegraphics[height=5\baselineskip]{example-image}}% Something big
\pagestyle{fancy}
\begin{document}
\blindtext[50]
\end{document}