Page Layoutno page number on a certain page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
yin
Posts: 3
Joined: Wed Dec 30, 2009 10:59 pm

no page number on a certain page

Post by yin »

hi

I want to create a page in my document which does not have a page number (but nevertheless a heading. so \thispagestyle{empty} would not work). however, the following page should have the number of the page without page number.

For example:
if the page without page number had the number a, the next page should have the number a as it's page number.

I know the description sounds strange :-P

thank you in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

no page number on a certain page

Post by meho_r »

yin wrote:...

I know the description sounds strange :-P

...
You're right. Try explaining that again :) And some code would be useful too.

EDIT: After reading that again maybe I've understood it. What you want is this: let's say you have pages a, b, c, d. Now, you want a page without page number to come after page b, so that you have: a, b, empty, c, d. Is this it?

Try this:

Code: Select all

\documentclass{book}

\usepackage{lipsum}
\usepackage{fancyhdr}

\fancyhf{}% clears all headers/footers

\newcommand{\mainstyle}{% a new command for easy page style switch
\fancyhead[LE]{\thepage}
\fancyhead[RO]{\thepage}
\fancyhead[C]{\textit{Some header text}}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
}

\newcommand{\emptystyle}{% a new command for easy page style switch (for pages without page number)
\fancyhead[LE]{}
\fancyhead[RO]{}
\fancyhead[C]{\textit{Some header text}}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\addtocounter{page}{-1}% setting back the counter; pay attention that this means that the page without page number will be the same "type" as the previous, i.e., if the previous is an odd page, this one will be the odd page too and vice versa; so, if you have twoside document with different inside and outside margins, this may result in unsatisfactory results
}

\begin{document}

\renewcommand{\thepage}{\alph{page}}

\mainstyle% page style for pages with header and page number
\lipsum[1-11]\newpage

\emptystyle% page style for the page with header but without page number
Test: a page with some text in header, but without page number.\par
\lipsum[1-3]\newpage

\mainstyle% page style for pages with header and page number
\renewcommand{\thepage}{\alph{page}}
\lipsum[1-11]\newpage

\emptystyle% page style for the page with header but without page number
Test: a page with some text in header, but without page number.\par
\lipsum[1-3]\newpage

\mainstyle% page style for pages with header and page number
\lipsum[1-11]
\end{document}
Post Reply