我在使用排版多行页眉时遇到了麻烦,fancyhdr
第一页的页眉与后续页面的页眉行为不同。第一页的页眉没有深度,但在后续页面上产生更大的垂直位移。
下面是一个示例 tex 文件来说明难度
\documentclass{article}
\usepackage{fancyhdr}
\chead{line 1\\line 2\\line 3\\line 4\\line 5\\line 6\\line 7\\line 8}
\cfoot{footer}
\fancypagestyle{plain}{}
\pagestyle{fancy}
\begin{document}
\thispagestyle{fancy}
page 1 \newpage
page 2 \newpage
page 3
\end{document}
答案1
编译 MWE 时会收到警告:
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 94.54448pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
添加后\setlength{\headheight}{96pt}
问题得到解决。
答案2
日志文件会告诉你
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 94.54448pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.