我的目录有 03 页。打印 (pdflatex) 时,第一页没有页眉,而其他两页则按预期显示页眉。
问题是:我希望它们全部都有标题。
这里,请看一下我的代码:
\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}
答案1
使用这个回答我得到了你想要的东西
\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}
插入此代码代替此部分
\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}%
}
在你的序言中它应该起作用。