2

I am using fncychap package to align my chapters for my dissertation as per university requirements. But the challenge I am facing now is inconsistent page numbering. I want page numbering to be on the right corner. Below is my code.

\documentclass[12pt,oneside]{book} 
\usepackage{fncychap}
\ChNameUpperCase
\ChTitleUpperCase %  also for "Table of content" etc.
\ChNameVar{\normalsize\mdseries\centering}
\ChNumVar{\normalsize\mdseries}
\ChTitleVar{\normalsize\mdseries\centering}

% following is inspired by pages 8-9 of the manual of the fncychap package
% Adding of \vspace{-3cm} to move up the word "CHAPTER" and his number
\makeatletter
\renewcommand{\DOCH}{%
\vspace{-3cm}\CNV\FmN{\@chapapp}\space \CNoV\thechapter\par\nobreak 
\vskip 10\p@}
\renewcommand{\DOTI}[1]{% 
\CTV\FmTi{#1}\par\nobreak \vskip 10\p@}
\renewcommand{\DOTIS}[1]{% 
\CTV\FmTi{#1}\par\nobreak \vskip 10\p@}
\makeatother

\usepackage{titlesec}

\titleformat{\section}
  {\normalfont\fontfamily{phv}\fontsize{14}{17}\selectfont}{\thesection}{1em}{}{\mdseries}

\centerline{ACKNOWLEDGMENTS}

\begin{document} 
\tableofcontents
\addcontentsline{toc}{section}{ACKNOWLEDGMENTS}
\addcontentsline{toc}{section}{LIST OF TABLES}
\addcontentsline{toc}{section}{LIST OF FIGURES}
\addcontentsline{toc}{section}{CHAPTER}

\listoffigures

\listoftables

\newpage 

\chapter{INTRODUCTION}

hdhdhdhdhhddh
\section{Motivation}

\newpage
\section{methods}

hdhdhdh


\end{document}

The list of tables has page numbering in the footer while page 6 is on the top right. Code result

The expected format should be page numbering on the right corner for all pages including the table of contents, list of tables, and no other information. I tried fancyhdr but it seems it is not working together with fncychap. Please help. Expected results

1 Answer 1

1

It works with fancyhdr. But you need to add \thispagestyle{fancy} before the end of the first page of a chapter. By default the first page of a chapter has his page number in the footer, but with \thispagestyle{fancy} we ask that the first page use the fancy style, which is defined below (with only a page number on the right side of the header of the page, and no footer).

As Table of content, List of figure are similar of a new chapter in the book document class, we also need to add \thispagestyle{fancy} before the end of the first page of these specials sectionning.

\documentclass[12pt,oneside]{book} 
\usepackage{fncychap} 
\ChNameUpperCase 
\ChTitleUpperCase % also for "Table of content" etc. 
\ChNameVar{\normalsize\mdseries\centering} 
\ChNumVar{\normalsize\mdseries} 
\ChTitleVar{\normalsize\mdseries\centering}

% following is inspired by pages 8-9 of the manual of the fncychap package 
% Adding of \vspace{-3cm} to move up the word "CHAPTER" and his number 
\makeatletter 
\renewcommand{\DOCH}{% 
\vspace{-3cm}\CNV\FmN{\@chapapp}\space \CNoV\thechapter\par\nobreak \vskip 10\p@} 
\renewcommand{\DOTI}[1]{% 
\CTV\FmTi{#1}\par\nobreak \vskip 10\p@} 
\renewcommand{\DOTIS}[1]{% 
\vspace{-3cm}\CTV\FmTi{#1}\par\nobreak \vskip 10\p@} 
\makeatother

\usepackage{fancyhdr} % to customize the header
\pagestyle{fancy} % uses the `fancy` style
\fancyhf{} % wipe the default settings
\fancyhead[R]{\thepage} % page number on the right side
\renewcommand\headrule{} % no line between the head and the body
\setlength{\headheight}{14.5pt} % to remove a warning

\usepackage{titlesec}

\titleformat{\section}{\normalfont\fontfamily{phv}\fontsize{14}{17}\selectfont}{\thesection}{1em}{}{\mdseries}

\usepackage{lipsum}

\begin{document} 

\chapter*{ACKNOWLEDGMENTS}
\addcontentsline{toc}{chapter}{ACKNOWLEDGMENTS}

\thispagestyle{fancy} % to use fancy style on this page

\tableofcontents 
\addcontentsline{toc}{chapter}{TABLE OF CONTENT}

\thispagestyle{fancy}

\listoffigures
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\thispagestyle{fancy}

\listoftables
\addcontentsline{toc}{chapter}{LIST OF TABLES}
\thispagestyle{fancy}

\chapter{INTRODUCTION}
\thispagestyle{fancy}

hdhdhdhdhhddh 

\section{Motivation}

\lipsum[1-10] 

\section{Methods}

hdhdhdh

\end{document}

Edit: adding some fake text + modifying the display of the table of contents, but note that chapter-like entries are displayed bold, don't know if this is what you want.

Edit 2: After a request in the comment, added \vspace{-3cm} on \DOTIS command, so the starred \chapter* (and titles like Table of content) are also shifted up to the top of the page.

Some examples of the output:

enter image description here

4
  • Thank you for the comment. This is working for the introduction, but it is not working on list of table and list of figures.
    – Roshni
    Feb 24, 2023 at 14:30
  • @Roshni I have slightly modified the code for a better table of content.
    – quark67
    Feb 24, 2023 at 18:21
  • How do I remove space from the upper margin in the table of content, and list of tables? Make it consistent with other pages.
    – Roshni
    Feb 25, 2023 at 3:05
  • Finally done. Table of content, List of figure, list of table are like starred chapter, so I have to act on \DOTIS (which format the \chapter* title).
    – quark67
    Feb 28, 2023 at 3:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .