4

I'm using the todonotes package for a large writing project. I have a system with different colored notes for different purposes, for example orange is notes for myself, while yellow is bigger ideas that my collaborators should look at.

Is there a way to disable one or more colors so they are hidden when compiling? This way I can send a version to collaborators in which "my own todos" are gone, but the big questions are still there. Something like:

\usepackage[disable=orange]{todonotes}
3
  • Welcome to TeX.SE!
    – Mensch
    Nov 5 '21 at 15:44
  • 1
    Which one do you want to hide: a subset of todos sharing a same color, or just the color and keep all the todos typeset. May be better illustrated with a complete example. Nov 5 '21 at 16:30
  • I want to hide the todos that have a specific color, while typesetting all the other colored todos as normal. Perhaps it's better to not talk about the colors, that's just the way I differentiate the todos at the moment. Perhaps it better to instead say I want to have two (or more) sets of todos that can be enabled or disabled independently.
    – Martin
    Nov 5 '21 at 21:19
4

Define two commands, one to use for notes by yourself (\NoteToMe in this example) and one to use for great ideas. Each with its own options.

When you want to send your document to your collaborators, activate the option disable in the definition of \NoteToMe

Working document: all notes are shown

a

Document to share: only with great ideas

b

Using

\newcommand{\NoteToMe}[1]{\todo[linecolor=linecolor,
    backgroundcolor=bkgcolor,
    bordercolor=bordercolor,
    textcolor=textcolor,
    disable % activate to disable <<<<<<<<<<<<<<<<<<<
]{#1}}

Complete code

\documentclass[11pt,a4paper]{report}

\usepackage[left=3.00cm, right=5.00cm, top=4.00cm, bottom=3.00cm, marginparwidth=4cm]{geometry}


\usepackage{todonotes}
\usepackage{xcolor}

%  colors to myself
\definecolor{textcolor}{RGB}{255,69,0}
\definecolor{bordercolor}{RGB}{0,0,0}
\definecolor{linecolor}{RGB}{150,0,0}
\definecolor{bkgcolor}{RGB}{254,254, 254}

% great colors for others to see
\definecolor{greattextcolor}{RGB}{10,215, 50}
\definecolor{greatbordercolor}{RGB}{100,100,100}
\definecolor{greatlinecolor}{RGB}{150,0,0}
\definecolor{greatbkgcolor}{RGB}{254,254, 254}

\newcommand{\NoteToMe}[1]{\todo[linecolor=linecolor,
    backgroundcolor=bkgcolor,
    bordercolor=bordercolor,
    textcolor=textcolor,
    %disable % activate to disable <<<<<<<<<<<<<<<<<<<
]{#1}}

\newcommand{\GreatIdea}[1]{\todo[linecolor=greattextcolor,
    backgroundcolor=greatbkgcolor,
    bordercolor=greatbordercolor,
    textcolor=greattextcolor
    ]{#1}}


\usepackage{kantlipsum} % only to dummy text

\begin{document}

\kant[1]\NoteToMe{Let us suppose that the noumena have nothing to do
with necessity, since knowledge of the Categories is a
posteriori.}

\kant[2]\GreatIdea{\textbf{GREAT!} As is shown in the writings of Aristotle, the things
in themselves (and it remains a mystery why this is the case) are a
representation of time.}

\end{document}
1
  • Both this and Marijin's solution does what I asked for, but I think this is more clean, and can be extended more easily to have other groups of todos that work independently. Thanks!
    – Martin
    Nov 5 '21 at 21:23
2

You can add a check to the handling of the color argument, as follows:

\documentclass[11pt,a4paper]{report}

\usepackage[left=3.00cm, right=5.00cm, top=4.00cm, bottom=3.00cm, marginparwidth=4cm]{geometry}
\usepackage{todonotes}
\def\discolor{green}
\makeatletter
\define@key{todonotes}{color}{%
\renewcommand{\@todonotes@currentlinecolor}{#1}%
\renewcommand{\@todonotes@currentbackgroundcolor}{#1}%
\ifthenelse{\equal{#1}{\discolor}}{\@todonotes@localdisabletrue}{}%
}
\makeatother

\usepackage{kantlipsum} % only for dummy text

\begin{document}

\kant[1]\todo[color=green]{Let us suppose that the noumena have nothing to do
with necessity, since knowledge of the Categories is a
posteriori.}

\kant[2]\todo{\textbf{GREAT!} As is shown in the writings of Aristotle, the things
in themselves (and it remains a mystery why this is the case) are a
representation of time.}

\end{document}

Now by defining the \discolor command you can choose which color is disabled.

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.