# Report document class with upper right page numbers and modifying chapter title format

I'm writing a lengthy masters thesis paper and am requiring some annoying editing of my TeX document. I need to have all of my main headers (table of contents, list of figures, list of tables, bibliography, and chapter headers) to be centered and at the top of their respective pages. Also, I must have the page numbers in the upper right corner of all pages. Unfortunately at the moment I'm not able to do both simultaneously. Here is my MWE:

\documentclass[12pt]{report}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage[top=1in,bottom=1in,right=1in,left=1.5in]{geometry}
\usepackage{geometry}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{float}
\usepackage[hang, raggedright]{subfigure}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{indentfirst}
\usepackage{caption}
\usepackage{tabu}
\usepackage{siunitx}
\usepackage[subfigure]{tocloft}
\usepackage{caption}
\usepackage{titlesec}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{2}

\renewcommand\cftchapfont{\mdseries}
\renewcommand\cftchappagefont{\mdseries}

\captionsetup[table]{labelsep=space}
\captionsetup[figure]{labelsep=space}

\fancyhf{}
\pagestyle{fancy}
\assignpagestyle{\chapter}{fancy}

\renewcommand{\listtablename}{\hspace{2in}\bf\large LIST OF TABLES}
\renewcommand{\listfigurename}{\hspace{2in}\bf\large LIST OF FIGURES}
\renewcommand{\bibname}{\hspace{2.1in}\bf\large REFERENCES}

\titleformat{\chapter}[display]{\normalfont\Large\bfseries\centering}{CHAPTER \thechapter}{-12pt}{\Large}
\titlespacing*{\chapter}{0pt}{-12pt}{24pt}
\titleformat{\section}{\large\bfseries}{\thesection}{1em}{}

\begin{document}

\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures

\doublespacing
\chapter{A Chapter}
some text

\clearpage
some text on another page
\end{document}


This is of course part of a much larger document (my thesis paper is currently 114 pages long...) but here I've included all of my preamble and a small working document to show my problem.

If I remove this line:

 \titleformat{\chapter}[display]{\normalfont\Large\bfseries\centering}{CHAPTER \thechapter}{-12pt}{\Large}


from the code then I do in fact get a page number in the upper right corner of the page (for just chapter headers), but of course I still need to have my headers centered and at the top. And I'm not sure how to get the table of contents, list of figures, and list of tables at the top right corner of the page.

• Add the titles option to tocloft; i.e., load it as in \usepackage[subfigure,titles]{tocloft}. There are other issues with your code, but this should solve the problem with your headings. Jul 18 '13 at 21:54
• I just added "titles" like you suggested and it didn't move my page numbers to the upper right corner. I know there are a lot of things thrown together in my program. If you have different packages that work better than the ones I'm using, or other ways of programming some of my stuff then I'm entirely open to changes. Jul 19 '13 at 3:11
• I get the numbers in the upper right corner when adding the titles option. Jul 21 '13 at 20:18

You should try to insert the following code in your preamble:

\setlength{\headheight}{15pt}
\fancypagestyle{plain}{%
\fancyhf{}
\pagestyle{plain}


This will print on all your pages the "title" (ToC, LoF, LoT, Chapter name) in the centre of the header and the page number on the upper right of the page. If you want to disable it for one page, use the \thispagestyle{empty} command.

Remark Do not forget to remove this part of your preamble

\fancyhf{}
\pagestyle{fancy}
\assignpagestyle{\chapter}{fancy}


Note You have redefined the labels for the ToC, LoF and LoT which leads to some awkward alignment in the corresponding headers. It is then up to you to decide whether you want to keep them or redefine them.

Edit As suggested by egreg, it is not optimal to redefine the plain style with the \leftmark command. A better way to go is to use the following code in the preamble:

\setlength{\headheight}{15pt}
\pagestyle{fancy}
\fancypagestyle{mystyle}{%
\fancyhf{}

and to call \thispagestyle{mystyle} after the ToC, LoF, LoT and each chapter calls if you want to have this style even on these pages. However if the ToC, the LoF or the LoT is longer than one page you will have some problem using this new style because it won't be used on the first page of the concerned table (see this question and answer). In that case one workaround is to redefine the plain style as suggested previously.
• Don't add \setlength{\headheight}{15pt} to the redefinition of the plain page style. This should be a global setting (possibly modifiable with \newgeometry, but it's another matter). Why 15pt, by the way? Also mixing “old style” (\rhead) and “new style” (\fancyhead) commands is not recommendable. Jul 21 '13 at 20:13
• +1. Still I wouldn't put \leftmark in the header for the plain page style: it doesn't seem to conform to the requirements. Jul 21 '13 at 20:54