1

I'm currently working on a document in which I need to indicate things to be done in a draft version, and I'd like to produce a final version where todos are hidden. The todonotes package features a disable option which is supposed to achieve this; it does remove todos defined with the \todo command, but it fails on my custom commands like this one:

\newcommand{\minortodo}[2][]{\todo[color=green, #1]{#2}}

The final PDF's output when using \minortodo[inline]{change this to that} is exactly [inline]change this to that. How do I go about telling todonotes to hide these instances as well? (note: removing inline does not solve the problem).

EDIT: the following minimal working example (thanks for the suggestion) suggests that the problem has another origin; this works as expected (i.e. minor todo's disappear too):

\documentclass{book}
\usepackage[disable]{todonotes}   
\newcommand{\minortodo}[2][]{\todo[color=magenta, #1]{#2}}
\begin{document}
    Here's some text.
    \todo[inline]{this todo goes away}
    \minortodo[inline]{this one too}
\end{document}

In my actual document, I use the book class and load the following packages, but adding them to the MWE still causes no problem. The actual source of my document is a markdown file processed with pandoc with no template of my own, so I guess I'll have to look into what pandoc inserts that yields this behaviour.

\usepackage{minitoc}\dominitoc  
\usepackage{dot2texi}           
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes,arrows}  
\usepackage{fancyvrb}           
\usepackage{tabulary}           
\usepackage{todonotes}          
\usepackage{varwidth}
3
  • This should work (not tried) \newboolean{boolhidetodonotes} \setboolean{boolhidetodonotes}{false} \ifthenelse{\boolean{boolhidetodonotes}}% {\renewcommand{\minortodo}[2][]{\relax}}%if bool=TRUE: makes \minortodo do nothing {}%else: do nothing. Change \setboolean{boolhidetodonotes}{false} into \setboolean{boolhidetodonotes}{true} to make your \minortodo notes disappear.
    – ebosi
    Commented Jan 20, 2017 at 11:38
  • On my machine it does remove also the note issued by the custom command in this very basic document: \begin{document}text \todo{to do}\par more text \minortodo{more to do}\end{document}
    – Ruben
    Commented Jan 20, 2017 at 11:38
  • 1
    Can you please add a minimal working example that is properly showcasing the misbehaviour.
    – Ruben
    Commented Jan 20, 2017 at 11:39

1 Answer 1

1

My shortcomings in using sed are to blame, not todonotes or pandoc. In case it might be useful: I thought the following command would replace \usepackage{todonotes} with \usepackage[disable]{todonotes}, but grep showed me I was wrong:

$ sed s/\\usepackage{todonotes}/\\usepackage[disable]{todonotes}/ draftdoc.tex | grep todonotes
\Sepackage[disable]{todonotes}

As a result, the \todo commands were undefined (I still don't get how they were hidden and minor todos weren't though). This produces the right results (mind the additional quotes):

$ sed 's/\\usepackage{todonotes}/\\usepackage[disable]{todonotes}/' draftdoc.tex | grep todonotes
\usepackage[disable]{todonotes}
1
  • I wonder what would have happened had you deleted the .aux file and rerun. And I'm surprised you didn't get any errors with \Sepackage... (or did you run with scrollmode?). Another fixwould have been sed s/usepackage{todonotes}/usepackage[disable]{todonotes}/ -- as you don't match on the start of the line, just ignore the `` at the beginning of the command.
    – Chris H
    Commented Jan 20, 2017 at 15:32

You must log in to answer this question.

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