This is a slightly different approach. I thought it might be useful to have a solution with the following features:
- no need to adjust the page count manually;
- works no matter how many pages the text in the unnumbered section requires;
- uses
empty
for the page style of the unnumbered section (but could be adapted to use a modified version of another page style such as headings
);
- is independent of the page style in use for the rest of the document.
For example, you might not know how many pages the text in the unnumbered section requires. Moreover, this might change if you adjust the formatting later and it is a pain to have to remember to adjust the page settings manually in that case.
However, there may be disadvantages to this solution of which I'm currently unaware. (I strongly suspect this since this solution hasn't been suggested by wiser heads than mine!)
\documentclass{article}
\newcounter{mypagecount}% create a new counter
\setcounter{mypagecount}{0}% set it to something just in case
\newenvironment{interlude}{% create a new environment for the unnumbered section(s)
\clearpage
\setcounter{mypagecount}{\value{page}}% use the new counter we created to hold the page count at the start of the unnumbered section
\thispagestyle{empty}% we want this page to be empty (adjust to use a modified page style)
\pagestyle{empty}% use the same style for subsequent pages in the unnumbered section
}{%
\clearpage
\setcounter{page}{\value{mypagecount}}% restore the incremented value to the official tally of pages so the page numbering continues correctly
}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\begin{interlude}
\section{A new section}
\lipsum[7-8]
\subsection{A subsection}
\lipsum[11]
\end{interlude}
\lipsum[12-15]
\end{document}
Note that because \pagestyle{empty}
is limited to the interlude
environment, we don't need to restore the pagestyle
manually at the end of the environment as LaTeX takes care of this automatically. So if the document used headings
, for example, rather than plain
, the correct style would be restored at the end of the unnumbered interlude
.
This produces:
\clearpage\thispagestyle{empty}\addtocounter{page}{-1} extra stuff \clearpage
should workpdfpages
.