我设计了一个信头,其中包含一个页眉和一个页脚,如下所示(ASCII 格式)。如您所见,它包含一个页眉和一个页脚,其上方和下方都有水平标尺。这些标尺是彩色的(即:不是黑色),高度超过 1 像素。这两个水平标尺内是文本。在页眉中,它有三个文本块,两个在左侧排列,第三个在右侧排列。页脚只包含一行文本。页眉上方是一个徽标,部分超出了页边距。
这看起来相当简单,但是我对 LaTeX 不是很熟悉。我看到很多人fancyhdr
在类似情况下推荐这个软件包,也看过它,但还没有找到最好的入门方法。有谁能给我至少一些指导,告诉我在哪里可以找到这样的事情?
a logo above
which partly falls
of page-margin
--------------------------------------
text text text
block1 block2 block3
--------------------------------------
this is where the header has ended and
the actual page starts
with lots of text
lorem ipsum and the likes
this is where the page ends and a
footer comes in
--------------------------------------
this is a footer with some text
--------------------------------------
page#
答案1
这是一个可能的选项,使用背景包;页脚和页眉作为背景材料放置。当然,根据您的实际设置,一些尺寸需要调整:
\documentclass{article}
\usepackage{xcolor}
\usepackage{array}
\usepackage{fourier}
\usepackage{graphicx}
\usepackage{lipsum}
\definecolor{rulecolor}{RGB}{188,71,71}
\newcommand\fieldi{text1}
\newcommand\fieldii{text2}
\newcommand\fieldiii{text3}
\newcommand\fieldiv{text4}
\newcommand\fieldv{text5}
\newcommand\fieldvi{text6}
\newcommand\footertext{text text text}
\newcommand\ColRule{%
{\noindent\color{rulecolor}\rule{\textwidth}{1.5pt}}}
\newcommand\Header{%
\noindent\makebox[\textwidth][l]{\parbox{1.2\textwidth}{%
\hfill\includegraphics[height=2cm]{cc}}}\par\vskip1ex%
\ColRule\par\noindent
\begin{tabular*}{\textwidth}%
{@{}>{\raggedright}p{.25\textwidth}@{}>{\raggedright}p{.25\textwidth}@{}>{\raggedleft}p{.5\textwidth}@{}}
\fieldi & \fieldii & \fieldiii \tabularnewline
\fieldiv & \fieldv & \fieldvi \tabularnewline
\end{tabular*}\par\ColRule\par}
\newcommand\Footer[1]{%
\ColRule\par
\noindent\begin{tabular*}{\textwidth}{@{}>{\raggedright}p{\textwidth}@{}}
\footertext
\end{tabular*}\par\vskip-1.5ex\ColRule\par\centering\thepage\par}
\usepackage{background}
\SetBgColor{black}
\SetBgAngle{0}
\SetBgScale{1}
\SetBgOpacity{1}
\SetBgContents{%
\begin{tikzpicture}[remember picture,overlay]
\node at (0,0.6\textheight) {\parbox{\textwidth}{\Header}};
\node at (0,-0.55\textheight) {\parbox{\textwidth}{\Footer}};
\end{tikzpicture}
}
\pagestyle{empty}
\begin{document}
\lipsum[1-20]
\end{document}
Creative Commons 徽标取自这里。
下面是使用 的解决方案fancyhdr
;如您所见,所有工作都是通过\Header
和的定义完成的;一旦做出这些定义,是否遵循或方法\Footer
就是个人喜好的问题了:background
fancyhdr
\documentclass{article}
\usepackage[tmargin=1cm,bmargin=6cm,includehead,includefoot]{geometry}
\usepackage{xcolor}
\usepackage{array}
\usepackage{fourier}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{fancyhdr}
\definecolor{rulecolor}{RGB}{188,71,71}
\newcommand\fieldi{text1}
\newcommand\fieldii{text2}
\newcommand\fieldiii{text3}
\newcommand\fieldiv{text4}
\newcommand\fieldv{text5}
\newcommand\fieldvi{text6}
\newcommand\footertext{text text text}
\newcommand\ColRule{%
{\noindent\color{rulecolor}\rule{\textwidth}{1.5pt}}}
\newcommand\Header{%
\noindent\makebox[\textwidth][l]{\parbox{1.2\textwidth}{%
\hfill\includegraphics[height=2cm]{cc}}}\par\vskip1ex%
\ColRule\par\noindent
\begin{tabular*}{\textwidth}%
{@{}>{\raggedright}p{.25\textwidth}@{}>{\raggedright}p{.25\textwidth}@{}>{\raggedleft}p{.5\textwidth}@{}}
\fieldi & \fieldii & \fieldiii \tabularnewline
\fieldiv & \fieldv & \fieldvi \tabularnewline
\end{tabular*}\par\ColRule\par}
\newcommand\Footer[1]{%
\ColRule\par
\noindent\begin{tabular*}{\textwidth}{@{}>{\raggedright}p{\textwidth}@{}}
\footertext
\end{tabular*}\par\vskip-1.5ex\ColRule\par\centering\thepage\par}
\fancyhf{}
\fancyhead[C]{\Header}
\fancyfoot[C]{\Footer}
\renewcommand{\headrulewidth}{0pt}
\setlength\headheight{107.4pt}
\pagestyle{fancy}
\begin{document}
\lipsum[1-20]
\end{document}