optional arguments, if(nth)argument
Hello again! Today I'm trying a lot of new (to me) things... This time, a macro with optional arguments and \if...argument : \def\SkillField{\dodoubleempty\doSkillField} \def\doSkillField[#1][#2]#3{\bTR\bTD #3 \iffirstargument\hfill (#1)\fi % don't print when no optional argument \eTD \bTD \ifsecondargument % if second optional arg is provided \definefield[#2][line][Skill][#1]\field[#2] \else % if no second optional arg \definefield[#3][line][Skill][#3]\field[#3] \fi \eTD\eTR} e.g. \SkillField[+8][Aergern]{Ärgern} % works \SkillField[+1]{Labern} % does nothing instead of "else" \SkillField{Testen} % does "\hfill (#1)", but should do nothing Apparently, the \if...argument ... \else don't work as they should. Where's my mistake? Grüßlis vom Hraban! --- http://www.fiee.net/texnique/ http://contextgarden.net
Hi, There is interference with the \bTR macro. It works fine with all TABLE commands removed. The table macros like \bTR and \bTD themselves use \dodoubleempty. Greetings, Taco Henning Hraban Ramm wrote:
Hello again!
Today I'm trying a lot of new (to me) things... This time, a macro with optional arguments and \if...argument :
\def\SkillField{\dodoubleempty\doSkillField}
\def\doSkillField[#1][#2]#3{\bTR\bTD #3 \iffirstargument\hfill (#1)\fi % don't print when no optional argument \eTD \bTD \ifsecondargument % if second optional arg is provided \definefield[#2][line][Skill][#1]\field[#2] \else % if no second optional arg \definefield[#3][line][Skill][#3]\field[#3] \fi \eTD\eTR}
e.g. \SkillField[+8][Aergern]{Ärgern} % works \SkillField[+1]{Labern} % does nothing instead of "else" \SkillField{Testen} % does "\hfill (#1)", but should do nothing
Apparently, the \if...argument ... \else don't work as they should. Where's my mistake?
Grüßlis vom Hraban! --- http://www.fiee.net/texnique/ http://contextgarden.net _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
participants (2)
-
Henning Hraban Ramm
-
Taco Hoekwater