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}
  • 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 Jan 20 '17 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 Jan 20 '17 at 11:38
  • 1
    Can you please add a minimal working example that is properly showcasing the misbehaviour. – Ruben Jan 20 '17 at 11:39
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}
  • 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 Jan 20 '17 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.