我一直在想办法让页眉的高度超过 3 行,而不会超出文档主体,但目前还没有成功。我知道我可以在文档中的页眉后面留出空间,但这样做在每一页上都很麻烦。
这就是我所拥有的:`
\documentclass[a4paper,12pt]{article}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{fancyheadings}
\pagestyle{fancyplain}
\lhead{\begin{small}Prof. _________\\Spring 2013\end{small}\\ so \\ keep \\ it}
\chead{\begin{small}\textbf{MEE: ________}\\Homework II\footnote{This document was made using \LaTeX\ and the amsmath package.}\end{small}\\ if \\ typing \\run}
\rhead{\begin{small}____________\\Due ______________\end{small}\\ I \\ will\\ over?}
\renewcommand{\headrulewidth}{0pt} %removes line under header
\renewcommand{\headheight}{\baselineskip}
\begin{document}
\begin{enumerate}
\item This is a homework problem. The header is overlapping this text in this current setup \\
\\
\item This is another problem. The header probably also overlaps this one. \\
\\
\end{enumerate}
\end{document}
`
为完整性而编辑
答案1
我反对使用软件包fancyheadings
,而支持使用软件包fancyhdr
。请参见下面的示例(我尝试直接注释代码)。
\documentclass{article}
\usepackage{fancyhdr}
% if the global font size is 10pt, the baselineskip of \small
% is 11pt and minimal head height is therefore 33 pt
\usepackage[headheight=33pt]{geometry}
\fancyhf{}{} % clean headers
\fancyhead[L]{\small\begin{tabular}{@{}l} % left header left aligned
\bfseries Prof.\@ \hbox to 5em{\hrulefill}\\
Spring 2013\\
3rd line of left header
\end{tabular}}
\fancyhead[R]{\small\begin{tabular}{r@{}} % right header right aligned
\bfseries MEE: \hbox to 5em{\hrulefill}\\
Homework II\\
Whatever you want here
\end{tabular}}
\renewcommand{\headrulewidth}{0pt}% no header line
\pagestyle{fancy}
% show the page layout, provide dummy text
\usepackage{showframe, lipsum}
\begin{document}
\lipsum[1-30]
\end{document}
答案2
你的定义有问题。_
不能像你那样在数学模式之外使用。将其更改为\rule
命令。
我使用几何包来更容易地定义头部的高度和分离。
\documentclass{文章} \usepackage{lipsum} \usepackage[headheight=6\baselineskip,headsep=1\baselineskip]{几何} \usepackage{fancyheadings} \lhead{\begin{small}Prof. \rule{3cm}{0.1pt}\\2013 年春季\end{small}\\ 所以\\ 保留 \\ 它} \chead{\begin{small}\textbf{MEE:}\rule{3cm}{0.1pt}\\Homework II\footnote{本文档使用 \LaTeX\ 和 amsmath 包制作。}\end{small}\\ if \\ typing \\run} \rhead{\begin{small}\rule{5cm}{0.1pt}\\由于 \rule{3cm}{0.1pt}\end{small}\\我\\会\\过来吗?} \renewcommand{\headrulewidth}{0pt} %删除标题下的行 \开始{文档} \pagestyle{fancyplain} \lipsum[1-7] \结束{文档}