创建特定页眉和页脚时出现问题

创建特定页眉和页脚时出现问题

如果看不清楚,左上角是图片(大学标志),右上角是页码。

我们在大学有特定的页眉和页脚。因为我是 LaTeX 新手,有人能帮我创建这个吗:

http://rapidshare.com/files/3316564346/heather.doc

我需要在所有页面中使用此

答案1

以下是使用background包将框架放置在文档的所有页面中;该框架是使用两种tabular环境构建的;通过分别改变长度\xsh\ysh,用户可以动态改变文本和框架之间的水平、垂直(分别)分离。

\PassOptionsToPackage{demo}{graphicx}
\documentclass{article}
\usepackage[a5paper,centering]{geometry}% a5paper just for the example
\usepackage{array}
\usepackage{lastpage}
\usepackage{multirow}
\usepackage{background}
\usepackage{tikzpagenodes}
\usepackage{lipsum}% just to generate text for the example

% a new column type
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

% auxiliary lengths
\newlength\xsh
\newlength\ysh
\newlength\framewd
\newlength\frameht

% apply changes here to the width and height of the frame 
\setlength\xsh{1cm}
\setlength\ysh{2cm}

\setlength\framewd{\dimexpr\textwidth+2\xsh\relax}
\setlength\frameht{\dimexpr\textheight+2\ysh\relax}

\makeatletter
% auxiliary commands for the coursename, the course number and the logo
\def\coursename#1{\gdef\@coursename{#1}}
\def\cnumber#1{\gdef\@cnumber{#1}}

% the main part
% Here we built the frame using two tabular environments:
% one for the header, the other one for the footer
\backgroundsetup{
opacity=1,
scale=1,
color=black,
angle=0,
contents={%
\begin{tikzpicture}[remember picture,overlay]
\draw ([xshift=-\xsh,yshift=\ysh]current page text area.north west) --
  ([xshift=\xsh,yshift=\ysh]current page text area.north east) --
  ([xshift=\xsh,yshift=-\ysh]current page text area.south east) --
  ([xshift=-\xsh,yshift=-\ysh]current page text area.south west) -- cycle;
\node[anchor=north,inner sep=0pt] at ([yshift=\ysh]current page text area.north)
{
\renewcommand\arraystretch{1.4}%
\footnotesize%
\noindent\begin{tabular}[t]{C{\dimexpr.3\framewd-12.46pt\relax}|p{\dimexpr.45\framewd-12.46pt\relax}|p{\dimexpr.25\framewd-12.46pt\relax}}
\multirow{2}{*}{\includegraphics[height=15pt,width=\dimexpr.3\framewd-12.46pt\relax,keepaspectratio]{logo}} & \textsc{Course}: & \@cnumber \\
\cline{3-3}
& \multicolumn{1}{c|}{\@coursename} & \thepage/\pageref{LastPage} \\
\hline
\end{tabular}%
};
\node[anchor=south,inner sep=0pt] at ([yshift=-\ysh]current page text area.south)
{%
\renewcommand\arraystretch{1.4}%
\footnotesize%
\noindent\begin{tabular}[t]{C{\dimexpr.15\framewd-12.4pt\relax}|C{\dimexpr.37\framewd-12.4pt\relax}|C{\dimexpr.12\framewd-12.4pt\relax}|C{\dimexpr.12\framewd-12.3pt\relax}|C{\dimexpr.12\framewd-12.4pt\relax}|C{\dimexpr.12\framewd-12.3pt\relax}}
\hline
Id number & Last name and name & Level & Year & E & Sign\\
\hline
& & & & & \\
\end{tabular}%
};
\end{tikzpicture}%
}
}
\makeatother

\pagestyle{empty}

% assign here the course name and course number
\coursename{General Topology}
\cnumber{444 555 111-02}

\begin{document}

\lipsum[1-20]

\end{document}

在此处输入图片描述

线路

\PassOptionsToPackage{demo}{graphicx}

只需用黑色矩形替换实际图像即可;这样我的示例代码就可以供所有人编译。删除实际文档中的该行,并确保在命令的参数中使用您自己的徽标图像的正确名称\includegraphics

相关内容