7

I am using the todonotes package and have three requirements, the first two which the MWE already does:

  1. Obtain a list of todo notes in a separate auxiliary file. This can easily be obtained via the \listoftodos as per the similarly named question referenced below.
  2. Have the \todo appear in the document -- also works.
  3. What does not yet work: I do not want the list of todo to appear in the header of this document.

The MWE below generates (after two runs):

enter image description here

The correct result should be only the two todo notes in yellow and pink, and the .tdo file needs to be newer than the .tex file

Notes:

  • Did not automate the testing of the case where the MWE is run as is, and then upon second run the \listoftodos is commented out -- This will seem to produce the desired result, as an older .tdo file exists. However, I would prefer a solution that yields the correct result upon first compile.

Background:

  • I have numerous small files and having a list of todo in each file is not that helpful. My plan is to post process all the individual todo auxillary files to obtain a single document that has all the todo notes along with links to the files that created them.

References:

Code:

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

\begin{document} \listoftodos% Want the temporary file generated

\bigskip

\todo[inline,color=yellow,caption={Fix me}]{There should be no text above this line (as if listoftodos was commented).}

\IfFileExists{\jobname.tdo}{% % Yeah, we have the temporary file \todo[inline,color=red!20]{Temporary .todo file exist. But need to ensure that it was not left over from a previous run...} }{% \todo[inline,color=red]{Failed: No .todo file...} } \end{document}

Peter Grill
  • 223,288

1 Answers1

3

You just want \@starttoc without the file input:

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

\makeatletter
\newwrite\tf@tdo
\immediate\openout\tf@tdo\jobname.tdo\relax
\makeatother

\begin{document}    
\bigskip


\todo[inline,color=yellow,caption={Fix me}]{There should be no text above this line (as if listoftodos was commented).}


\IfFileExists{\jobname.tdo}{%
    %  Yeah, we have the temporary file
    \todo[inline,color=red!20]{Temporary .todo file exist. 
      But need to ensure that it was not left over from a previous run...}
}{%
    \todo[inline,color=red]{Failed: No .todo file...}
}
\end{document}
Peter Grill
  • 223,288
David Carlisle
  • 757,742