2

I am writing a text that an be divided in two groups pre-textual elements and the textual elements. The pre-textual elements contains things like table of contents, table of figures, list of abbreviations, etc; and the textual elements are chapters of the text.

What I want to do is remove the page numbering from the pre-textual elements.

First approach i used was using thispagestyle{empty} under each pre-textual element. It worked, but when there is, for example, a table of contents or list with two or more pages, just the last page of that element will have its number removed.

Second approach, I tried using \pagenumbering{gobble} in the beginning of the document, and when I wanted the numbers to appear, I changed to \pagenumbering{arabic}. The problem with this approach, is that the numbers will start from 1 in the place I put this last command, and I don't want that. I want the pre-textual pages to be counted, just not appear. I know that I can set the page numbering to start from a certain number, but I would need to do it manually, and always count by myself the number of pages that comes before.

Third approach was using the method I found here. This worked fine, until I noticed that pages where my chapters starts was without numbering. No problem I used the \thispagestyle{headings} after each \chapter and it was ok. But when I added my references in the end, the first page was without style.

My question is: is there an easiest way to remove the page numbers from a certain group of pages and only there, without facing these problems?

Thanks in advance.

1

Here is a solution

\documentclass{book}
\usepackage{blindtext} % just for dummy text

\makeatletter
\newcommand*{\emptystyles}{%
\let\oldplain\ps@plain
\let\ps@plain\ps@empty
\pagestyle{empty}}

\newcommand*{\restorestyles}{%
\clearpage\thispagestyle{empty}
\let\ps@plain\oldplain
\pagestyle{headings}}
\makeatother

\begin{document}
\emptystyles

\tableofcontents
\listoffigures
\listoftables

\restorestyles

\blinddocument % chapters of dummy text
\blinddocument
\blinddocument

\end{document}
1

It's easier if you use the book class and its \frontmatter and \mainmatter features, which we can modify. So, if you change your mind, your document is not clobbered with strange commands.

\documentclass{book}

% access at the internals of the class, with care
\makeatletter
\renewcommand\frontmatter{%
  \cleardoublepage
  \@mainmatterfalse
  \let\ps@plain\ps@empty
  \pagestyle{empty}%
}
\renewcommand{\mainmatter}{%
  \cleardoublepage
  \@mainmattertrue
  \let\ps@plain\bookps@plain
  \pagestyle{headings}%
}
\let\bookps@plain\ps@plain
\makeatother

\begin{document}

\frontmatter

\tableofcontents

\listoffigures

\mainmatter

\newcommand{\fakechapter}{% just for filling up
  \chapter{Title}
  \section{A}
  x
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \section{A}
  x
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \section{A}
  x
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \section{A}
  x
  \begin{figure}
  \caption{Caption}
  \end{figure}
}

\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter
\fakechapter

\end{document}

The plain page style is made equivalent to empty in the front matter (your “pretextual material”), but a copy of it is kept in a safe place, to be restored when \mainmatter is processed.

If you use fancyhdr for the headers and footers, similar changes can be made.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.