As I use the package todonotes, I need to mark todo notes as done. Henrik, the author of the package, has this feature on the list of Things to improve. However, it has not been implemented yet.
I came up with a kind of "dirty" solution that works for me: I am only learning LaTeX now, so I built it around the idea in this thread as best as I could.
MWE compiled:
MWE code:
\documentclass[10pt]{article}
\usepackage{hyperref}
\usepackage[normalem]{ulem}
% If-else statement for todo notes
\newif\ifshowtodos
% Show existing ToDo notes in this project?
% 'Show' - Uncomment line below; 'Hide' - Comment out
\showtodostrue
\ifshowtodos
\usepackage[colorinlistoftodos,prependcaption]{todonotes}
\else
\usepackage[disable, colorinlistoftodos,prependcaption]{todonotes}
\fi
% Mark \todo notes as done by adding a strikethrough, grey color, and
% place such todos in the list "Todo resolved"
\usepackage{newfloat}% for listof
\makeatletter
% If option 'disable' is activated, define empty commands
\if@todonotes@disabled%
\newcommand{\listofdonetodos}[1][]{}
\newcommand{\tododone}[1]{}
\else
% Otherwise, define proper commands \todonote and listofdonetodos
\DeclareFloatingEnvironment[fileext=tdod,listname={Todo resolved}]{donetodo}
\newcommand{\tododone}[1]{\todo[inline,nolist,color=gray!20,textcolor=gray!70,bordercolor=gray!60]{\sout{#1}}\addcontentsline{tdod}{donetodo}{\sout{#1}}}
\fi % \if@todonotes@disabled
\makeatother
\begin{document}
\listoftodos
{\let\clearpage\relax \listofdonetodos}
\section{Introduction}
\todo[inline]{Add text}
Some text.
\tododone{Added section title}
\end{document}
For now, the things I do not like myself:
- In Todo resolved, left of the text "Added section title" - the colored box should be preserved (not sure how to do it)
- LaTeX code in general does not seem to look neat/elegant
Please review my solution and provide your feedback. Are there ways to improve/refine it?
Once all the feedback is collected, Henrik agreed to take a look at the solution and maybe add it to the package documentation.
Since, I am sure, a lot of LaTeX users, like me, are looking forward to having this feature introduced, why not make a collective contribution to this great package together!
