3

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:

enter image description here

How can I solve that problem?

4
  • 2
    Your command is not defined for optional arguments
    – user31729
    Commented 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
    Commented 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 :-)
    – Simon
    Commented 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
    Commented Aug 6, 2014 at 8:20

1 Answer 1

5

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}

enter image description here

1

You must log in to answer this question.

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