# How to conditionally format in LaTeX?

I am interested in formatting the following code such that if a conditional is met (Add = 0 and Del = 0), then my document prints out "There are no additions or deletions". Otherwise, the document prints out a bulleted list with the values of Add and Del.

AddName = 0
DelName = 0
cat("\\newcommand{\\Delete}{",DelName,"}",sep="")

\if <\Add = 0 AND \Del = 0>
<\normal{There are no additions or deletions.}>
\fi

\begin{compactitem}
\item[$\bullet$ \Add { } {\color{OliveGreen}\bf{+}}:]
\item[$\bullet$ \Del { } {\color{red}\bf{-}}:]
\end{compactitem}


I could not find too much documentation online, and here are the error messages I get:

> \if <\Add = 0 AND \Del = 0>
Error: unexpected input in "\"
>   <\normal{There are no additions or deletions.}>
Error: unexpected '<' in "  <"
> \fi
Error: unexpected input in "\"

> \begin{compactitem}
Error: unexpected input in "\"
> \item[$\bullet$ \Add { } {\color{OliveGreen}\bf{+}}:]
Error: unexpected input in "\"
> \item[$\bullet$ \Del { } {\color{red}\bf{-}}:]
Error: unexpected input in "\"
> \end{compactitem}
Error: unexpected input in "\"


• Maybe you should have a look at the ifthen package and booleans in LaTeX. It is easy to setup \ifthenelse{\boolean{add}\AND\boolean{del}}{}{}. – TeXnician Jun 30 '17 at 12:30
• Btw: < and > should only be used in math mode or something \ifnum like. – TeXnician Jun 30 '17 at 12:31