Continue page numbering of frontmatter in backmatter

numberingpage-numbering

I have a document like this:

    \documentclass[a4paper, oneside]{book}
    
    \usepackage[hidelinks]{hyperref}
    \usepackage{cleveref}
    \usepackage[nottoc]{tocbibind}
    
    \begin{document}
    \frontmatter
    
    \chapter{Abstract}
     [Abstract goes here]
    
    \chapter{Introduction}
     [Introduction goes here]
    
    \tableofcontents
    
    \mainmatter
    
    
    \backmatter
    \chapter{Conclusion}
     [Conclusion goes here] 
    
    \end{document}

With this document, I have Roman page numbering for \frontmatter (containing Abstract and Introduction), and Arabic numbering after that.

What I want is to have \backmatter continue the page numbering of frontmatter. At the moment backmatter continues the page numbering of mainmatter.

Best Answer

This is similar to Appendix Divider Page Roman Numbering, with the difference you want to use \backmatter.

\documentclass{book}

\usepackage{lipsum}

\makeatletter
\newcounter{savedfrontmatterpage}
\renewcommand{\mainmatter}{%
  \cleardoublepage
  \setcounter{savedfrontmatterpage}{\value{page}}%
  \@mainmattertrue
  \pagenumbering{arabic}%
}

\renewcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \@mainmatterfalse
  \pagenumbering{roman}%
  \setcounter{page}{\value{savedfrontmatterpage}}%
}
\makeatother

\begin{document}

\frontmatter

\tableofcontents

\chapter{Summary}

\lipsum[1]

\mainmatter

\chapter{Title}

\lipsum

\chapter{Title}

\lipsum

\backmatter

\chapter{Back}

\lipsum

\end{document}

The value of page is saved before switching the numbering scheme, then reinstated at \backmatter.

Not that I consider this to be a good idea: readers won't be able to find where the back matter starts.

enter image description here