I am using the todonotes package and have three requirements, the first two which the MWE already does:
- Obtain a list of
todonotes in a separate auxiliary file. This can easily be obtained via the\listoftodosas per the similarly named question referenced below. - Have the
\todoappear in the document -- also works. - What does not yet work: I do not want the list of
todoto appear in the header of this document.
The MWE below generates (after two runs):

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
\listoftodosis commented out -- This will seem to produce the desired result, as an older.tdofile 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
todoauxillary files to obtain a single document that has all thetodonotes 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}