1

This is a follow-up question on todonotes: How to make multiple listoftodos?

I used the above example to categorize my todo notes (e.g. figures, administrative stuff, laboratory todos...) instead of different reviewers and it works well (using the owner as tag). But now I get trouble using the missingfigure command. I would like to show missing figures only in one category. Instead it is shown on all listoftodos. Would it be possible to add a owner attribute to missingfigure or disable missingfigures from listoftodos?

Or do you have a different idea to realize this?

\documentclass{scrbook}
\usepackage{hyperref}
\usepackage[
    textsize=footnotesize,
    colorinlistoftodos,
    color=orange!10,
    bordercolor=orange!90
    ]{todonotes}
\usepackage{etoolbox}
\usepackage{lipsum}

\presetkeys{todonotes}{inline, color=blue!15, bordercolor=blue!85, size=\scriptsize,
    figwidth=0.9\linewidth, figcolor=black!10}{}


\makeatletter
\newcommand\@todonotes@owner{default}
\define@key{todonotes}%
{owner}{\def\@todonotes@owner{#1}}

\newtoggle{ownerdefault}
\newtoggle{owneradmin}
\newtoggle{ownerfig}


\newcommand\adminTodo[1]{%
    \todo[%
    owner=admin,
    author={[Admin]},noline,caption={[Admin]: #1},color=blue!20%
    ]%
    {#1}}

\newcommand\figTodo[1]{%
    \todo[%
    owner=fig,
    author={[Fig]},noline,caption={[Fig]: #1},color=red!50!white%
    ]%
    {#1}}

\renewcommand{\@todonotes@addElementToListOfTodos}{%
    \if@todonotes@colorinlistoftodos%
    \addtocontents{tdo}
    {%
        \protect\iftoggle{owner\@todonotes@owner}
        {%
            \protect\contentsline {todo}
            {\protect\fcolorbox{\@todonotes@currentbordercolor}%
                {\@todonotes@currentbackgroundcolor}%
                {\protect\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
                \ \@todonotes@caption
            }{\thepage}{\@currentHref}%
        }{}%
    }%
    \else%
    \addtocontents{tdo}
    {%
        \protect\iftoggle{owner\@todonotes@owner}
        {%
            \protect\contentsline {todo}
            {\@todonotes@caption
            }{\thepage}{\@currentHref}%
        }{}%
    }%
    \fi}%

\makeatother

\begin{document}
    \todo{some uncategorized todo}
    \lipsum[1]
    \figTodo{This is a todo in category figure}
    \lipsum[1]
    \adminTodo{This is a todo in category administrative stuff}
    \lipsum[1]
    \missingfigure{missing figure}

    \toggletrue{owneradmin}
    \section*{Administrative ToDos}
    \InputIfFileExists{\jobname.tdo}{}

    \toggletrue{ownerfig}
    \togglefalse{owneradmin}
    \section*{Figure ToDos}
    \InputIfFileExists{\jobname.tdo}{}

    \togglefalse{ownerfig}

    \toggletrue{ownerdefault}
    \section*{ToDos}
    \InputIfFileExists{\jobname.tdo}{}

    \togglefalse{ownerdefault}

    \makeatletter \@starttoc{tdo}\makeatother % to trigger the creation of the list

\end{document}
3
  • 2
    Can you provide a MWE (minimal working example)? Jun 25, 2018 at 16:54
  • In this case: a starting point for the people here that want to help you. It should include a \documentclass, \begin{document} and \end{document}. This way we can just copy/paste the code and go straight into solving the problem without resorting to wild guesses about what you really are asking. Jun 25, 2018 at 16:56
  • Thanks for your reply. I updated my question. Hope this is ok. The example shows the missing figure in all todolists. It would be nice to get it listed only in one section (or none of them).
    – user165711
    Jun 25, 2018 at 20:29

1 Answer 1

0

For anyone having the same problem, I now did it by redefining missingfigure, since I found no clean solution.

\renewcommand\missingfigure[2][width=1\textwidth, height=5cm]{
    \begin{figure}
        \includegraphics[#1]{example-image}
        \figTodo{#2}
    \end{figure}
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .