# Section number in endnotes

I am using the endnotes package to list all notes at the end of a document. I'd like for the section header (notes) to also include the section number just as any other section.

MWE:

\documentclass{article}
\usepackage{endnotes}
\begin{document}
\section{Some section}
bla bla bla\endnote{Some note}.
\theendnotes
\end{document}


Looking into endnotes.sty it is easy to see, that one just has to redefine the command \enoteheading. (One just has to delete on *) This just do the job.

\documentclass{article}

\usepackage{endnotes}
% Taken from endnotes.sty and changed \section*{ to \section{
\makeatletter
\@mkboth{\MakeUppercase{\notesname}}{\MakeUppercase{\notesname}}}%
\mbox{}\par\vskip-\baselineskip}
\makeatother

\begin{document}
\section{Some section}
bla bla bla\endnote{Some note}.
\endnote{Another note.} \endnote{A third note.}
\theendnotes
\end{document}

• Just a follow up, but is there a reason this wouldn't work with the book class and babel? I get multiple illegal parameter errors Aug 14 '17 at 19:24
• @LarsChristianJensen This is strange, because the solution does not work if you use the book class and the babel package together. While it works if you use only one of them. I have no clue. Consider submitting a follow up question? Aug 15 '17 at 9:23
• Yes that what struck me as will - I'll post a follow-up. Thanks. Aug 15 '17 at 12:25

An alternative is to use etoolbox:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{endnotes}
% in \enoteheading, replace \section* with \section,
% do nothing (i.e., {}) on success, do nothing on failure