[Tex/LaTex] size of page number in footer

fontsizeheader-footerpage-numbering

I set the size of the text using \fontsize, but this seems to have no effect on the page number. I want to keep the pagestyle as plain. How can I make the font used to print the page number "grow" in size according to the text font size?

This is a good place to ask another, more embarrassing question: What is the meaning of the arguments to \fontsize? I understand that they are the font size in points, but then why two arguments? I currently use it as \fontsize{12}{12} to select font size 12pt, but I'm unsure why the number is mentioned twice.

Best Answer

The best way to adjust headers and footers is to use the fancyhdr package. With it, you can easily redefine the plain page style. In the example below, I've just used the \large command in the redefinition to make the page number larger than the fontsize set by the documentclass. If you use an exact number with fontsize it will not adjust with different document class sizes.

With respect to the two arguments of the \fontsize command, the first argument is the fontsize and the second argument is the leading. Remember that when you change the font size you also need to issue a \selectfont command to make the change active. For the 12pt standard classes, the leading is set to 14.5 pt which gives some spacing between lines. If you make it 12pt you will get very cramped looking lines. I've added some sample texts in the document below:

\documentclass[12pt]{article}
\newcommand{\sometext}{This is some text to show what happens when you change the
different parameters of the fontsize command in LaTeX. }
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields 
\fancyfoot[C]{\large\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{plain}
\begin{document}
\section{Standard leading}
\sometext\sometext\sometext\sometext\par
\section{12pt on 12pt}
\fontsize{12}{12}\selectfont\sometext\sometext\sometext\par
\section{12 pt on 13.5pt}
\fontsize{12}{13.5}\selectfont\sometext\sometext\sometext\par
\end{document}

output of codocument