# Automated lists for todos in Latex document

When I write a document in Latex I usually use my custom \todo{<my note>}-command to not forget things that I will have to come back to. Something like

\newcommand{\todo}[1]{{\color{red}\textbf{TODO:}~{#1}}}

jumps into the eye well enough.

But I would like it even better, if I had a list of all todos that are sprinkled around a document. I.e. a command like \todolist that generates a list of all my todos (optionally with page and line info). Similar to a list of figures.

Since I am not an expert in Latex, I have troubles estimating the amount of work that I would have to be put into that. I would think I need a counter ... but what else? What other Latex building blocks are needed? :-)

-

You don't mention the todo or todonotes in your question, so if you want to do this using your own command, the following might be useful. The main part comes from Gonzalo's answer to

Creating list of for \newtheoremstyle

The code starts a new toc file, \jobname.tod.

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}% just to generate text

\newcounter{todo}

\makeatletter
\newcommand\todoname{todo}
\newcommand\listtodoname{List of todos}
\newcommand\listoftodos{%
\section*{\listtodoname}\@starttoc{tod}}
\makeatother

\begin{document}

\listoftodos

\section{Main document}
\lipsum[1]\todo{fix this}

\lipsum[2]\todo{and this}

\end{document}

-
Yes, that's exactly what I had in mind! That is, until I had tried todonotes just now ... –  nils Apr 20 '12 at 14:48

The documentation of todo (page 5) says:

Command \todos prints the final list that gathers the todo text of all the todos (except todoenv environments, that simply refer to the text). Each item has a box, checkmarked when \done, the todo number, and a reference (and interactive link if hyperref is on) to the page where it appears.

The documentation of todonotes (page 2) says:

The \listoftodos command inserts a list of all the todos in the current doc- ument. \listoftodos takes no arguments. For this document the list of to–do’s looks like.

-
Ha, that easy! Thanks! –  nils Apr 20 '12 at 14:23

If you are looking for a package that already does this, I would recommend todonotes. It has a number of configuration options, and may save you some effort getting to what you want. Even if you are putting together something custom on your own, the source should be helpful in generating the lists.

-