[Tex/LaTex] \if@ statement explanation

conditionalsmacros

I'm trying to tweak some .cls to fit my needs, and I'd really appreciate it if someone could explain me these statements:

\if@radseminar%
...
\else
...
\fi

If I understand correctly, it will match @radseminartrue, right? How can I use OR statement? For example, I tried

\if{@radtehnicka% or @radseminar%}

but it didn't match either.

Best Answer

There is no macro \if@ … the macro you’re seeing is called \if@radseminar (yes, the @ and all that follows is part of the macro name).

TeX doesn’t know boolean evaluation. You cannot just join several conditions together like in other programming languages. You need to test the conditions separately by nesting them:

\if@radseminar
  <true>
\else
  \if@radtehnicka
    <true>
  \fi
  <else>
\fi

However, there are LaTeX packages to allow this, e.g. etoolbox or ifthen (the latter shouldn’t be used any more I’ve been told).

Using etoolbox, it should look approximately like this:

\ifboolexpr{bool {@radseminar} or bool {@radtehnicka}}{<true>}{<false>}
Related Question