# Generate a ToC from left to right: author, page number, title

This is the kind of layout that might occur in a compilation, front page of a journal, magazine, or a book with each author having a separate entry or article.

I'm trying to generate a table of contents with sequence author, page number, title on one line (more lines if the title is really long). The toc would look like this (no dashes):

author ----- page# ------ article title

Jane doe --- 11 --------- Spectral wavelength defoliation from planet x

(author might possibly have firstname lastname as separate fields)

I cobbled together a non-working sample based on a solution that has the page number on the left, followed by article title with author below the title (by F.Mittelbach). Starting from that solution, I've been unsccessful with generating the layout (author, page, title). In addition, I can't access the author or institution name (i.e. use it in the text if I wanted to).

I've tried many variations of the basic code'', but still no success. I hope someone can suggest what I'm missing or not understaning -- would be very helpful. A mwe is included.

\documentclass{book}
\usepackage{titletoc}
\newcommand\tocauthor[1]{\\\textmd{#1}}
\newcommand\tocinstitution[1]{}
\newcommand\newpaper[3]{%
\clearpage
\chapter*{#1}%
\textbf{#2}\\
\textit{#3}\par
\vspace{5mm}%
}
% FM's code works: page#,title\\ author -- but not quite what I want
%\titlecontents{chapter}[3pc]  % type, left indent
%   {}  % numbered entry format
%   {{\hspace*{-3pc}\makebox[3pc]   % numberless entry format
%       {\thecontentspage. \hfil}}}
%   {}  % page format

% one of the many variations tried, compiles, but incorrect display
\titlecontents{chapter}[0pt]% type,left indent
{} % numberless entry format
{} % page format
%   [ ]% below code
\setcounter{tocdepth}{0}

\begin{document}
\tableofcontents

\newpaper{Title of the first paper}{Jane Doe}{Institution}
The author is \tocauthor from nsf.

\newpaper{The second paper}{Fred Smith}{Round Yonder}
Ever been to \tocinstitution by the bay?
\end{document}


Below I've created a ToC-like \tableofauthors from scratch without any packages:

\documentclass{book}
\makeatletter
\newcommand{\l@author}[2]{%
\begin{tabular}[t]{@{}
p{.25\linewidth}
p{3em}
p{\dimexpr.75\linewidth-3em-4\tabcolsep}@{}}
\expandafter\@secondofthree#1 & % Author
\makebox[3em]{#2} & % Page
\expandafter\@firstofthree#1 % Title
\end{tabular}\par}
\newcommand{\tableofauthors}{% Very similar to \tableofcontents
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{List of papers
\@mkboth{%
\MakeUppercase{List of papers}}{\MakeUppercase{List of papers}}}%
{\setlength{\parindent}{0pt}\@starttoc{aut}}%
\if@restonecol\twocolumn\fi
}
\newcommand{\@firstofthree}[3]{#1}
\newcommand{\@secondofthree}[3]{#2}
\makeatother
\providecommand{\tocauthor}{}
\providecommand{\authorinstitution}{}

\newcommand{\printtocauthor}{\textmd}
\newcommand{\printinstitution}{\textit}

\newcommand{\newpaper}[3]{% \newpaper{<title>}{<name>}{<institution>}
\clearpage
\chapter*{#1}%
\renewcommand{\tocauthor}{#2}\printtocauthor{#2} \par
\renewcommand{\authorinstitution}{#3}\printinstitution{#3}\par
\vspace{5mm}%
}
\AtBeginDocument{%
\protect\makebox[.25\linewidth][l]{\textbf{Author}}\hfill%
\protect\makebox[3em]{\textbf{Page}}\hfill%
\protect\makebox[\dimexpr.75\linewidth-3em-4\tabcolsep][l]{\textbf{Title}}%
\par\medskip}}

\begin{document}
\tableofauthors

\newpaper{Title of the first paper}{Jane Doe}{Institution}
The author is \tocauthor{} from somewhere.

\newpaper{The second paper}{Fred Smith}{Round Yonder}
Ever been to \authorinstitution{} by the bay?

\newpaper{This is a very long paper title so it must be extremely interesting}{Who Cares}{Randomville}
This is another \tocauthor{} release from \authorinstitution.
\end{document}


It can be expanded to accommodate a first/last name provision for the author, if needed.

• Werner Great solution from scratch! Is there an option to remove the table labels? I've tried variations, including removing the table. Instead, I 'broke' something. – zun Apr 1 '14 at 20:47
• @zun: What do you mean by "table labels"...the Author Page Titles part? If so, just remove the entire \AtBeginDocument command. If not, then provide some more detail. – Werner Apr 1 '14 at 20:49
• Got it. For some reason it was the one thing I didn't try. – zun Apr 3 '14 at 4:04
• Werner: Is there any way to replace the "list of papers" text with the chapter title and tocauthor, so that they appear in the headers? – zun Apr 10 '14 at 7:28
• @zun: I don't fully understand your request? – Werner May 3 '14 at 5:57