Document ClassesAdding a page number to every page

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
GMathews
Posts: 24
Joined: Sat Jun 14, 2008 7:01 pm

Adding a page number to every page

Post by GMathews »

Hello!

The supervisor of my next lab wants every page to be numbered, including the page which contains the Chapter name.

Here is the script im using before my document to instruct KOMA-script

Code: Select all

\pagestyle{fancy}


\renewcommand{\chaptermark}[1]%
{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\MakeUppercase{\thesection.\ #1}}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}
\fancyfoot[C]{\thepage}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
So I would like the footer to appear on every single page (with the page number below it) and the header to appear like it always did(not on the chapter pages).

Your advice will be greatly appreaciated :)
Running Miktex 2.7 with TexnicCenter on Windows XP
:)

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Adding a page number to every page

Post by Stefan Kottwitz »

Hi,

use \fancypagestyle, for example:

Code: Select all

\fancypagestyle{plain}{
  \fancyhf{} % empty header and footer
  \renewcommand{\headrulewidth}{0pt} % ho header line
  \renewcommand{\footrulewidth}{0pt}% not footer line
  \fancyfoot[C]{\thepage}% like fancy style
}
Stefan
LaTeX.org admin
GMathews
Posts: 24
Joined: Sat Jun 14, 2008 7:01 pm

Re: Adding a page number to every page

Post by GMathews »

I used that code but im encountering 2 problems :

1. Page numbers do not appear in pages after /newpage command is used.

2. Im not getting the header to display as I had mentioned. I would like the header to still appear on pages that do not start on a Chapter as i had indicated in the first post?

And Im supposed to replace \pagestyle{fancy} with the \fancypagestyle code you mentioned right?
Running Miktex 2.7 with TexnicCenter on Windows XP
:)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Re: Adding a page number to every page

Post by Stefan Kottwitz »

Use my code above as addition to your fancy code, not instead of it. The other fancy settings should not be effexted by \fancypagestyle{plain}, only the plain pages, the first page of a chapter has plain page style.

Stefan
LaTeX.org admin
GMathews
Posts: 24
Joined: Sat Jun 14, 2008 7:01 pm

Re: Adding a page number to every page

Post by GMathews »

You are my new hero!

Im going to put a picture of your cute doggie avatar on my wall lol.

Have a great day Stefan :)
Running Miktex 2.7 with TexnicCenter on Windows XP
:)
Post Reply