16

So, I'm using the article class, and I'd like to make the page number smaller, and set it in a different font. I don't need to create a new pagestyle, necessarily, and I'm hesitant to do so without understanding the ramifications.

4 Answers 4

14

Thanks for the suggestion to use fancyhdr/redefine page styles. From the fancyhdr manual:

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\fontsize{9pt}{9pt}\selectfont\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{plain}
1
  • 1
    Thanks for posting the example code, this is very useful! Oct 4, 2010 at 10:51
10

You could use a KOMA-script class (e.g. scrartcl instead of article) and add the following to the preamble:

\addtokomafont{pagenumber}{\small\sffamily}

I initially recommended to redefine the \thepage command but, as Lev Bishop has pointed out, this has adverse effects and shouldn't be done.

6
  • 1
    Sorry lockstep, I didn't notice you'd posted your solution as I was posting mine. Here's +1 by way of apology ;) Oct 3, 2010 at 14:03
  • 3
    Changing \thepage this way is a really bad idea. It will make see page \pageref{lbl} for more information Expand to see page \small\sffamily3 for more information (setting "for more information" small and sans serif") which is surely not desired, and it will cause hyperref to fail completely.
    – Lev Bishop
    Oct 3, 2010 at 15:29
  • @Lev Bishop: You're of course right. Not sure what I was thinking. :-( @Marcin: Disregard the first part of my answer. You should either use a KOMA-script class or wait for someone who doesn't give blindfold pieces of advice.
    – lockstep
    Oct 3, 2010 at 15:40
  • But the KOMA-script info should still be correct. Could you edit your answer so that it mainly shows that.
    – Caramdir
    Oct 3, 2010 at 15:47
  • @lockstep, hope you don't mind that I've edited your answer to remove the incorrect information and only leave the valid suggestion of using KOMA-script. Please feel free to revert these changes, or edit the question yourself if you feel this doesn't represent the original intention of your answer. Oct 4, 2010 at 10:50
7

The correct way to achieve this is to make a new page style. As this FAQ answer discusses, redefining the \thepage will only cause problems with all the places page numbers are used (\pageref, table of contents, hyperref labels, etc, etc). Such changes will also not survive past a book-class change from \frontmatter to \mainmatter and so on.

Changing the pagestyle is easy enough with the fancyhdr package.

0
1

EDIT: As Lev kindly pointed out in his comment about it breaking various things, you definitely shouldn't think of this:


I can't help you with your font unless you mention which font you'd like. However, this code should give you a start:

\let\oldthepage\thepage
\renewcommand*\thepage{\small{\ttfamily-- \oldthepage\ --}}
2
  • 5
    Changing \thepage this way is a really bad idea. It will make see page \pageref{lbl}. Expand to see page {\small{\ttfamily-- 3\ --}}. which is surely not desired, and it will cause hyperref to fail completely.
    – Lev Bishop
    Oct 3, 2010 at 15:23
  • Lev's right of course. Now he points it out, it's quite obviously a really bad idea. Oct 3, 2010 at 22:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .