Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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? :-)

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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.

enter image description here

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

\newcounter{todo}
\newcommand\todo[1]{\refstepcounter{todo}\marginpar{\color{red}{#1}}\addcontentsline{tod}{subsection}{#1~\thetodo}}%


\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}
share|improve this answer
    
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
add comment

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.

share|improve this answer
    
Ha, that easy! Thanks! –  Nils Apr 20 '12 at 14:23
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.