# Problems Customizing TOC in amsbook style

I am attempting to create a table of contents (in the amsbook document class) with a specific format; however, after several attempts I can't seem to get it to work out. The document will include several articles written by different authors (much like a typical Proceedings of Such-and-Such Conference book) The format I would like to see is:

Chapter Title A .................................................... Page #
Author
Long Chapter Title that wraps around
to the next line .................................................... Page #
Author

The "author " lines should be indented some - I don't know how to indent on this forum..

etc. The important points are that I need \chapter*{}, so that there are no chapter numbers, the page numbers should be aligned with each chapter title, with no additional page number on the "author" line, and the wrapped text for the long chapter title lines up with the beginning of title on the above line (every attempt I've made thus far indents the wrapped text, as if there are chapter numbers preceeding it- I dont want that).

Sorry if this is trivially easy, but I'm not terribly experienced with customizing the table of contents, and I can't seem to get it to work at all.

-
Can you provide a small example that has some \chapter*s together with a ToC? That will help seeing the scope more clearly. See how to create a minimal working example (MWE). –  Werner Mar 8 '13 at 4:27

Here's one possibility: I suppressed the undesired indentation for the entries, and I defined a command \atotoc with a mandatory argument (the name of the author) to add the author information:

\documentclass{amsbook}

\AtBeginDocument{%
\makeatletter
\expandafter\renewcommand\csname r@tocindent0\endcsname{0pt}
\makeatother
}

\begin{document}

\tableofcontents
\chapter*{Test Chapter One}
\atotoc{Author One}
\chapter*{Test Chapter Two with a Long Title that will Span Two Lines in the Table of Contents}
\atotoc{Author Two}

\end{document}


An image of the resulting ToC:

If dots between text and page number are required for the entries, some additional work needs to be done:

\documentclass{amsbook}

\makeatletter
\newcommand\@dotsep{4.5}
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\rightskip\@pnumwidth plus1em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima{#6}\nobreak
\leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak
\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\makeatother
\AtBeginDocument{%
\makeatletter
\expandafter\renewcommand\csname r@tocindent0\endcsname{0pt}
\makeatother
}

\begin{document}

\tableofcontents
\chapter*{Test Chapter One}
\atotoc{Author One}
\chapter*{Test Chapter Two with a Long Title that will Span Two Lines in the Table of Contents}
\atotoc{Author Two}

\end{document}


-
you might want to add dots from text to page number. in the definition of \@tocline in amsbook.cls, there's an \hfil. that would be replaced by \leaders as in the definition of \@dottedtocline in latex.ltx; some adjustment might be necessary to adjust the amount of space set aside for the page numbers. –  barbara beeton Mar 8 '13 at 16:11
@barbarabeeton Yes, I thought about this too, but I am not sure if the OP wants the dots; the drawing in the question suggests that he wants them, but then there's no mention of dots in the description. Anyway, in some time I'll add the code to produce the dotted leaders. –  Gonzalo Medina Mar 8 '13 at 18:05
@barbarabeeton option with dots added. –  Gonzalo Medina Mar 8 '13 at 19:35

since you're using amsbook, and it appears that (some of) your chapters have individual authors, you may be able to benefit from the package amsbooka. this is included in tex live (in the same area as amsbook.cls`). there's no documentation with the package, but instructions can be found on line, in the ams author faq. (the link will pull up multiple questions; the one you want is enclosed in a red rectangle.)

the package styles the chapter headings as well as the entries in the toc.

like the suggestion by Gonzalo, the toc entries do not include dots, but as he pointed out in a comment, it's not entirely clear that they're required.

-