Tuesday, 13 August 2013

titleps multiple headers does not accept rule changes

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}
{\sethead{}{Header-a}{}\headrule
\setfoot{}{Footer-a}{}\footrule}
\pagestyle{a}
\newpagestyle{b}
{\sethead{}{\parbox{0.4\textwidth}{\centering
Header-b\\Second line}}
{}\headrule
\setfoot{}{\parbox{0.4\textwidth}{\centering
Footer-b\\Second line}}
{}\footrule}
%\pagestyle{b}
\renewcommand\makeheadrule{\color{red}\rule[-1\baselineskip]{\linewidth}{0.4pt}}
\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.

No comments:

Post a Comment