1

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?

Werner
  • 603,163
Carol.Kar
  • 591

1 Answers1

2

\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 {}.

Werner
  • 603,163
  • So for example my command would look like: \iftoggle{ <true> }{ \todo[color=green]{{[}COR.{]} #1}{} }{ \linebreak }. Is this right? – Carol.Kar Sep 24 '15 at 09:45
  • 1
    @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 '15 at 14:39