feat(latex): modify \backmatter to change page numbering to roman while preserving frontmatter page count

This commit is contained in:
Rifqi D. Panuluh
2025-08-07 22:46:43 +00:00
parent e183040c13
commit e2cfd0329f
2 changed files with 20 additions and 1 deletions

View File

@@ -131,6 +131,25 @@
\fancyhead[R]{\thepage}
}
% change the behaviour of \backmatter to change page number into roman by continue frontmatter page counter (modified from original book.cls)
\newcounter{savepagenumber}
\renewcommand\mainmatter{%
\cleardoublepage
\setcounter{savepagenumber}{\value{page}}
\@mainmattertrue
\pagenumbering{arabic}%
}
\renewcommand\backmatter{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\pagenumbering{roman}%
\setcounter{page}{\value{savepagenumber}}%
\@mainmatterfalse
}
% Chapter formatting
\titlespacing{\chapter}{0pt}{0cm}{*1.5}