# Two distinct aliaspagestyles for a document (Or another solution to pagenumbering problem)

Is there any way to make two distinct aliaspagestyles for different parts of the document. That is to say, can I make one aliaspagestyle for the first page of the TOC while having a different one for the rest of the document?

The problem I want to fix:

Frontmatter pages should be displayed as i ii iii, while in the rest of the document should be displayed as 1/10 2/10 3/10 etc. While at the same time retaining supression of header on the first page the TOC and the chapters and have the option of editing the header for the rest of the TOC pages separately from the mainmatter pages.

\documentclass[12pt,a4paper,onecolumn,oneside,final]{memoir}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{newcent}
\usepackage[utf8x]{inputenc}
\usepackage[textwidth=14cm,textheight=22cm]{geometry}
\usepackage{lipsum}

\makepagestyle{TOC} % For the mainmatter
\createplainmark{toc}{left}{\contentsname}}
\makeoddfoot{TOC}{}{}{\thepage}

\makepagestyle{HDR} % For the mainmatter
\createmark{chapter}{left}{nonumber}{}{\space}
\createmark{section}{right}{nonumber}{}{\space}
\makefootrule{HDR}{14cm}{\normalrulethickness}{8pt}
\createplainmark{toc}{left}{\contentsname}
\createplainmark{lof}{left}{\listfigurename}
\createplainmark{lot}{left}{\listtablename}
\createplainmark{bib}{left}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}}
\makeoddfoot{HDR}{}{}{\thepage\ / \thelastpage}

\makepagestyle{ALI} % Alias for the mainmatter
\makeoddfoot{ALI}{}{}{\small \thepage\ / \thelastpage}
\makefootrule{ALI}{14cm}{\normalrulethickness}{8pt}
\aliaspagestyle{chapter}{ALI}
\aliaspagestyle{part}{ALI}

\begin{document}
\frontmatter
\tableofcontents \pagestyle{TOC}
\mainmatter \pagestyle{HDR}
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\chapter{A chapter}
\lipsum
\end{document}


I made a whole lot of lipsum chapters so you can see what I mean in the TOC. The only problem is the numbering of the first page.

I am not entirely sure that I understand your question, but I think that you are just trying to control the footers in different parts of your document and that the main problem is that headers and footers for the first page of a chapter, for example, are different to those on other pages.

There seems to be two issues with your code. First is that you should set the page style before the pages where you want the change to take effect -- currently you switch to your TOC style, for example, after writing \tableofcontents. Similarly, you need to end the page with \clearpage or \newpage before switching styles. Secondly you need a new page style for the first page of your table of contents.

You can solve the second issue by defining something like:

\makepagestyle{ALItoc} % Alias for the mainmatter
\makeoddfoot{ALItoc}{}{}{\small \thepage}
\makefootrule{ALItoc}{14cm}{\normalrulethickness}{8pt}
}


Now you can solve the remaining issues with:

\frontmatter
\pagestyle{TOC}
\aliaspagestyle{chapter}{ALItoc}
\tableofcontents\clearpage
\aliaspagestyle{chapter}{ALI}
\pagestyle{HDR}
\mainmatter