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.

I'm trying to place page numbering at the top centre (as required by submission guidelines at my university).

It should be a very easy thing to do, but it seems impossible... I spent a day familiarising with fancyhdr package but it adds up way too many useless things on the header (title of the chapter, section, etc.)... whilst I just need the page numbering.

Can somebody illuminate me on this issue?


this below is the updated MWE (as suggested by cmhughes). At the moment page numbering is all centred in the header, except for TOC, LOF, LOT and the first page of each chapter. Here, page numbering does not appear at all. Thanks a lot for you help guys! much appreciated

\documentclass[12pt, a4paper]{report}

\linespread{1.6}

\usepackage{natbib}

\usepackage{geometry}

\geometry{includeheadfoot,
  headheight=14pt,
  left=4cm,
  right=2cm,
  top=2.5cm,
  bottom=2.5cm}

\usepackage{fancyhdr}

\fancyhf{}

\fancyhead[C]{\thepage}

\pagestyle{fancy}

\fancypagestyle{plain}

\fancyhf{} % clear all header and footer fields

\fancyhead[C]{\thepage}

\renewcommand{\headrulewidth}{0pt}

\begin{document}

\pagenumbering{gobble}

\title{}

\author{}

\date{}

\maketitle

\renewcommand{\abstractname}{}

\begin{abstract}

lipsum

\end{abstract}

\chapter*{Acknowledgments}

lipsum

\tableofcontents

\cleardoublepage

\pagenumbering{roman}

\listoffigures 

\addcontentsline{toc}{chapter}{List of figures}

\listoftables 

\addcontentsline{toc}{chapter}{List of tables}

\newpage

\pagenumbering{arabic}

\chapter{}

lipsum

\clearpage

\addcontentsline{toc}{chapter}{Bibliography}

\bibliographystyle{apsr}

\bibliography{biblio}

\end{document}
share|improve this question
    
Hi Andrea, Welcome to TeX.SE! It's usually best to provide a complete MWE where possible :) –  cmhughes Dec 30 '12 at 2:38
add comment

1 Answer

The following should do the trick

\fancyhf{}
\fancyhead[C]{\thepage}
\pagestyle{fancy}

but in the absence of a complete MWE, it's hard to tell :)

The command \fancyhf{} clears all current headers and footers, and the \fancyhead[C]{<stuff>} command puts a header in the center.

If you want it to apply to the pages with the lof, lot, and toc as well, then you can redefine the plain pagestyle as detailed in the documentation of the fancyhdr package

% redefine the plain pagestyle
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[C]{\thepage} % except the center
}

For reference, the following is a complete MWE.

\documentclass[12pt,a4paper]{report}
\usepackage{fancyhdr}
\usepackage{lipsum}

\fancyhf{}
\fancyhead[C]{\thepage}
\pagestyle{fancy}

% redefine the plain pagestyle
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[C]{\thepage} % except the center
}

\begin{document}

\tableofcontents
\listoftables
\listoffigures
\chapter{}
\lipsum

\end{document}
share|improve this answer
    
wow it works! Thanks very much! The only problem is that it does not work for the list of tables, list of figures and the first page of each chapter... ...I'm trying to copy and paste the MWE in a sec –  Andrea Lagna Dec 30 '12 at 2:45
    
@AndreaLagna you're welcome :) it wasn't obvious from your question that you were concerned with the toc, lof, and lot; the pagestyle is different- I'll update my answer. Please remember a MWE for the future! Don't forget to upvote appropriate answers as soon as you have enough reputation to do so :) Welcome! –  cmhughes Dec 30 '12 at 2:49
    
\documentclass[12pt, a4paper]{report} \linespread{1.6} \usepackage{natbib} \usepackage{color} \usepackage{url} \usepackage{rotating} \usepackage{amsmath} \usepackage{textcomp} \usepackage{marvosym} \usepackage{fancyhdr} \usepackage{setspace} \setcounter{secnumdepth}{5} \setcounter{tocdepth}{5} \fancyhf{} \fancyhead[C]{\thepage} \pagestyle{fancy} \renewcommand{\headrulewidth}{0pt} \begin{document} \pagenumbering{gobble} \tableofcontents \cleardoublepage \pagenumbering{roman} \listoffigures \listoftables \newpage \pagenumbering{arabic} \chapter{} \end{document} –  Andrea Lagna Dec 30 '12 at 2:53
    
ooch sorry that MWE looks quite messy... I will for sure as soon as I manage to familiarise with latex a bit ; ) thanks again –  Andrea Lagna Dec 30 '12 at 2:55
1  
You can update the question and put the code there. That way, it's clearer to future readers as well. Also, make sure you mark the correct answer using the little "tick mark" below the vote symbols for the answer. –  recluze Dec 30 '12 at 5:42
add comment

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.