# Page number formatting

\documentclass[12pt, a4paper]{article}
\usepackage[
top=3.5cm,
bottom=2cm,
left=3.5cm,
right=2cm,
]{geometry}
\usepackage{fancyhdr}
\usepackage{sectsty}
\pagestyle{fancy}
\fancyhf{}
\usepackage{mathptmx}
\usepackage{tocloft}
\begin{document}
\tableofcontents
\newpage
\section{INTRODUCTION}
\subsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.
\begin{itemize}
\item Coverage and Difficult to Interact: Wii wand is not interactive enough and works effectively only within the projected screen space which makes interacting with the screen difficult and not intuitive
\end{itemize}
\end{document}


Page numbers are to be placed two centimeters from the top and right hand margins on the page and must be 12 point. I have managed to get the page numbers to the right, I also have list of figures, list of figures and first page of table of contents, in these, the page numbers are being shown in default foot center.

• You can place elements in then headers and footers using packages like scrlayer-scrpage or fancyhdr. Package showframe helps in understanding where the header/footer starts/ends. – Johannes_B Nov 19 '14 at 15:26
• I have edited the MWE, I need some specific margin of 2cm at top and right of the page number, how does one achieve with fancyhdr? – tilaprimera Nov 19 '14 at 15:42
• use geometry package like \usepackage[leftmargin=2cm,rightmargin=2cm,paperwidth=8in,paperheight=10in]{geometry}. – Balaji Nov 19 '14 at 15:49
• I need to use a separate margin for the page number, in my MWE, the margins are for the overall document. Can I not specify a page number margin exclusively? – tilaprimera Nov 19 '14 at 15:50
• What corner of the page number bounding box should be considered? – egreg Nov 19 '14 at 16:12

Your page number is already at 2cm from the right margin. In order to move it up, just add headsep=1.5cm, so its base will be at 2cm from the page margin. If it's the top that should be at 2cm from the page margin, then use

headsep=\dimexpr1.5cm-8.1pt\relax,


in the code that follows, because 8.1pt is the height of a digit for the Times font at a 12pt font size.

\documentclass[12pt, a4paper]{article}
\usepackage[
top=3.5cm,
bottom=2cm,
left=3.5cm,
right=2cm,
]{geometry} % must go before \pagestyle{fancy}

\usepackage{newtxtext,newtxmath}
%\usepackage{mathptmx}% better than times

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}

\begin{document}
\section{INTRODUCTION}
\subsection{Background}
LOREM IPSUM is a graphical bla bla bla and is a bla bla bla that starts with nothing but that.
\begin{itemize}
\item Coverage and Difficult to Interact: Wii wand is not interactive enough and works effectively
only within the projected screen space which makes interacting with the screen difficult and not
intuitive
\end{itemize}

\end{document}


Note that the times package is deprecated. Use what I added or mathptmx.

• My table of contents is messed up, take a look at the MWE I have posted. I have edited my document based on your suggestions! – tilaprimera Nov 19 '14 at 16:40
• @tilaprimera You need \usepackage[titles]{tocloft} (or remove the call to the package altogether). – egreg Nov 19 '14 at 16:51
• How do I know if my font for the page number is 12 pt or not? – tilaprimera Nov 19 '14 at 16:56
• @tilaprimera It's in the same font size as the rest of the text. – egreg Nov 19 '14 at 16:57