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?

1

\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? – Kare Sep 24 '15 at 9: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.