My document is divided into preface section and numbered sections (labelled as '# [Name of Chapter]' and so on). In all of these sections there are notes, which are placed at the end of the document (section 'NOTES'). I need to divide the 'NOTES' section into subsections each of them having list of notes from the respective section. I search this site for tips and found one solution that I put into the preamble of my latex file:
\documentclass{article}
\usepackage{graphicx}
\usepackage{setspace}\doublespacing
\usepackage{endnotes}
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage{lipsum}
%--- Endnotes rules
\counterwithin{endnote}{section} % Reset endnote numbering every new part
\makeatletter
\renewcommand\enoteheading{%
\setcounter{secnumdepth}{-2}
\section{\notesname}
\addtocontents{toc}{\protect\addvspace{10pt}} % adjust to suit
\addcontentsline{toc}{section}{\notesname}
\mbox{}\par\vskip-\baselineskip
\let@afterindentfalse@afterindenttrue
}
\makeatother
\usepackage{xparse}
\let\latexsection\section
\RenewDocumentCommand{\section}{som}{%
\IfBooleanTF{#1}
{\latexsection*{#3}}
{\IfNoValueTF{#2}
{\latexsection{#3}}
{\latexsection[#2]{#3}}%
\addtoendnotes{\unexpanded{\subsection{#3}}}
}
}
%--- ...end of the Endnotes rules
\begin{document}
\let\footnote=\endnote
\pagenumbering{roman}
{\let\bfseries\mdseries \tableofcontents} \newpage
\section*{Preface}
\addcontentsline{toc}{section}{\uppercase{Preface}}
\lipsum[1-3]\footnote{foo bar baz in Preface}
\newpage
\pagenumbering{arabic}
\section{Intro & Plan}
\lipsum[1-2]\footnote{foo bar baz in Ch1}
\newpage
\section{Literature Review}
\lipsum[1-2]\footnote{foo bar baz in Ch2}
\newpage
\theendnotes
\addcontentsline{toc}{section}{\uppercase{Notes}}
\end{document}
The output pdf file produces this look of the 'Notes' section (see image below), which misses the title of 'PREFACE' section. In addition to that I need the titles of the numbered sections to contain 'CHAPTER # [Name of Chapter]'. Lastly, Table of Contents of the document must suppress the subsection ToC lines just after the ToC line of 'NOTES'.


postnotesis able to handle the splitting of unnumbered sections with little fuss. If you could edit your question to include a MWE, I could take a look. Also, you'd need to be clearer on what the intended notes headings are. As the question is currently written, there's a lot of guess work to do. – gusbrs Oct 28 '23 at 11:01postnotescurrently is not able to retrieve the section name/title for use in the notes section. I guess I'll add this eventually, but it will take some time. But I'll add anendnotesanswer to have you covered. – gusbrs Oct 29 '23 at 13:20