# Page numbering transition from frontmatter to mainmatter going wrong

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}

• I can't get your MWE to compile. It complains about a runaway argument... See tex.stackexchange.com/q/141742/39222 for criticism of hepthesis...
– cfr
Apr 8 '14 at 1:18
• I just realised that's the page you linked to. But I think the important point there may be the criticism rather than the problem statement. Must you use hepthesis? It sounds as if it may be a painful experience.
– cfr
Apr 8 '14 at 1:40
• Ha! It's a bit too late for that. I've mostly finished writing the thesis, and I thought it'd be simple to fix such a page numbering issue. Apr 8 '14 at 9:26
• Well I can't even compile your MWE so the page numbering issue seems relatively minor!
– cfr
Apr 8 '14 at 12:43
• usually, it's just \frontmatter and \mainmatter, not a \begin ... \end construction. in any event, try adding \newpage after \tableofcontents and that should take care of the problem. Apr 8 '14 at 13:07

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}%
\begin{\@mainmatterspacing}%
}{%
\end{\@mainmatterspacing}%
\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.)

• Thank you! This was an important step! Once I commented out that line, I then had to add \cleardoublepage and \pagenumbering{arabic} at the start of the mainmatter environment in my document. This has solved the problem though (albeit in a hacky way) Apr 9 '14 at 9:27
• I am confused: Where is the command \specialcomment from? \@oldmainmatter is already commented (???). Apr 10 '14 at 0:44
• Also confused though for different reasons. @Speravir \specialcomment is, I think, from the comment package and \@oldmainmatter is, indeed, already commented in hepthesis.cls. But I don't understand where \mainmatter = \@oldmainmatter comes in/from...
– cfr
Apr 10 '14 at 1:13
• @cfr: For the latest: I think this is just a statement/conclusion of Barbara. Apr 10 '14 at 1:19
• I'm the author of hepthesis, so am interested in this although coming to it a bit late. More on that in a moment. Does anyone have an explanation of why the "timing" of the switch to arabic numbering within the env/comment goes wrong? Would re-ordering it (after a \clearpage?) help? Maybe because of how specialcomment works: I see in its manual that it does some finicky cutting of verbatim chunks of source to .cut files, which sounds fragile. Redefining it as an environment rather than a special comment might help... thoughts? Apr 14 '14 at 10:50