I'm currently finishing up my PhD thesis, and have managed to acquire a LaTeX template from a colleague.
This template (with the .sty code presented below) used to produce page numbers in either the top left or top right of the page. However, even when compiling the original thesis of my colleague (written around several years ago), the page numbers will no longer appear (whereas the identical script used to produce page numbers back then).
My knowledge on LaTeX is however very much base level. So I was wondering whether one of you would be able to identify where the problem lies. That would be a life saver for me.
If additional info is needed, please let me know.
Thanks in advance!
Code: Select all
\ProvidesPackage{thesis}[2006/03/07 v1.1 thesis definitions (HA)]
\RequirePackage{xkeyval}
\RequirePackage{xcolor}
% Package options
\DeclareOptionX{includeall}{\let\includeonly\@gobble}
\DeclareOptionX{singlespacing}{%
\let\singlespacing\relax
\renewenvironment{onehalfspace}{}{}%
}
% Optimize layout
% 150 standard
% 1000 suppresses widows and orphans
% 10000 eliminates them but may worsen the rest of the page
% use \raggedbottom?
\DeclareOptionX{suppressWO}{%
\widowpenalty1000
\clubpenalty1000
}
\DeclareOptionX{eliminateWO}{%
\widowpenalty10000
\clubpenalty10000
}
\DeclareOptionX{raggedbottom}{\raggedbottom}
\newif\ifthesis@embedlinks
\DeclareOptionX{embedlinks}{\thesis@embedlinkstrue}
\DeclareOptionX{blacklinks}{\definecolor{hylinkcolor}{RGB}{0,0,0}}
\DeclareOptionX{bluelinks}{\definecolor{hylinkcolor}{RGB}{0,0,102}}
\DeclareOptionX{manuscript}{\let\manuscript\endinput}
\DeclareOptionX{final}{\let\manuscript\relax}
\ExecuteOptionsX{blacklinks,manuscript}
\ProcessOptionsX\relax
% Margins
% \thesis@margin gives normal margin
% \thesis@rmargin gives right margin (outside margin)
% \thesis@emargin is the difference between \thesis@rmargin and
% \thesis@margin and this will be used for page numbers,
% section numbers and fullwidth environments.
% Text width is given by: \paperwidth-\thesis@margin-\thesis@rmargin
\newlength\thesis@margin\thesis@margin3.2cm
\newlength\thesis@rmargin\thesis@rmargin4.1cm
\newlength\thesis@emargin
\thesis@emargin\thesis@rmargin
\advance\thesis@emargin-\thesis@margin\advance\thesis@emargin1cm
\newlength\thesis@topmargin\thesis@topmargin\thesis@margin\advance\thesis@topmargin-2mm
\newlength\thesis@bottommargin\thesis@bottommargin\thesis@margin\advance\thesis@bottommargin2mm
% Required packages
%\RequirePackage[widespace]{fourier} % option used to allow more space between words, avoiding overfull hboxes
%\RequirePackage{amssymb}
\RequirePackage[T1]{fontenc}
\RequirePackage[bitstream-charter]{mathdesign}
% For the following to work, make sure cm-super is installed!
\RequirePackage{microtype}
\RequirePackage[includehead,margin=\thesis@margin,right=\thesis@rmargin,headheight=14pt,top=\thesis@topmargin,bottom=\thesis@bottommargin]{geometry}
\RequirePackage{fancyhdr} \RequirePackage{graphicx}
\RequirePackage{graphicx-pspdf} \RequirePackage{verbatim}
\RequirePackage{psfrag} \RequirePackage{amsmath,amsthm}
\RequirePackage[dutch,english]{babel}
% float must go before setspace to avoid spacing problems in H floats!
\RequirePackage{float}
\RequirePackage{setspace}
\RequirePackage{xspace}
\RequirePackage{braket}
\RequirePackage{multirow}
\RequirePackage{threeparttable}
\RequirePackage{pdflscape}
\RequirePackage{subfig}
\RequirePackage{lipsum}
\RequirePackage{tensor}
\RequirePackage{bm}
\RequirePackage{subfig}
\RequirePackage{float}
\RequirePackage{epstopdf}
\RequirePackage[sc]{mathpazo}
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
%\RequirePackage{nicefrac}
% xkeyval doesn't include this definition in keyval.tex, oops...
% I never expected/knew that packages were using this internal.
\def\KV@def#1#2[#3]{%
\@namedef{KV@#1@#2@default\expandafter}\expandafter
{\csname KV@#1@#2\endcsname{#3}}%
\@namedef{KV@#1@#2}##1}
%\RequirePackage{xfrac}
% Only use the ability of hyperref to make nice pdf page numbers
% for the frontmatter. We do not need the rest.
%\RequirePackage{varioref} % varioref needs to go before hyperref
\ifthesis@embedlinks
\RequirePackage[
setpagesize=false,pdfpagelabels,colorlinks,citecolor=hylinkcolor,
urlcolor=hylinkcolor,linkcolor=hylinkcolor,backref=page
]{hyperref}
\else
\RequirePackage[
setpagesize=false,pdfpagelabels,implicit=false,bookmarks=false,
colorlinks,citecolor=black,urlcolor=black,linkcolor=black
]{hyperref}
\fi
\RequirePackage[sort&compress]{natbib}
\RequirePackage{enumitem}
%\RequirePackage[section]{placeins}
\RequirePackage[format=hang,width=.85\hsize,labelfont=md]{caption}
\RequirePackage{sectsty,caption}
\allsectionsfont{\fontfamily{ppl}}
\RequirePackage{dcolumn}
\RequirePackage{esvect}
\RequirePackage{appendix}
% The appendix package thinks we fully loaded hyperref and tries
% to use it's commands. We didn't load hyperref fully, so internal
% commands like sections are not redefined so also appendix should
% use the standard commands.
\ifthesis@embedlinks\else
\AtBeginDocument{\@pphyperfalse}
\fi
% Input path
\def\inputpath#1{%
\def\input@path{{#1/}{#1/figures/}}%
\graphicspath{{#1/figures/}}%
}
% Math definitions
\DeclareMathOperator\E{\mathbb E}
\DeclareMathOperator\Var{\mathbb Var}
\DeclareMathOperator\Cov{\mathbb Cov}
\DeclareMathOperator\Vol{\mathbb Vol}
\DeclareMathOperator\bbP{\mathbb P}
\DeclareMathOperator\bbQ{\mathbb Q}
\DeclareMathOperator\R{\mathbb R}
%\DeclareMathOperator\supp{\mathbf{supp}}
%\DeclareMathOperator\Prob{\mathbf{Prob}}
\DeclareMathOperator\supp{supp}
\DeclareMathOperator\Prob{Prob}
\DeclareMathOperator\calA{\mathcal A}
\DeclareMathOperator\calB{\mathcal B}
\DeclareMathOperator\calC{\mathcal C}
\DeclareMathOperator\calD{\mathcal D}
\DeclareMathOperator\calE{\mathcal E}
\DeclareMathOperator\calF{\mathcal F}
\DeclareMathOperator\calL{\mathcal L}
\DeclareMathOperator\calM{\mathcal M}
\DeclareMathOperator\calP{\mathcal P}
\DeclareMathOperator\calS{\mathcal S}
\DeclareMathOperator\calT{\mathcal T}
\DeclareMathOperator\calU{\mathcal U}
\DeclareMathOperator\calX{\mathcal X}
\DeclareMathOperator\calZ{\mathcal Z}
\DeclareMathOperator\sgn{sgn}
\DeclareMathOperator*\argmin{argmin}
\DeclareMathOperator*\argmax{argmax}
\DeclareMathOperator\e{e}
\DeclareMathOperator\N{N}
\DeclareMathOperator\U{U}
\DeclareMathOperator{\diag}{diag}
\def\bcdot{\raisebox{2.4pt}{\textbf{\large.}}}
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}}
\let\epsi\varepsilon
\let\HSp\odot
\AtBeginDocument{\let\set\mathbb}% fourier defines \mathbb \AtBeginDocument
\allowdisplaybreaks
% Page style
\pagestyle{fancy}
\fancyhead[RO,LE]{}
\def\fancy@pagenumber{\normalsize\fontfamily{ppl}\thepage}
\fancyhead[LO]{\small\fontfamily{ppl}\rightmark}
\fancyhead[RE]{\small\fontfamily{ppl}\leftmark}
\fancyfoot{}
\def\@fancyhead#1#2#3#4#5{%
\@tempdima\headwidth\advance\@tempdima\thesis@emargin
#1\hb@xt@\@tempdima{\fancy@reset
\ifodd\c@page\else\parbox[b]\thesis@emargin{\raggedright\fancy@pagenumber}\fi
\@fancyvbox\headheight{\hbox{%
\rlap{\parbox[b]\headwidth{\raggedright#2}}\hfill
\parbox[b]\headwidth{\centering#3}\hfill
\llap{\parbox[b]\headwidth{\raggedleft#4}}%
}\headrule}%
\ifodd\c@page\parbox[b]\thesis@emargin{\raggedleft\fancy@pagenumber}\fi
}#5%
}
% Determine page on which material appears
\newcounter{checkpage}
\def\checkpage{%
\stepcounter{checkpage}%
\expandafter\@checkpage\expandafter{\romannumeral\c@checkpage}%
}
\def\@checkpage#1{%
\write\@mainaux{%
\string\gdef\expandafter\string\csname thesis@cp@#1\endcsname
{\the\c@page}%
}%
}
\def\realpage{%
\ifcsname thesis@cp@\romannumeral\c@checkpage\endcsname
\csname thesis@cp@\romannumeral\c@checkpage\endcsname\else0\fi
}
% Marks
\def\chaptermark{%
\@ifstar{\@mainmatterfalse\thesis@chaptermark}\thesis@chaptermark
}
\def\thesis@chaptermark#1{%
\markboth{%
\ifnum\c@secnumdepth>\m@ne
#1%
\if@mainmatter
\ \vrule\ \@chapapp\ \thechapter
\fi
\fi
}{}%
}
\def\sectionmark#1{%
\markright{%
\ifnum\c@secnumdepth>\z@
Section\ \thesection\ \vrule\ %
\fi
#1%
}%
}
% Chapters
\def\@makechapterhead{\@tempswatrue\thesis@makechapterhead}
\def\@makeschapterhead{\@tempswafalse\thesis@makechapterhead}
\definecolor{chapternumber}{gray}{0.00}
\def\thesis@makechapterhead#1{{%
\if@tempswa\else\chaptermark*{#1}\fi
\singlespacing
\normalfont
\vspace*{00pt}%
\hspace*{8pt}%
\parindent\z@
\thispagestyle{empty}%
\leavevmode\huge
\setbox\@tempboxa\hbox{%
\if@tempswa
\vbox to 0pt{%
\vskip-15pt
\setbox\@tempboxa\hbox to 463pt{%
\fontsize{25pt}{25pt}\fontfamily{ppl}\selectfont
\textcolor{chapternumber}{\thechapter}%
}%
\@tempdima\paperwidth
\advance\@tempdima-\thesis@margin
\advance\@tempdima-\thesis@rmargin
\advance\@tempdima\thesis@emargin
\advance\@tempdima-\wd\@tempboxa
\advance\@tempdima-2mm
\hbox to 00pt{%
\hskip\@tempdima
\usebox\@tempboxa
% \hskip11cm
% \fontsize{200pt}{200pt}\selectfont
% \textcolor{chapternumber}{\textsl\thechapter}%
\hss
}%
\vss
}%
% \setbox\@tempboxa\hbox{\Huge\textsf\thechapter}%
% \copy\@tempboxa
% \lower.65\baselineskip\llap{%
% \vrule\@width\wd\@tempboxa\@height\wd\@tempboxa
% }%
% \hskip1ex
\fi
\vrule\@height1.5pc\@depth3\baselineskip\hskip1ex
}%
\copy\@tempboxa
\raggedright\vtop{\advance\hsize-\wd\@tempboxa{#1}}%
\par
\vspace*{40pt}%
}}
% Sections
\setcounter{secnumdepth}{2}
\def\section{%
\@startsection{section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\singlespacing\normalfont\Large\fontfamily{ppl}}%
}
\def\subsection{%
\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\singlespacing\normalfont\large\fontfamily{ppl}}%
}
\def\subsubsection{%
\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\singlespacing\normalfont\normalsize\fontfamily{ppl}}%
}
% Section markup
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\csname the#1\endcsname\relax}%
\fi
\begingroup
#6{%
\noindent\checkpage
\@tempdima\thesis@emargin
\advance\@tempdima-5mm
\ifodd\realpage
\leftline{%
\vtop{\noindent\interlinepenalty\@M#8\@@par}%
\ifnum #2>\c@secnumdepth\else
\hb@xt@\thesis@emargin{%
\hfil\@svsec\kern1.8pt
\lower2.4pt\llap{%
% \vrule\@depth.4em
%\vrule\@width\@tempdima\@height0pt\@depth\z@
}%
%\vrule\@height.8em\@depth2.4pt
}%
\fi
}%
\else
\rightline{%
\ifnum #2>\c@secnumdepth\else
\hb@xt@\thesis@emargin{%
%\vrule\@height.8em\@depth2.4pt
\lower2.4pt\rlap{%
%\vrule\@width\@tempdima\@height0pt\@depth\z@
% \vrule\@depth.4em
}%
\kern1.8pt\@svsec\hfil
}%
\fi
\vtop{\noindent\interlinepenalty\@M#8\@@par}%
}%
\fi
}%
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
\par \nobreak
\vskip #5\relax
\@afterheading
\ignorespaces
}
% Table of contents - avoid hyphenation in chapter entries
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth plus 5em
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
% Bibliography
\bibpunct(),a{},
\bibliographystyle{hendri}
% Empty page style on empty pages
\def\cleardoublepage{%
\clearpage
\if@twoside
\ifodd\c@page\else
\hbox{}\thispagestyle{empty}%
\newpage
\if@twocolumn
\hbox{}\newpage
\fi
\fi
\fi
}
% Use full page width
\newif\ifffullwidth
\newenvironment{fullwidth}{%
\@tempdima\textwidth
\advance\@tempdima\thesis@emargin
\ifffullwidth
\advance\@tempdima-2\fboxsep
\advance\@tempdima-2\fboxrule
\fi
\setbox\@tempboxa\vbox\bgroup
\hsize\@tempdima
\textwidth\@tempdima
\checkpage
}{%
\egroup
\ifffullwidth\setbox\@tempboxa\hbox{\fbox{\usebox\@tempboxa}}\fi
\vskip\lineskip
\noindent
\ifodd\realpage\def\@tempb{l}\else\def\@tempb{r}\fi
\makebox[\textwidth][\@tempb]{\usebox\@tempboxa}%
\vskip\lineskip
}
\newenvironment{fullwidth*}{\ffullwidthtrue\fullwidth}\endfullwidth
% Captions
%\newlength\cwidth
%\cwidth.85\hsize
%\def\fnum@figure{{\fontfamily{ppl}\figurename\nobreakspace\thefigure}}
%\def\fnum@table{{\fontfamily{ppl}\tablename\nobreakspace\thetable}}
% This alternative includes the "Figure" in the caption text
%\long\def\@makecaption#1#2{%
% \vskip\abovecaptionskip
% \sbox\@tempboxa{#1: #2}%
% \ifdim\wd\@tempboxa>\hsize
% \hfil\parbox\hsize{#1: #2}\hfil\par
% \else
% \global\@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
% \fi
% \vskip\belowcaptionskip
%}
% This alternative lets the "Figure" jump out of caption text
%\long\def\@makecaption#1#2{%
% \vskip\abovecaptionskip
% \sbox\@tempboxa{#1: #2}%
% \ifdim\wd\@tempboxa>\captionwidth
% \sbox\@tempboxa{#1: }%
% \hfil#1: \vtop{\hsize\captionwidth\advance\hsize-\wd\@tempboxa\leavevmode#2}\hfil\par
% \else
% \global\@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
% \fi
% \vskip\belowcaptionskip
%}
% Theorems
\def\th@plain{%
\itshape % body font
\thm@headpunct{}%
% \thm@headfont{\sffamily}%
\let\thmheadnl\newline
}
\def\th@plainnn{%
\itshape % body font
\thm@headpunct{}%
\thm@headsep\z@
}
\def\th@definition{%
\normalfont % body font
\thm@headpunct{}%
% \thm@headfont{\sffamily}%
\let\thmheadnl\newline
}
\def\th@remark{%
\thm@headfont{\itshape}%
\normalfont % body font
\thm@preskip\topsep \divide\thm@preskip\tw@
\thm@postskip\thm@preskip
\thm@headpunct{}%
\let\thmheadnl\newline
}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{hypothesis}{Hypothesis}[chapter]
\newtheorem{assumption}{Assumption}[chapter]
\theoremstyle{remark}
\newtheorem{example}{Example}[chapter]
\theoremstyle{plainnn}
\newtheorem*{theoremnn}{}
% Modifications of theorem commands to be able to repeat a
% theorem with the same number. The <...> argument must be the label
% of the original theorem.
\def\@begintheorem#1#2[#3]{%
\@ifnextchar<{\@@begintheorem{#1}{#2}[#3]}{\@@begintheorem{#1}{#2}[#3]<>}%
}
\def\@@begintheorem#1#2[#3]<#4>{%
\deferred@thm@head{\the\thm@headfont \thm@indent
\@ifempty{#1}{\let\thmname\@gobble}{\let\thmname\@iden}%
\@ifempty{#2}{\let\thmnumber\@gobble}{\let\thmnumber\@iden}%
\@ifempty{#3}{\let\thmnote\@gobble}{\let\thmnote\@iden}%
\thm@swap\swappedhead\thmhead{#1}{#2}{#3}{#4}%
\the\thm@headpunct
\thmheadnl % possibly a newline.
\hskip\thm@headsep
}%
\ignorespaces}
\def\thmhead#1#2#3#4{%
\thmname{#1}%
\@ifempty{#4}{%
\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
}{%
\thmnumber{\@ifnotempty{#1}{ }\@upn{\ref*{#4}}}%
}%
\thmnote{ {\the\thm@notefont(#3)}}%
}
% Modify proof environment to include \sffamily
%\renewenvironment{proof}[1][\proofname]{\par
% \pushQED{\qed}%
% \normalfont \topsep6\p@\@plus6\p@\relax
% \trivlist
% \item[\hskip\labelsep
% \itshape\sffamily
% #1\@addpunct{.}]\ignorespaces
%}{%
% \popQED\endtrivlist\@endpefalse
%}
% itemize and enumerate lists
\setlist{labelsep=1em,leftmargin=*,labelindent=\parindent,itemsep=0pt,topsep=0pt,partopsep=20pt,parsep=0pt}
\let\listitem\textsf
% Set up varioref
%\labelformat{equation}{(#1)}
% Miscellaneous commands
\def\Matlab{\textsc{Matlab}\xspace}
\expandafter\def\expandafter\LaTeX\expandafter{\LaTeX\xspace}
\urlstyle{same}
% Needed to make place for numbers in toc wide enough to avoid overfull hboxes
\AtBeginDocument{%
\sbox\@tempboxa{000}%
\xdef\@pnumwidth{\the\wd\@tempboxa}%
}
% From multirow.sty, to align entries at the top of the cell
\def\@xmultirow#1[#2]#3[#4]#5{\@tempcnta=#1%
% \@tempdima\@tempcnta\ht\@arstrutbox
% \advance\@tempdima\@tempcnta\dp\@arstrutbox
% \ifnum\@tempcnta<0\@tempdima=-\@tempdima\fi
\@tempdima\z@
\advance\@tempdima#2\bigstrutjot
\if*#3\setbox0\vtop to \@tempdima{\vfill\multirowsetup
\hbox{\strut#5\strut}\vfill}%
\else
\setbox0\vtop to \@tempdima{\hsize#3\@parboxrestore
\vfill \multirowsetup \strut#5\strut\par\vfill}%
\fi
\ht0\z@\dp0\z@
\ifnum\@tempcnta<0\advance\@tempdima-\dp\@arstrutbox
\else\@tempdima=\ht\@arstrutbox
\ifnum#2>0 \advance\@tempdima\bigstrutjot \fi
\fi
\advance\@tempdima#4\relax
\leavevmode\vtop{\vskip-\@tempdima\box0\vss}}
% Backrefs
%\def\backref#1{%
% \expandafter\def\expandafter\thesis@tempa\expandafter{#1}%
% \@onelevel@sanitize\thesis@tempa
% \@expandtwoargs\in@{,}\thesis@tempa
% \ifin@
% Cited on pages\
% \else
% Cited on page\
% \fi
% #1.%
%}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifnum#1=1 %
Cited on page #2.%
\else
Cited on pages #2.%
\fi
}