0

I have problem understanding the question marks in the \if command \if?\SAP@examdate? that I encountered the following statement in the .cls of sapthesis (CTAN link):

\ifSAP@noexaminfo\relax
\else
    \if?\SAP@examdate?
      \ifcase\SAP@examinercount
        \SAP@ThesisNotDefensedLabel%
      \else
        \ClassError{sapthesis}{You have specified one or more examiners but not
        the date of the final exam}{E.g. \protect\examdate{17 July 2015}}
      \fi
    \else
      \ifcase\SAP@examinercount
        %\ClassError{sapthesis}{You have specified the final exam date but no examiner}{E.g. \protect\examiner{Prof. Giulio Cesare}}
        \SAP@ThesisDefensedLabelA\ \SAP@examdate
      \else
        \SAP@ThesisDefensedLabelA\ \SAP@examdate\\
        \SAP@ThesisDefensedLabelB:\\[2mm]
        \the\SAP@examinertoks%
      \fi
    \fi
\fi

In the main \SAP@examdate is called to set the date for the thesis discussion, like \examdate{xx/xx/2023}. Here is its definition:

\def\SAP@examdate{}
\newcommand{\examdate}[1]{\def\SAP@examdate{#1}}

Which is the meaning for the question marks around \SAP@examdate ? It seems like a negation but online I didn't found anything on the topic. Thank you for your help.

1 Answers1

1

It is testing if the macro is empty.

\if?\SAP@examdate?

If you know \SAP@examdate can never start with ? this is only true if \SAP@examdate is empty so the test is \if?? and the two ? tokens are compared

David Carlisle
  • 757,742