I am trying to use roman numerals for the table of contents (and abstract, notes of thanks etc.) and then start the main body of the text from page 1 in arabic numerals. I am using the article document class and do not want a page number on the title page.
At the same time in the footer I want to show Page x of y.
i.e. I want
Title page: no number
Table of contents first page: Page i of ii
Table of contents second page: page ii of ii [ii was just chosen for this example]
First page of document: page 1 of x
Second page of document: page 2 of x
The code works fine for the table of contents, i do get page i of ii, page ii of ii etc. However, for the rest of the document I then get page 1 of ii, page 2 of ii Actually I can see what causes the mistake (the use of a \label{lastromanpage}
), but I do not know how to solve this.
\documentclass{article}
\newcommand{\Title}{Title}
\newcommand{\DueDate}{\today}
\newcommand{\Class}{}
\newcommand{\ClassTime}{}
\newcommand{\ClassInstructor}{}
\newcommand{\AuthorName}{Authorname}
\title{\vspace{2in}\textmd{\textbf{ \Title}}\\\normalsize\vspace{0.1in}\small{Due\ on\ \DueDate}\\\vspace{0.1in}\large{\textit{\ClassInstructor\ \ClassTime}}\vspace{3in}}
\date{}
\author{\textbf{\AuthorName}}
\pagestyle{fancy}
\lhead{\AuthorName}
\chead{\Class}
\rhead{\Title}
\lfoot{\lastxmark}
\cfoot{}
\rfoot{Page\ \thepage\ of\ \pageref{lastromanpage}}
\begin{document}\begin{spacing}{1.1}
\maketitle\thispagestyle{empty}\newpage
\pagenumbering{roman}\tableofcontents \label{lastromanpage}
\newpage\pagenumbering{arabic}\clearpage
Best Answer
You can also change the footer inside the document with
\rfoot
. The label for the last page number is more complicate, because\label
after the last page would not write anything in the.aux
file. For example, packagelastpage
provides a labelLastPage
that can be used with\pageref
.Full example: