[Tex/LaTex] Page numbering transition from frontmatter to mainmatter going wrong

hepthesispage-numberingthesis

My problem is already stated here, but I don't have enough reputation to comment on it :-/ I want to know if there are any fixes or solutions to the problem with the hepthesis class?

The last page of the table of contents is numbered with arabic numerals rather than roman numerals. Here is an MWE:

\documentclass[oneside]{hepthesis}

\begin{document}
  \begin{frontmatter}
    \tableofcontents
  \end{frontmatter}

  \begin{mainmatter}
    \chapter{Introduction}
      lalala
  \end{mainmatter}

\end{document}

Best Answer

this may or may not work, but it's too complicated for a comment.

hepthesis.cls loads scrbook.cls.

scrbook.cls defines \mainmatter thus:

\newcommand*\mainmatter{%
  \if@twoside\cleardoubleoddpage\else\clearpage\fi
  \@mainmattertrue\pagenumbering{arabic}%
}

hepthesis.cls does some fancy tinkering with \mainmatter:

%% Environment for the thesis main body
\let\@oldmainmatter\mainmatter
\specialcomment{mainmatter}{%
  %\@oldmainmatter%
  \@mainmattertrue
  \pagenumbering{arabic}%
  \adjustwidth{\@mainmatterextramargin}{\@mainmatterextramargin}%
  \begin{\@mainmatterspacing}%
}{%
  \end{\@mainmatterspacing}%
  \endadjustwidth%
  \ignorespacesafterend%
}

it seems to me that since \mainmatter = \@oldmainmatter already sets the page numbering to \arabic, it should be possible to just comment out the line

\pagenumbering{arabic}%

in the hepthesis definition since it should already be there, with better timing.

(i haven't tried this, so it's not guaranteed, but i think it's a reasonable analysis. and if it doesn't work, i'll be happy to delete this answer.)