I'm taking notes for my classes, and it would be nice to include the session number and date in the footer, I'm aware of custom footers using fancyhdr (custom footer for each page, chapter), but I was wishing to find something similar in functionality to \centering and \raggedleft

like \newfooter{session 1, 4 October 2021}, and that will be added to all pages following this until the next command \newfooter{sessoin 2, 5 October 2021}

I think changing fancyhdr style will make the trick like in this question, but I don't know how to apply it to my situation.

Note I'm using book document class, and I don't want to interfere with its header (and footer in each chapter beginning)

Your help is appreciated

1 Answer 1


You can use the following as a starting point. It defines \newfooter to update \customfooter - a macro that is set in the footer on pages other than the starting chapter page. Since footers are bound to a page style, the page would probably need to be shipped out (turned) with each \newfooter. So, the starred version \newfooter* doesn't issue a \clearpage, while \newfooter (the unstarred version) does.



\fancyhf{}% Clear header/footer
\newcommand{\customfooter}{}% Define \customfooter to be empty at the start

\NewDocumentCommand{\newfooter}{s m}{%
  \IfBooleanF{#1}{\clearpage}% \newfooter* doesn't \clearpage 
  \renewcommand{\customfooter}{#2}% Store new footer


\chapter{First chapter}

\newfooter*{Session 1, 4 October 2021}% Stay on current page


\newfooter{Session 2, 5 October 2021}% Just to new page



The concept is simple: Use \customfooter in the footer, and update \customfooter with the argument supplied to \newfooter.

  • How can I make footer alignment alternate between odd and even pages? (thank you) Oct 11, 2021 at 14:20
  • 1
    \fancyfoot[LE,RO] or [LO,RE] Oct 11, 2021 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .