[Tex/LaTex] Mark a place “to be done” with todonotes

macrossectioningtable of contentstodonotes

I'm trying to create a \tbd (To Be Done) macro to add a todonote on a chapter/section/subsection/etc easily with the following properties.

  • to have a useful list of todos with a simple macro call: the todolist entry should represent the place of the todo inside the structure of the document (in the chapter named "C" it should have "TBD: C", in section "S" inside "C" it should have "TBD: C/S")
  • to avoid redundancy: I don't want to type the section title as a caption parameter each and every time. What if I want to change the title?
  • to display TBD in the note only (this seems to be more elegant)
  • preferred: keep the name of the command as \section (and others) (with the use of an optional argument maybe?)
  • preferred (but seems to be unlikely): without messing with the definition of section and friends
  • preferred (but seems to be really messy): with the todonote "pointing" at the title

Note: I've considered the possibility to put \tbd inside the section command (\section{title\tbd}) for the todonote to point at the right place, but this seems to be more pain than gain. Especially if I want to use the title…

Something like this (the blue bordered things are on different pages):

enter image description here

Is there a macro/package for this or does any of you have a similar implementation?

Example is shown using a half (or less) solution. Can I list the current stack of chapter/section/etc somehow?

\documentclass{book}

\usepackage{todonotes}

\newcommand\treeloc{dummy} % this should be replaced

\newcommand\tbd{\todo{TBD}}

\begin{document}

\chapter{C-1}

\section{S-1}\tbd

\section{S-2}

\chapter{C-2}\tbd

\section{S-1}

\section{S-2}

\subsection{SS-1}\tbd

\section{S-3}

\listoftodos

\end{document}

And \treeloc should be changed for the todolist to have these instead of dummies:

  • C-1/S-1
  • C-2
  • C-2/S-2/SS-1

I'm going to work on this, but I thought this was a nice question.

References (I'm considering to use):

Best Answer

[THIS IS NOT WHAT YOU WANT, IS IT?]

This does it by parsing \thesubsection, and printing something out if the respective units are not equal to 0. The relevant routines are \getss and \gets.

\documentclass{book}
\usepackage{todonotes}
\usepackage{etoolbox}
\makeatletter
\def\getss#1.#2|{\expandafter\gets#1|\ifstrequal{#2}{0}{}{/SS-#2}}
\def\gets#1.#2|{C-#1\ifstrequal{#2}{0}{}{/S-#2}}
\newcommand\treeloc{\expandafter\getss\thesubsection|}
\makeatother
\newcommand\tbd{\todo[caption={TBD: \treeloc}]{TBD}}

\begin{document}

\chapter{C-1}

\section{S-1}\tbd

\section{S-2}

\chapter{C-2}\tbd

\section{S-1}

\section{S-2}

\subsection{SS-1}\tbd

\section{S-3}

\listoftodos

\end{document}

enter image description here