enotez-cum-appendices-and-starred-chapters

enotez is a LaTeX package that produces endnotes, and works well, and can group said endnotes by chapters—except if the chapters are either starred (i.e. numberless), or appendices. This is how I solve workaround that problem.    #latex #enotez #starred #appendix #chapters

enotez is a  package used to create endnotes, i.e., instead of notes that are shown at the bottom of the page (so-called footnotes), these are shown at the end of the document (usually just before references). It works well, but out-of-the-box, it will just dump and group all of the notes into a single section or chapter (depending on the document type), named by default “Notes.” This happens to be annoying to me, when the documents in question have chapters: I would much rather have the notes grouped by chapter.

Now enotez does provide a feature to solve this, but the notes for, say the first chapter, are grouped under the heading “Chapter 1”, and so on—which is more than a bit lame. I wanted said heading to display the chapter’s title (in addition to its number). The internet came to the rescue, and I found a solution that got me what I wanted—except it introduced a new problem: it didn’t work if the document had any starred chapters (\chapter*{title}). I duly solved that problem too, only to—you’ve guessed it—stumble on another issue: due to the internal mechanics of enotez, if the document had any appendices, then the title shown for appendix A would that of chapter 1, for appendix B that of chapter 2, and so on. As you can probably guess from the fact that I am writing this, I fixed this too—which means that by now I have a rather large story to tell.

That story, in all its gory detail, is told here. An example PDF document with this solution applied is here. This is based on my report template class, and thus, the main setup of enotez is not done on the main file (report.tex), but rather on file inputs/enotez.tex. The full code is here—though if you want to compile it, please do take a look at the previous link about the report template class.

November 2022.