kks32 / phd-thesis-template

A LaTeX / XeLaTeX / LuaLaTeX PhD thesis template for Cambridge University Engineering Department (CUED)
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/
MIT License
820 stars 392 forks source link

Change page numbering #232

Closed angoodkind closed 2 years ago

angoodkind commented 2 years ago

Per my institution's requirements, I need to start numbering my pages from the title page. Their two requirements are, though: 1) No page number actually appears on the title page (although it is technically page 1). 2) The next page, e.g. the dedication page, is labeled page 2. Every page aside from the title page has an arabic numeral page number.

What can I alter to have it appear this way? Thanks!

GR8DAN commented 2 years ago

See if any of the other related issues on this topic cover your problem, try issues #200, #209 and #101.

angoodkind commented 2 years ago

Thanks, unfortunately they did not. There are still pages without headers, both in frontmatter and the beginnings of chapters. In addition, they did not address using arabic numbers, starting with the 2nd page, and running throughout.

GR8DAN commented 2 years ago

Sounds like you don't want a distinct frontmatter and mainmatter. Try changing line 112 in thesis.tex from \frontmatter to \mainmatter, and delete \mainmatter from line 135. Though this may mess up some of the template options, Then I think you'll have to redefine the fancyhdr plain style. E.g., changing lines 788 to 791 in PhDThesisPSnPDF.cls from:

\fancypagestyle{plain}{
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}

to

\fancypagestyle{plain}{
  \fancyhead[LO]{\nouppercase \rightmark}
    \fancyhead[LE,RO]{\bfseries\thepage}
    \fancyhead[RE]{\nouppercase \leftmark}
}

I'm assuming you've removed the \thispagestyle{empty} at the appropriate lines as well.

angoodkind commented 2 years ago

Sorry for the belated reply. This solution is almost perfect. Thank you! The one small problem is that there's not a header/page # on the first page of the TOC (but there is page numbering displayed on the 2nd page of the TOC). Any notion of how to fix that?

GR8DAN commented 2 years ago

This may be down to line 727 in PhDThesisPSnPDF.cls, see if changing this:

\addtocontents{toc}{\protect\thispagestyle{empty}}

to this:

\addtocontents{toc}{}

works, though it may change other pages.

angoodkind commented 2 years ago

Perfect! Thanks! It looks like it also works by just commenting out line 727. Any advantage/disadvantage to doing that?

GR8DAN commented 2 years ago

No problem commenting out the whole line as it not doing anything once \protect\thispagestyle{empty} is removed, i.e., it is no longer passing anything to the toc file.

angoodkind commented 2 years ago

Got it. Thank you again! Where can I learn how these commands work? I'm fairly familiar with now to typeset in the tex file, but not how the commands work in the cls or sty files.

GR8DAN commented 2 years ago

The Wikibooks book on LaTeX has a chapter on creating packages, but it is worth knowing about macros. Alternatively, Overleaf has a general introduction on class files/packages.

angoodkind commented 2 years ago

Thanks for these! Now I understand \makeatletter! :-)