9

I use the todonotes package to keep track of stuff that has to be done by various persons. At the moment, I use prefixes and colors to track who is responsible for what. However, I'd rather like to have separate lists for all of the people involved. I haven't found an option of the todonotes package that I could use to achieve this - is it possible at all, with this or another package?

EDIT: I just need to single out one "owner" of to-do items. It would be acceptable to have the items written to a separate file that could then be processed to produce a separate output document. Is there a solution for something like this?

MWE:

\documentclass{article}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{lipsum}

\newcommand{\alicetodo}[1]{\todo[color=green!40]{Alice: #1}}
\newcommand{\bobtodo}[1]{\todo[color=blue!40]{Bob: #1}}

\begin{document}
\lipsum[1]
\alicetodo{Foo}
\lipsum[2]
\bobtodo{Bar}
\lipsum[3]
\alicetodo{Baz}
\lipsum[4]
\bobtodo{Boo}
\listoftodos
\end{document}
  • Adding the option [colorinlistoftodos] to the package add small colored squares to the list of todos, so it is easier to find the mixed comments for one person in a single list. – Fran Oct 23 '13 at 18:35
  • @Fran: My bad, I already have that in my document - adapted the MWE. This is not the solution I'm looking for, though - I need separate lists. – vwegert Oct 24 '13 at 7:13
  • Unfortunately, add owner information (as \todo[owner={Fabrice}]{Stuff} is still in the to-do list of the package, that would be the first step to make partial lists. – Fran Oct 24 '13 at 9:06
7

To address this, I took my answer at Robust way to mark draft text?, and generalized it for multiple TODO lists. To make this work, the user must declare in advance the recipients of TODO items, in this manner:

\addTODOpointer{Steven}{blue} 
\addTODOpointer{Peter}{red} 
\addTODOpointer{Paul}{cyan!80} 

The color is that which will be used to identify that person's items. Then, in the course of the document, the user can issue a macro like

\TODO{Steven}{blah blah...}%

This will make a shorthand notation at that point in the text in the proper color, beginning with "A" for the first item, "B" for the next and so forth. At the conclusion of the document, the TODO list contents can be recalled, on a recipient-by-recipient basis, using, for example

\clearpage
\showTODOs{Steven}
\showTODOs{Peter}
\showTODOs{Paul}

The result is shown in the MWE below. The TODOs make use of the macros \markabove and \markbelow, which may be used separately, outside of the TODO setting. These two macros take a color as an optional argument, a horizontal alignment as the first mandatory argument, and the notation itself as the second argument.

\documentclass{article}
\textheight=4.5in
\usepackage{xcolor}
\usepackage{stackengine}
\setstackgap{L}{.5\baselineskip}
\newcommand\markabove[3][orange]{{\sffamily\color{#1}\hsmash{$\uparrow$}%
  \smash{\toplap{#2}{\scriptsize\bfseries#3}}}}
\newcommand\markbelow[3][orange]{{\sffamily\color{#1}\hsmash{$\downarrow$}%
  \smash{\bottomlap{#2}{\scriptsize\bfseries#3}}}}
\usepackage{ifthen}
\newcounter{TODOpointers}
\newcommand\addTODOpointer[2]{%
  \stepcounter{TODOpointers}%
  \newcounter{todoindex\romannumeral\theTODOpointers}%
  \setcounter{todoindex\romannumeral\theTODOpointers}{0}%
  \expandafter\gdef\csname TODOname\romannumeral\theTODOpointers\endcsname{%
    #1}%
  \expandafter\gdef\csname TODOcolor\romannumeral\theTODOpointers\endcsname{%
    #2}%
  \edef\tmp{\theTODOpointers}%
  \expandafter\edef\csname #1TODO\endcsname{\tmp}%
}
\newcommand\TODO[2]{%
  \edef\thenameindex{\csname #1TODO\endcsname}%
  \stepcounter{todoindex\romannumeral\thenameindex}%
  \def\thetmp{\csname thetodoindex\romannumeral\thenameindex\endcsname}%
  \expandafter\gdef%
    \csname todo.\thenameindex.\romannumeral\thetmp\endcsname{#2}%
  \markabove[\csname TODOcolor\romannumeral\thenameindex\endcsname]%
    {c}{\Alph{todoindex\romannumeral\thenameindex}}%
}
\newcounter{index}
\newcommand\showTODOs[1]{%
  \edef\thenameindex{\csname #1TODO\endcsname}%
  \def\thetmp{\csname thetodoindex\romannumeral\thenameindex\endcsname}%
  \vspace{5ex}\noindent%
  \rule{10ex}{.5ex}\textcolor{%
    \csname TODOcolor\romannumeral\thenameindex\endcsname}%
    {\csname TODOname\romannumeral\thenameindex\endcsname's %
    TO-DO LIST}\rule{10ex}{.5ex}\par\noindent%
  \setcounter{index}{0}%
  \whiledo{\value{index} < \value{todoindex\romannumeral\thenameindex}}{%
    \addtocounter{index}{1}%
    \markabove[\csname TODOcolor\romannumeral\thenameindex\endcsname]{c}%
       {\Alph{index}} %
       \csname todo.\thenameindex.\romannumeral\theindex\endcsname\\%
  }\par%
}

\addTODOpointer{Steven}{blue} 
\addTODOpointer{Peter}{red} 
\addTODOpointer{Paul}{cyan!80} 
\begin{document}

When writing documents\footnote{Note,
  \TODO{Peter}{This note is intended for you}%
this is a copy of the OP's
  \markbelow{c}{That is the name for the questioner}%
text}, I like to 'mark up'
\markabove{c}{Does anybody know what he means by this?}%
draft/partial text (e.g., short summaries
  \TODO{Steven}{I am using the TODO macro for longer notes that 
  do not fit into a single line, or are otherwise inconvenient 
  to make short}%
of what will go in a section) so that I can clearly
  \TODO{Paul}{is it really the case that you can clearly see it?}%
see what needs to be 
adjusted. I know that things like the todonotes package exist
  \TODO{Paul}{I would like to learn more about this package.
  Please fill me in}%
(see this question, for example), but I want something
\markbelow{r}{, anything actually,}%
that can span arbitrary parts of the document (e.g., multiple 
paragraphs or even sections with whatever text is in there).

I have been using the color package's \verb|\color| 'switch'
  \TODO{Steven}{I presume you actually meant that you are using 
  the \textsf{xcolor} package, since it improves upon the 
  functionality of the former package.}%
to do this (with an alternate \verb|\textcolor| based 
command for short inline bits of text), with commands like this:

\begin{verbatim}
\usepackage[usenames,dvips]{color}
\newcommand{\TODOo}[1]{\textcolor{Purple}{#1}}    
\newcommand{\startToDo}{\color{Purple}}
\newcommand{\stopToDo}{\color{Black}}
\end{verbatim}

However, this has problems in various situations (such as 
footnotes, URLs, tables),
  \TODO{Peter}{Exactly what kind of problems is he referring 
  to here?  I'd like a write up in the morning.}%
some dependent on the particular 
other packages used. (See this question and this one.)%
  \markabove{r}{I'm sorry, but the links didn't show}%

Does anyone have any ideas on a robust alternative I could 
use? I would prefer not to use marginal lines (as used to 
indicate changes) so that it is clear exactly which bits of 
text, figures, etc. are included. Differently-coloured
  \markbelow{l}{and lapped, I think}%
text was the obvious choice for me.

There's a chance that my outstanding question will get an 
answer that 'fixes' my explicit \verb|\color| usage (though 
I imagine with lots of very arcane low-level TeX) but 
obviously a pre-existing package or simple LaTeX that 
achieves the same or similar effect would be better.
  \TODO{Peter}{I'm sorry, but I made an unauthorized draft
  on your funds today.}~
  \TODO{Paul}{You paycheck is ready for pick-up}%

\clearpage
\showTODOs{Steven}
\showTODOs{Peter}
\showTODOs{Paul}
\end{document}

enter image description here

enter image description here

| improve this answer | |
  • 3
    Here it is 1.5 years after giving my answer, and no one has yet seemed to notice that my answer "robs from Peter to pay Paul." Do I have to be this obvious? – Steven B. Segletes Aug 6 '15 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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