建立特定頁首和頁尾時出現問題

建立特定頁首和頁尾時出現問題

如果看不清楚,左上角是圖片(大學標誌),右上角是頁碼。

我們在大學有特定的頁首和頁尾。因為我是 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

相關內容