Many books have running headers from which you can conveniently find the endnotes and the pages to which they refer. They may be at the end of each chapter, or at the end of the book. The running headers have the form “Notes to pp. xx–yy” for the endnotes. The endheads package allows running headers of this form for the standard, komascript, and memoir classes. It worked for me some time ago with memoir, but now it is broken and gives error message, Undefined pagestyle. This mwe breaks when the endheads package (and its supporting commands) is activated. Can someone suggest what can be done when using memoir and the endheads package to make it work?

\usepackage{endheads} % requires oldfontcommands option for memoir class    

Text for chapter one with an endnote.   \endnote{chp 1 fn 1}

This is a second endnote. It is the first endnote of chp. 2.
\endnote{chp 2 fn 1 or second fn of the book}. Here is a second endnote of chp. 2. \endnote{chp2 fn 2}

\addcontentsline{toc}{chapter}{\protect\numberline{} \the\notescontentsname}
  • I placed an "old" (2009) copy of memoir.cls into the job folder, and this worked! It's not apparent to me what the conflict is between current versions of endheads and memoir.
    – zun
    Sep 1, 2012 at 17:38
  • In this case it seems a good measure to make a bug report to the maintainer of memoir.
    – Keks Dose
    Sep 2, 2012 at 20:07
  • @keks I made a report to the author of endheads, but not yet to the maintainer of memoir.
    – zun
    Sep 3, 2012 at 10:36

2 Answers 2


There is a bug in the style file endheads. It contains these lines:

\makeevenhead{endnotesstyle}{{\small\textrm{\thepage}}}{{\small{\em \the\notesheadername~\mymarks}}}{}
\makeoddhead{endnotesstyle}{}{{\small{\em \the\notesheadername~\mymarks}}}{{\small\textrm{\thepage}}}

This is clearly wrong, as \makeevenfoot and \makeoddfoot take four arguments just like \makeevenhead and \makeoddhead, the first being the name of the pagestyle.

I can't understand why this works with an older version of memoir ;-)

To be honest, I assume the bug was always in endheads but memoir is recently checking whether the pagestyle exists. As emptiness is the default it doesn't do much wrong if the commands are not properly executed.

Anyway, you should report to the maintainer of endheads.

As a quick fix, you can disable the wrong calls to \makeevenfoot and \makeoddfoot before loading endheads and afterwards call the correct ones like this:

\usepackage{endheads} % requires oldfontcommands option for memoir class    

Unfortunately there is no cleaner patch as the declarations are directly called in the package, not as part of a command which could be patched.

Be sure to take this quickfix out as soon as a correct version of the package is released.

Alternatively, you can make a local copy of the style file and replace the wrong declarations immediately there. Again, remember to delete the local copy as soon as a fixed version of the style is released.

  • @stephan.lehmke excellent sleuthing on your part! Earlier versions of endheads have four arguments when it determines if memoir is used, but still have only three arguments for later lines of makeevenfoot... as you point out. The quickfix works fine. I think I'll patch a local file. Earlier, I alerted the author of endheads of the problem, and will also alert him of your fix.
    – zun
    Sep 3, 2012 at 10:52

I've fixed the bug, and a new version of endheads has been sent to CTAN. It should be up in a day or so. Thanks everybody for your help!

  • Is this possible to achieve the running head by using standard book class file instead of memoir?
    – MadyYuvi
    Dec 29, 2020 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.