[Tex/LaTex] How to write custom footer for some pages

fancyhdrheader-footer

I am using fancyhdr to hide header and footer in some pages but I also want to write custom footers for certain pages. Is there an easy way to do it?

Or is there any way to put define text in the center of footer?

I am using XeTeX.

Best Answer

There is a standard way to do so in fancyhdr, however, I added something like "copy {fancy} style into {footmark} style" so that you don't have to change everything:

\makeatletter
% new style {footmark}
\fancypagestyle{footmark}{
  \ps@@fancy % use {fancy} style as a base of {footmark}
  \fancyfoot[C]{\footmark}
}
% sets value of \footmark and sets the correct style for this page only
\newcommand\markfoot[1]{\gdef\footmark{#1}\thispagestyle{footmark}}
\makeatother

And in the document, in a text that is on the page, you say:

\markfoot{This is foot text.}

This should print This is foot text. centered in the footer of the current page.

Related Question