[NTG-context] doifsomething vs iffirstargument in TABLE?

Jon Wong jhannwong at gmail.com
Thu Sep 12 15:44:11 CEST 2019


Hi all,

If I use iffirstargument, the optional (first argument) is always seen as false.

If I use doifsomething, it works, but the “else” part is never executed when it should.

MWE:

\starttext

% \def\MyRow{\dosingleempty\doMyRow}
% \def\doMyRow[#1]#2#3#4#5{%
%   \bTR \bTD #2 \eTD %
%   \iffirstargument
%     \bTD Replaced! \eTD %
%   \else
%     \bTD #3 \eTD %
%   \fi
%   \bTD #4 \eTD \bTD #5 \eTD \eTR
% }

\def\MyRow{\dosingleempty\doMyRow}
\def\doMyRow[#1]#2#3#4#5{%
  \bTR \bTD #2 \eTD %
  \doifsomething{#1}
    {\bTD Replaced! \eTD }%
    {\bTD #3 \eTD }%
  \bTD #4 \eTD \bTD #5 \eTD \eTR
}

\bTABLE
\bTABLEbody
\MyRow{A}{B}{C}{D}
\MyRow[optional]{A}{B}{C}{D}
\eTABLEbody
\eTABLE

\stoptext


Regards
Jon



More information about the ntg-context mailing list