Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

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.

share|improve this answer
1  
Sorry lockstep, I didn't notice you'd posted your solution as I was posting mine. Here's +1 by way of apology ;) –  Geoffrey Jones Oct 3 '10 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 '10 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 '10 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 '10 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. –  Juan A. Navarro Oct 4 '10 at 10:50

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.

share|improve this answer
    
OK, cool, I will check that out. Thanks! –  Marcin Oct 3 '10 at 20:40
up vote 5 down vote accepted

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}
share|improve this answer
    
Thanks for posting the example code, this is very useful! –  Juan A. Navarro Oct 4 '10 at 10:51

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\ --}}
share|improve this answer
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 '10 at 15:23
    
Lev's right of course. Now he points it out, it's quite obviously a really bad idea. –  Geoffrey Jones Oct 3 '10 at 22:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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