This is specific for classicthesis
. Add the following code to the preamble
\usepackage{xpatch}
\xapptocmd{\Chap}{%
\addtocontents{tdo}{%
\vskip\bigskipamount\noindent\textbf{Chapter \thechapter}\par\nobreak\vskip\medskipamount}}{}{}
If you really need a more complicated approach, printing the line only if there are notes, then here it is:
\usepackage{xpatch}
\xapptocmd{\Chap}{\addtocontents{tdo}{\protect\todoline{\thechapter}}}{}{}
\makeatletter
\newcommand{\todoline}[1]{\@ifnextchar\Endoftdo{}{\@todoline{#1}}}
\newcommand{\@todoline}[1]{%
\@ifnextchar\todoline
{}
{\vskip\bigskipamount\noindent\textbf{Chapter #1}\par\nobreak\vskip\medskipamount}}
\makeatother
\newcommand{\Endoftdo}{}
\AtEndDocument{\addtocontents{tdo}{\string\Endoftdo}}
But why doing something so complicated when the Todo List is only for working copies?
Here is a complete example, where the todo notes in the Todo List are typeset in the same way as sections in the table of contents:
\documentclass{scrreprt}
\usepackage{classicthesis}
\usepackage{todonotes}
\usepackage{tocloft}
\usepackage{lipsum}
\hypersetup{colorlinks=true,linktocpage=true}
\usepackage{xpatch}
\xapptocmd{\Chap}{\addtocontents{tdo}{\protect\todoline{\thechapter}}}{}{}
\makeatletter
\newcommand{\todoline}[1]{\@ifnextchar\Endoftdo{}{\@todoline{#1}}}
\newcommand{\@todoline}[1]{%
\@ifnextchar\todoline
{}
{\vskip\bigskipamount\noindent\spacedlowsmallcaps{Chapter #1}\par\nobreak\vskip\medskipamount}}
\let\l@todo\l@section
\makeatother
\newcommand{\Endoftdo}{}
\AtEndDocument{\addtocontents{tdo}{\string\Endoftdo}}
\begin{document}
\tableofcontents
\listoftodos
\chapter{My first chapter}
\lipsum[1]
\todo{Chapter 1 note}
\section{A first section}
\lipsum[1]
\todo{Chapter 1, section 1 note}
\section{Another section}
\lipsum[1]
\todo{Chapter 1, section 2 note}
\chapter{My second chapter}
\section{A first section}
\lipsum[1]
\todo{Chapter 2, section 1 note}
\section{Another section}
\lipsum[1]
\todo{Chapter 2, section 2 note}
\end{document}
In case you want the chapter title in the Todo List, a slightly different approach should be used. Change the code from \usepackage{xpatch}
up to the \AtEndDocument
line with the following
\usepackage{regexpatch}
\xapptocmd{\Chap}{\addtocontents{tdo}{\protect\todoline{\thechapter}{\spacedlowsmallcaps{#1}}{\thepage}}}{}{}
\makeatletter
\newcommand{\todoline}[1]{\@ifnextchar\Endoftdo{}{\@todoline{#1}}}
\newcommand{\@todoline}[3]{%
\@ifnextchar\todoline
{}
{\contentsline{chapter}{\numberline{#1}#2}{#3}{}{}}%
}
\let\l@todo\l@section
\makeatother
\newcommand{\Endoftdo}{}
\AtEndDocument{\addtocontents{tdo}{\string\Endoftdo}}
It may be possible to make the chapter page number into a link. Be happy with this version. :)
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}
\usepackage[linktocpage]{hyperref} % for links
\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.
Best Answer
todonotes
usestikz
nodes for its contents, andnode
contents can not be broken across pages.Hence to put large amount of text with a frame and coloured background,
todonotes
is not a good choice. Better usetcolorbox
. Here is an example as requested.