Page LayoutHow to suppress page numbers for several pages

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

How to suppress page numbers for several pages

Post by Singularity »

How do I suppress page numbers on pages with long code listings on them?

I am using the listings package to print a few long program listings. I want to suppress the page numbers for all pages during the listing, except the last page of each listing.

I can suppress the page numbers with \thispagestyle{empty}. But that only works on the first page of the listing. The listing spans several pages, and the page number is printed after the first page. How do I turn it off altogether during the listing, but have the page numbers reappear starting with the last page of the listing?

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10344
Joined: Mon Mar 10, 2008 9:44 pm

How to suppress page numbers for several pages

Post by Stefan Kottwitz »

You can write \pagestyle{empty} before you start the listings, and \pagestyle{headings} (or your original style name) to reactivate page number display later when the listing ended.

Stefan
LaTeX.org admin
Post Reply