I've been struggling with my .tex
for quite some time now, and decided its time to look for help.
This is the situation: all docs here (my office) need to bring, as header, a table (3 columns) which contains logo & title & page count.
Also, as footer, it must have a table (2 columns) which contains text & text.
I'm using the book
documentstyle because I need the summary and chapter structure.
I've already tried the \background
package, but it seens to not accept tables as content.
So, here is the question: could you point me the direction I must follow?
I wanted to include a picture, but my rep doesn't allow me….
Update: 05-09-2013
Trying new code now, thanks for your help!
the code:
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,headheight=65pt,footskip=65pt]{geometry}
\setlength{\parindent}{0.95cm}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[C]{%
\begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.5cm}|}
\hline
\includegraphics[height=1.5cm,width=2.5cm]{logo.png} &
\centering
\Huge{TITLE} &
\centering
\tiny{P\'ag. \thepage\ de \pageref{LastPage}\\
Data: 17/05/2013\\
Rev. 0}\tabularnewline
\hline
\end{tabular}%
}
\fancyfoot[C]{%
\begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.5cm}|}
\hline
\includegraphics[height=1.5cm,width=2.5cm]{logo.png} &
\centering
\Huge{TITLE} &
\centering
\tiny{P\'ag. \thepage\ de \pageref{LastPage}\\
Data: 17/05/2013\\
Rev. 0}\tabularnewline
\hline
\end{tabular}%
}
\begin{document}
\lipsum[1-10]
\end{document}
produces the table header, but its overlapping the default header. Also, the pages in which a chapter starts, there is no header. I need headers in all pages.
Some pics:
Overlapping Headers
Blank header
—————————————————–
Initial code:
Could you take a look at my code? its not working the way its supposed to do: its produces only a table, but not as header or footer.
\documentclass[a4paper,12pt]{book}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{epsfig}
\usepackage{float}}
\usepackage{multicol}
\usepackage{array}
\usepackage{multirow}
\usepackage{lastpage}
\usepackage[margin={2cm}]{geometry}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\setlength{\paperheight}{29.7cm} \setlength{\paperwidth}{21cm}
\usepackage{indentfirst}
\setlength{\parindent}{0,95cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\headheight}{16pt}
\fancyhead{
\begin{table}[t]
\begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.0cm}|}
\hline
\includegraphics[height=1.5cm]{logo.png} &
\centering
\HUGE{TITLE} &
\centering
\tiny{Pág. \thepage\ de \pageref{LastPage}
Data: 17/05/2013
Rev. 0} &
\hline
\end{tabular}
\end{table}
}
%I need a similar table on footer
\fancyfoot[C]{
\begin{table}[t]
\begin{tabular}{|m{3.0cm}|m{10.0cm}|m{2.0cm}|}
\hline
\includegraphics[height=1.5cm]{logo.png} &
\centering
\HUGE{TITLE} &
\centering
\tiny{Pág. \thepage\ de \pageref{LastPage}
Data: 17/05/2013
Rev. 0} &
\hline
\end{tabular}
\end{table}
}
\begin{document}
CONTENTS
\end{document}
Best Answer
Here is a template:
Using the
fancyhdr
package, you can define headers and footers as you like. For instance, I put the logo in the header, on the left on odd pages (LO), and on the right on even pages (RE). In the center (C) of the footer I put a table as requested. The other settings are similar. Note that normally the first page of a chapter gets the page styleplain
which usually has only the page number in the footer. If you want thefancy
style also on those pages, use\thispagestyle{fancy}
directly after\chapter{...}
. The template above yields:Your code has a few problems:
papersize
andpaperheight
explicitly. Thea4paper
option forbook
is enough.tabular
s don't need to be wrapped intotable
s, as they are not floating objects.\HUGE
size,\Huge
is the largest.\\
.Fixing those problems leads to the following code:
and it looks like this:
Note that this uses the same header and footer for odd and even pages. I think you now should be able to adapt the tables to have a right page/left page look, and setting the header with
CO
andCE
positions accordingly.