Nguyenhuyen_AG
Nguyenhuyen_AG

Reputation: 443

Clear header single page

I have document with 50 pages. But i want pages 5, 10, 14 and 33 no header (no word and line). Can somebody help me.

Thank you very much.

Upvotes: 3

Views: 6457

Answers (1)

Werner
Werner

Reputation: 15105

You can condition on the current page number in the header, and subsequently set the page style for the following page. In the example below, page 5 has no header (set the page style to noheader):

enter image description here

\documentclass{article}

\usepackage{fancyhdr,lipsum}

\pagestyle{fancy}
\fancyhf{}% Clear header/footer
\fancyhead[L]{\ifnum\value{page}=4 \thispagestyle{noheader}\fi Left header}
\fancyhead[C]{Middle header}
\fancyhead[R]{Right header}
\renewcommand{\headrulewidth}{.4pt}% Default header rule

\fancypagestyle{noheader}{
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
}

\begin{document}

\lipsum[1-50]

\end{document}

You can string together conditions:

\ifnum\value{page}=4 \thispagestyle{noheader}%
\else\ifnum\value{page}=6 \thispagestyle{noheader}%
\else\ifnum\value{page}=8 \thispagestyle{noheader}%
\fi\fi\fi

The above would set the page style to noheader on pages 5, 7 and 9.

If you're using pdfTeX, you can also match the page number presentation to a string. Similar to the above, you can:

\ifnum\pdfmatch{\thepage}{4,6,8}=1 \thispagestyle{noheader}\fi

Upvotes: 3

Related Questions