Display or hide stuff in a document

I am using comments in LaTeX, which are defined in my document as:

``````\newcommand{\notecorr}[1]{\iftoggle{comments}{\todo[color=green]{{[}COR.{]} #1}{}}\linebreak}
``````

I would like to add something like an `if-else statement` when `FALSE`, then all comments disappear from the document and if it `TRUE`, then the comments are displayed.

Any suggestions how to add this?

`\iftoggle` (from `etoolbox`) actually has the following syntax:

``````\iftoggle{<toggle>}{<true>}{<false>}
``````

It already provides an "if-else" statement. In your usage, the `<true>` clause executes

``````\todo[color=green]{{[}COR.{]} #1}{}
``````

while the `<false>` clause executes

``````\linebreak
``````

So, a proper grouping of elements within your macro should allow you to leave the `<false>` part completely blank `{}`.

• So for example my command would look like: `\iftoggle{ <true> }{ \todo[color=green]{{[}COR.{]} #1}{} }{ \linebreak }`. Is this right? Sep 24, 2015 at 9:45
• @Kare: Well, this would put `\linebreak` as the `<false>` clause still (just like before). If you want nothing to happen when `\togglefalse{comments}`, then you'd need something like `\iftoggle{comments}{\todo[color=green]{{[}COR.{]} #1}{}\linebreak}{}`.
– Werner
Sep 24, 2015 at 14:39