todonotes icon indicating copy to clipboard operation
todonotes copied to clipboard

[RFE] a todo list organized by chapter/section could be useful

Open atrent opened this issue 7 years ago • 3 comments

(but I don't know the implementation complexity)

atrent avatar Jul 10 '18 12:07 atrent

I agree !

antonfrancois avatar Oct 30 '22 13:10 antonfrancois

I found an easy workaround simply by putting \thesection command in a wrapper like so : \newcommand{\todome}[1]{\todo[color=SpringGreen]{$\bullet$ \thesection: #1}}

antonfrancois avatar Oct 31 '22 08:10 antonfrancois

You might want to do something like this.

\documentclass{article}
\usepackage{todonotes}
\usepackage{xparse}

\makeatletter
\let\original@section=\section
\RenewDocumentCommand\section{s O{} m}{%
  \IfBooleanTF{#1}{%
    \original@section*{#3}%
  }{%
    \original@section{#3}%
    \addcontentsline{tdo}{section}{\thesection{} #3}
  }
}
\makeatother

\begin{document}
\section{A}
\todo{First todo}
\section{C}
\section{B}
\todo{Second todo}

\vfill
\listoftodos
\end{document}

I tried to use the latex hook mechanism, as shown below, but it repeated the section entries in the listoftodos.

\makeatletter
\AddToHook{cmd/section/before}{\addcontentsline{tdo}{section}{section}}
\makeatother

henrikmidtiby avatar Oct 31 '22 09:10 henrikmidtiby