todonotes problem with amsbook class

I'm trying to use todonotes with amsbook documentclass. I can add a todo (using \todo{fix this}) to part of the text and I can generate a Todo list for the table of contents using \todototoc, but the compilation has some problems.

From looking at the todonotes documentation I have seen that the package has a known conflict with amsart and a fix is supplied in the documentation. The fix doesn't quite work for amsbook and I don't know enough about what it's doing to edit it.

The problems are that whilst compiling the LaTeX I get the warning that \todototoc is an undefined control sequence. Ignoring the warning and continuing the compilation, I see that the \todo I have created is not put on the same page as the heading for the list.

A smallish working example follows.

\documentclass[a4paper,10pt]{amsbook}

\usepackage{todonotes}

\begin{document}

\title{A sample book in amsbook style}
\author{me}
\maketitle

\tableofcontents

% \listoftodos   This is the usual command for making a list of to dos

% The following was taken from the todonotes documentation on how to resolve a problem with the amsart class.
% It doesn't quite work for amsbook as the list entries are put on the page after the "Todo list" heading.

\makeatletter
\providecommand\@dotsep{5}
\makeatother
\listoftodos\relax

\chapter{The test chapter}
Some text\todo{really need some more text!}

\end{document}


Does anyone have any ideas? Thanks.

-

The problem is that amsbook defines \@starttoc with two arguments (I don't think it was a wise decision). So you have to redefine \listoftodos to pass correctly what \@starttoc wants:

\documentclass[a4paper,10pt]{amsbook}

\usepackage{todonotes}

\makeatletter
\providecommand\@dotsep{5}
\renewcommand{\listoftodos}[1][\@todonotes@todolistname]{%
\@starttoc{tdo}{#1}}
\makeatother

\begin{document}

\title{A sample book in amsbook style}
\author{me}
\maketitle

\tableofcontents

\listoftodos

\chapter{The test chapter}
Some text\todo{really need some more text!}

\end{document}


\todototoc is not needed as amsbook takes care of it.

-