2

My toc has 03 pages. When printed (pdflatex), the first one gets no header, while the other two gets it the way its supposed to be.

The thing is: I want ALL of them to have headers.

Here, take a look at my code (please):

\documentclass[a4paper,11pt,oneside]{book}
\usepackage{graphicx}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{epsfig}
\usepackage{float}
\usepackage{multicol}
\usepackage{array}
\usepackage{multirow}
\usepackage{lastpage}
\usepackage{amsmath}
\usepackage{caption}
\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[hmargin=2cm,top=4cm,headheight=65pt,footskip=65pt]{geometry}

\setlength{\parindent}{1.3cm}
\usepackage{indentfirst} %Determinar que cada primeiro parágrafo seja também indentado

\newenvironment{tquote}{\begin{list}{}
   {\setlength{\leftmargin}{13mm}
   \setlength{\rightmargin}{0mm}}
   \item[]}{\end{list}}

\widowpenalty=300
\clubpenalty=300  


\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
\centering
          \begin{tabular}{|m{3.5cm}|m{10.0cm}|m{2.5cm}|}
          \hline
          \centering
          \includegraphics[height=1.59cm,width=3.0cm]{img/logo} &
          \centering
          \Large{BLA BLA BLA}&
          \centering
          \scriptsize{Pág. \thepage\ de \pageref{LastPage}\\
          Data: XXXXXX\\
          Rev. 0}\tabularnewline
          \hline
          \end{tabular}%
}

\makeatletter
\makeatother

\begin{document}
\thispagestyle{fancy}

TITLE BLA BLA BLA
\newpage

\tableofcontents\thispagestyle{fancy}

\mainmatter\thispagestyle{fancy}
\newpage\thispagestyle{fancy}

\chapter{BLA BLA BLA}
\thispagestyle{fancy}
        \input{cap.tex}

\end{document}
4
  • Using your MWE with the demo option for the graphicx package, I get the header on the first TOC page... Are you sure this MWE illustrates your problem?
    – Ludovic C.
    Commented Jul 12, 2013 at 11:50
  • When adding useless entries to the TOC in order to get a TOC longer than one page it actually shows your problem. Maybe you should edit your MWE to get directly the problem...
    – Ludovic C.
    Commented Jul 12, 2013 at 11:54
  • You should have a look to this answer tex.stackexchange.com/a/62643/31058
    – Ludovic C.
    Commented Jul 12, 2013 at 12:05
  • 1
    The commands \thispagestyle{fancy} do nothing at all: either the style is already the current one or it's overridden by a \thispagestyle{plain} at chapter starting pages. In both cases they are redundant.
    – egreg
    Commented Jul 12, 2013 at 12:30

1 Answer 1

3

Using this answer I got what you want

\pagestyle{fancy}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[C]{%
\centering
          \begin{tabular}{|m{3.5cm}|m{10.0cm}|m{2.5cm}|}
          \hline
          \centering
          \includegraphics[height=1.59cm,width=3.0cm]{img/logo} &
          \centering
          \Large{BLA BLA BLA}&
          \centering
          \scriptsize{Pág. \thepage\ de \pageref{LastPage}\\
          Data: XXXXXX\\
          Rev. 0}\tabularnewline
          \hline
          \end{tabular}% 
}}
\pagestyle{plain}

Insert this code instead of this part

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyhead[C]{%
\centering
          \begin{tabular}{|m{3.5cm}|m{10.0cm}|m{2.5cm}|}
          \hline
          \centering
          \includegraphics[height=1.59cm,width=3.0cm]{img/logo} &
          \centering
          \Large{BLA BLA BLA}&
          \centering
          \scriptsize{Pág. \thepage\ de \pageref{LastPage}\\
          Data: XXXXXX\\
          Rev. 0}\tabularnewline
          \hline
          \end{tabular}%
}

in your preamble and it should work.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .