TransWikia.com

How does one organize each chapter's endnotes at the end of every part?

TeX - LaTeX Asked by mshaffer on May 24, 2021

Let’s say I have endnotes running with alpha structure: a, b, c, d, e, …

Normally, I can run endnotes at every chapter, and reset the counter…

documentclass{report}
usepackage{endnotes}
renewcommand*{theendnote}{alph{endnote}}
begin{document}

chapter{First}
Testing.endnote{First test.}
theendnotes

setcounter{endnote}{0}

chapter{Next}
Again.endnote{Second test.}
theendnotes

end{document}

How would I run 1+ chapters within a part and then have theendnotes print the endnotes, by chapter?

Would this require a more sophisticated counter … an array counter newcounter{endnotecounter}[chapter] ???

Maybe something like this?

documentclass{report}
usepackage{endnotes}
renewcommand*{theendnote}{alph{endnote}}
begin{document}
part{Part I}

chapter{First}
Testing.endnote{First test.}


setcounter{endnote}{0} % this needs to be cached so next chapter isn't purged

chapter{Next}
Again.endnote{Second test.}


NOTES for Part I:

theendnotesbychapterinpart

end{document}

2 Answers

This seems a fully functional implementation of your requirements.

documentclass{book}
usepackage{endnotes}
usepackage{alphalph}

renewcommand{theendnote}{alphalph{value{endnote}}}
newcommand{resetendnotes}{%
  setcounter{endnote}{0}%
  addtoendnotes{%
    parprotectaddvspace{topsep}%
    noindenttextbf{Chapter thechapter}parnobreak
    protectaddvspace{topsep}%
  }%
}
renewcommand{notesname}{Notes for part thepart}

begin{document}

part{First part}

chapter{First chapter}
resetendnotes

count255=0
loopifnumcount255<50
advancecount255 by 1
xendnote{x}
repeat

chapter{First chapter}
resetendnotes

count255=0
loopifnumcount255<50
advancecount255 by 1
yendnote{y}
repeat

clearpage
theendnotes

part{Second part}

chapter{Third chapter}
resetendnotes

count255=0
loopifnumcount255<50
advancecount255 by 1
aendnote{a}
repeat

chapter{Fourth chapter}
resetendnotes

count255=0
loopifnumcount255<50
advancecount255 by 1
bendnote{b}
repeat

clearpage
theendnotes

end{document}

Correct answer by egreg on May 24, 2021

The end notes only get purged if you use theendnotes. Note: You can include thechapter as part of theendnote, but it looks better without.

documentclass{report}
usepackage{endnotes}
renewcommand*{theendnote}{alph{endnote}}
begin{document}
part{Part I}

chapter{First}
addtoendnotes{medskipnoindenttextbf{normalsizechaptername~thechapter}parmedskip}%

Testing.endnote{First test.}

setcounter{endnote}{0}%
chapter{Next}
addtoendnotes{medskipnoindenttextbf{normalsizechaptername~thechapter}parmedskip}%

Again.endnote{Second test.}

clearpage
NOTES for Part I:
theendnotes

end{document}

Answered by John Kormylo on May 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP