I'm using the following commands inside my main TeX file right after the ToC.
\mainmatter
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\lhead[\thepage]{\leftmark}\chead[]{}\rhead[\myentitle]{\thepage}
\lfoot{}\cfoot{}\rfoot{}
I want to put it all into a new command \MainMatter. How can I do this? I have just tried to do so, however, I get the following error.
Illegal parameter number in definition of `\MainMatter`}.
How can this be done?

##to get a#– David Carlisle Sep 15 '14 at 14:50##1... where is the\newcommandinsidenewcommand? – Sep 15 '14 at 15:00