# LaTeX - Highlight Author of Text in Epilogue

I am currently writing a scientific paper in LaTeX with a fellow student. We use Overleaf and are still a bit inexperienced with LaTeX. Our professor wants us to create an epilogue that shows who is responsible for which chapter or section.

It would be great if you could write the name of the editor directly behind a \chapter{mychapter} or \section{mysection} and automatically create an epilogue at the end.

Now my question: Is there any library specifically for such a case? And if so, how can I use it?

• Hello and welcome ! This may help tex.stackexchange.com/questions/156862/… – BambOo Apr 10 '20 at 14:09
• This is definitely going in the right direction... But I wouldn't like to have a name after every chapter or section in the document... I'd rather have an automatic listing of all chapters or sections for the respective author at the very end of the document – CrazyEight Apr 10 '20 at 15:11

After tweaking a bit this answer by user using the tocloft package, here is what comes.

You can create two lists \listchaptersbyA and \listchapterbyB which will hold all the chapters authored by authors A and B. Call \chapterbyA or \chapterbyB after a \chapter to state that this chapter was authored by the specific author. List these chapters by calling \listofchapterbyA or \listofchaptersbyB

\documentclass{book}
\usepackage{lipsum}
\usepackage{tocloft}
\usepackage{hyperref}

\usepackage[english]{babel}

\newcommand{\listchaptersbyA}{Authored by A}
\newlistof{chaptersbyA}{cbA}{\listchaptersbyA}

\newcommand{\chapterbyA}[0]
{%
\refstepcounter{chaptersbyA}
{\protect\numberline{\thechaptersbyA}\chaptername~\thechapter}\par
}

\newcommand{\listchaptersbyB}{Authored by B}
\newlistof{chaptersbyB}{cbB}{\listchaptersbyB}

\newcommand{\chapterbyB}[0]
{%
\refstepcounter{chaptersbyB}
{\protect\numberline{\thechaptersbyB}\chaptername~\thechapter}\par
}

\begin{document}

\chapter{1st chapter}
\chapterbyA{}
\lipsum[1]

\section{A section}
\lipsum[1]

\chapter{2nd chapter}
\chapterbyA{}
\chapterbyB{}
\lipsum[1]

\section{A section}
\lipsum[1]

\chapter{3rd chapter}
\chapterbyA{}
\lipsum[1]

\newpage
\listofchaptersbyA
\listofchaptersbyB
\end{document}


• Exactly what i am looking for... but is there also a way on how to also make this possible for sections? If i add \chapterbyA to a section then also only the chapter is displayed in the toc. And maybe also possible to add the names behind chapter number? – CrazyEight Apr 10 '20 at 16:34
• @CrazyEight It is really much depending on how much effort you want to put into this, how many chapters and sections or subsections ... If you know since the beginning who will do what, you can also put everything into a table. – BambOo Apr 10 '20 at 19:02