I would like to make the table of contents show the author's name (if there is one) after the title for each section.

I am aware of the existence of the package titletoc and the command \titlecontents. So I would be happy having a kind of \sectionauthor variable (assigned in some way inside each section) to use within \titlecontents.

Below is a MWE which I hope gives the idea of my goal:

\documentclass{article}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{titletoc}

\titlecontents{section}
[1.85em] % i
{\smallskip}
{\contentslabel[\bfseries\textsc{\Sectionname}~\thecontentslabel]{5.5em}\textbf}
% {\thecontentslabel\enspace} %\thecontentslabel
{\hspace*{-5.5em}}
{ \emph{(section \thecontentslabel\ author)}\titlerule*[1pc]{.}\contentspage}

\begin{document}

\tableofcontents

\part{Part one}
\section{Section one}
\lipsum[1]
\section{Section two}
\lipsum[2]

\end{document}


Or maybe there is a better way to achieve this? For example, in this question, a solution for the same problem is provided for the memoir class. Unfortunately, it does not seem to work for the article class, which I am using.

• Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – Alessandro Cuttin Sep 13 at 9:46
• OK, thanks Alessandro. I will add a MWE. – suitangi Sep 13 at 17:31

In case anyone is interested, the package tocdata does exactly what I was asking for. Furthermore, it claims to to work with the toc/lof formatting of the default LATEX classes, memoir, koma-script, and with the packages titletoc, tocloft, tocbasic, and tocstyle.

Below is a MWE showing how to achieve the desired goal:

\documentclass{article}

\usepackage{titletoc}
\usepackage{tocdata}
\usepackage{lipsum}

\begin{document}

\tableofcontents
\part{Part one}
\tocdata{toc}{Homer Jay Simpson}
\section{First section}
\lipsum[1-8]
\tocdata{toc}{Marjorie Jacqueline Bouvier}
\section{Second section}
\lipsum[8-10]

\end{document}