4

If don't see clear, in top left corner is picture (university logo) and in top right corner are page numbers.

We have specific header and footer at university. Because i'm new in LaTeX, could someone help me with creating this:

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

i need this in all pages

4
  • 3
    I can not download your file. It is better to host an image. – Sigur Apr 6 '13 at 18:56
  • 3
    Welcome to TeX.sx! Please show some attempt you've made in achieving this and specify what you're struggling with. The point of this Q&A site is to solve specific problems, not to have other people do your work. The standard package for headers is fancyhdr. – doncherry Apr 6 '13 at 19:00
  • 1
    As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. – texenthusiast Apr 6 '13 at 19:03
  • Do you need this frame in all the pages of your document? – Gonzalo Medina Apr 6 '13 at 20:12
3

Here's one possibility using the background package to place the frame in all the pages of the document; the frame was built using two tabular environments; changing the lengths \xsh and \ysh, (resp.), the user can dynamically change the horizontal, vertical (resp.) separation between the text and the frame.

\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}

enter image description here

The line

\PassOptionsToPackage{demo}{graphicx}

simply replaces actual images with black rectangles; making thus my example code compilable for everyone. Delete that line in your actual document and make sure to use the right name of your own logo image in the argument of the \includegraphics command.

3
  • 1
    Once again: Should we answer really bad questions? – doncherry Apr 6 '13 at 23:05
  • 1
    @doncherry In this particular case, the user is both new to the site and to LaTeX, so I thought he might need a little help (specially in this case that might not be trivial for new users). – Gonzalo Medina Apr 6 '13 at 23:11
  • @user28597 You're welcome. Since my answer seems to have solved your problem, please consider accepting it (using the check-mark to the left of the answer); in case of doubt, please see How do you accept an answer?. – Gonzalo Medina Apr 7 '13 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.