I have a command like
\newcommand{\todo}[1]{#1}
which I sometimes replace by:
\newcommand{\todo}[1]{}
In terms of spacing/whitespace, the behavior of the "empty" command is as follows:
Test.
\todo{foo} % does not generate (vertical) whitespace => good
Test\todo{foo}. Test. % does not generate (horizontal) whitespace => good
Test\todo{foo}. \todo{foo} Test. % _does_ generate (horizontal) whitespace => bad
Is there any way to avoid this, i.e., to (temporarily) replace a command in a way so that it is fully equivalent to removing all occurrences of the command?
(I know that there are packages like todonotes or verbatim, which provide similar functionality. But I always wanted to know how to solve this manually, and never had an idea how to approach this / what to search for. Using \xspace
or \empty
in the command did not work at least.)