0

I use "report" as a document class. I would like to have both numberings in my document, roman and Arabic, so I included the following in my preamble:

\documentclass[12pt]{report}
\makeatletter

\newcommand\frontmatter{%
    \cleardoublepage
  %\@mainmatterfalse
  \pagenumbering{roman}}

\newcommand\mainmatter{%
    \cleardoublepage
 % \@mainmattertrue
  \pagenumbering{arabic}}

\newcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
 % \@mainmatterfalse
   }

\makeatother

\usepackage{subfiles} 


\begin{document}

\frontmatter

\addcontentsline{toc}{chapter}{ Declaration of authorship}

\addcontentsline{toc}{chapter}{ Acknowledgements}


\maketitle

\chapter*{Declaration of authorship}

some text....

\chapter*{Acknowledgements}

some text....

\tableofcontents

\mainmatter

\include{chapter 1}
\include[chapter 2}
and so on....

\end{document}

however, that prints out the page numbers only on the first and sometimes the second page of each chapter... what is missing?

update:

Declaration of authorship oage number

followed by a numberless blank page

then

Acknowledgements page number

and this is how numbering goes throughout the whole document.

2
  • 1
    Please expand your question to add figures or make a comment. May 29, 2022 at 20:00
  • @SimonDispa done, please see the updates in the post
    – sphero
    May 29, 2022 at 20:30

1 Answer 1

1

It's easier to use book than report because the former "understands" \frontmatter and \mainmatter, so page numbering will work fine without additional code. (The commands you are using are part of the class book).

Some dummy text was added to check the page numbering.

x

y

\documentclass[12pt,oneside]{book}

\usepackage{kantlipsum} % ONLY  dummy text <<<<<

\title{Great title}

\begin{document}
    
\maketitle

\frontmatter    

\chapter*{Declaration of authorship}
\addcontentsline{toc}{chapter}{ Declaration of authorship} % put after chapter* <<<<<<
\kant[1-5]

\chapter*{Acknowledgements}
\addcontentsline{toc}{chapter}{ Acknowledgements}% put after chapter* <<<<<<
\kant[1-5]

\tableofcontents

\mainmatter

\chapter{ONE}
\kant[1-5]

\chapter{TWO}
\kant[1-5]

\end{document}

Your code also works fine when adding some dummy text.

b

\documentclass[12pt]{report}
    
\makeatletter   
\newcommand\frontmatter{%
    \cleardoublepage    
    \pagenumbering{roman}}

\newcommand\mainmatter{%
    \cleardoublepage    
    \pagenumbering{arabic}}

\newcommand\backmatter{%
    \if@openright
    \cleardoublepage
    \else
    \clearpage
    \fi
}

\makeatother

\usepackage{kantlipsum} % ONLY  dummy text <<<<<

\title{Great title}

\begin{document}
    \maketitle

    \frontmatter        
    
    \chapter*{Declaration of authorship}
    \addcontentsline{toc}{chapter}{ Declaration of authorship} % put after chapter* <<<<<<
    \kant[1-5]
    
    \chapter*{Acknowledgements}
    \addcontentsline{toc}{chapter}{ Acknowledgements}% put after chapter* <<<<<<
    \kant[1-5]
    
    \tableofcontents
    
    \mainmatter
    
    \chapter{ONE}
    \kant[1-5]
    
    \chapter{TWO}
    \kant[1-5]

\end{document}
7
  • i tried the solution with the book document class and still the issue remains, please see the post again, I added figures
    – sphero
    May 29, 2022 at 19:50
  • @sphero -- "still the issue remain". Which issue? Please elaborate.
    – Mico
    May 29, 2022 at 20:24
  • +1. In the code block with the book document class, if you replace both instances of \chapter*{...} with \chapter{...}, you can get rid of both \addcontentsline directives.
    – Mico
    May 29, 2022 at 20:27
  • @Mico They are part of the OP question. May 29, 2022 at 20:30
  • @sphero I updated the book code. Run it as is and check that all pages are numbered correctly. May 29, 2022 at 20:47

You must log in to answer this question.

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