# titleps multiple headers does not accept rule changes

I want to use several different headers and footers in a document. After a lot of trying I have decided to use titleps as the way to go, as I in any case redefine the sections, subsections, etc.

The problem is that I have to move the footrule up, because I have the requirement to add bits that are spread over two lines.

I found that if I use only one page style the redefinition of head- or footrule works, but one must apparently place it after one have selected a pagestyle else its not defined.

Here is an MWE:

\documentclass{article}
\usepackage{xcolor}
\usepackage{titleps}

\newpagestyle{a}
\setfoot{}{Footer-a}{}\footrule}
\pagestyle{a}

\newpagestyle{b}
\setfoot{}{\parbox{0.4\textwidth}{\centering
Footer-b\\Second line}}
{}\footrule}

%\pagestyle{b}

\renewcommand\makefootrule{\color{green}\rule[1.2\baselineskip]{\linewidth}{0.8pt}}
\begin{document}
\pagestyle{a}
Page 1
\clearpage
\pagestyle{b}
Page 2
\end{document}


With this I get different headers/footers, but the redefinition of the head/footrule has no effect.

How could one achieve that?

I would only need one definition of it as it would be common to my whole document, but in general there could also be the requirement to change it per pagestyle.

-

Unfortunately the commands you are trying to redefine are local to a page style, i.e. defining them directly in the preamble will not work because the page style settings will override them.

So, you can redefine those commands each time you change the page style or incorporate them in each page style, which is the best solution.

\documentclass{article}
\usepackage{xcolor}
\usepackage{titleps}

\newpagestyle{a}{%
\setfoot{}{Footer-a}{}
\renewcommand\makefootrule{\color{green}\rule[1.2\baselineskip]{\linewidth}{0.8pt}}
}

\newpagestyle{b}{%
\setfoot{}{\parbox{0.4\textwidth}{\centering
Footer-b\\Second line}}{}
\renewcommand\makefootrule{\color{green}\rule[1.2\baselineskip]{\linewidth}{0.8pt}}
}

\begin{document}
\pagestyle{a}
Page 1
\clearpage
\pagestyle{b}
Page 2
\end{document}


will output the desired result:

-
This does the job! –  Louis Aug 13 '13 at 16:11