I am using fancyhdr and want to have custom text in the header which changes every few pages. Currently I am using the trick with markboth
– I have a function \newcommand{\setheaderdata}[2]{\markboth{#1}{#2}}
and then display these data with
\fancypagestyle{mystyle}{\
\fancyhead[C]{\leftmark}
\fancyfoot[LO]{\rightmark}
}
The trouble is, now I want to add a third text to the header and since there is no centermark
, I have no way of getting it into the header.
I have tried making a custom command which I redefine every time I want to change the header text, but for some reason, the headers ignore this redefinition…
So, how do I get custom text (which changes throughout the document) into the header?
Best Answer
Unfortunatelly, I couldn't find any solution using the
fancyhdr
package and as far as I know, pagestyles cannot be renewed. But (thanks to Bernard) I found a solution using thetitleps
package:Now every time
setheaderdata
is called, the pagestyledatastyle
will contain the parameters in the header (untilsetheaderdata
is called again).