# How to Define New Todo Command Which Still Takes Options

I am using the package todonotes in order to handle my TODOs. As written in the manual, one can define a custom TODO command like that:

\newcommand{\feedbackRequired}[1]{\todo[color=red!70]{#1}}


This works in general if one uses it without any options:

\feedbackRequired{Do I have to do that, supervisor?}


But unfortunately, it is not possible to use the new command and give it some extra options like that:

\feedbackRequired[inline]{Do I have to do that, supervisor?}


This will break the output. The tex file will still be compiled, but the TODO note output in the PDF is broken:

How can I solve that problem?

• Your command is not defined for optional arguments
– user31729
Aug 6, 2014 at 8:10
• Please add a MWE in order to see which packages etc. you use otherwise. Consider a retag to macros, as the problem is not directly to todonotes but rather to the usage of macros and optional parameters
– user31729
Aug 6, 2014 at 8:15
• I will next time. This time I already thought that this will be an easy pick for people who really understand LaTeX :-) Aug 6, 2014 at 8:18
• Yes, I can understand that, but guessing around about packages, documentclass... it's tedious. I have to admit, however, that the principial issue of your requestion is not related to a particular class/package
– user31729
Aug 6, 2014 at 8:20

For an optional argument, you must use

\newcommand{\feedbackRequired}[2][]{\todo[color=red!70,#1]{#2}}


The second [] holds the optional argument, in this case it is predefined to be empty, but later on, in your example, it will be inline. Your actual note is contained in the 2nd argument.

\documentclass{scrartcl}

\usepackage{todonotes}%
\usepackage{xcolor}%

\newcommand{\feedbackRequired}[2][]{\todo[color=red!70,#1]{#2}}

\begin{document}

\feedbackRequired{Do I have to do that, supervisor?}

\feedbackRequired[inline]{Do I have to do that, supervisor?}

\end{document}


• Aug 6, 2014 at 8:16