ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* optional arguments, if(nth)argument
@ 2005-01-06 19:24 Henning Hraban Ramm
  2005-01-07  9:23 ` Taco Hoekwater
  0 siblings, 1 reply; 2+ messages in thread
From: Henning Hraban Ramm @ 2005-01-06 19:24 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: optional arguments, if(nth)argument
  2005-01-06 19:24 optional arguments, if(nth)argument Henning Hraban Ramm
@ 2005-01-07  9:23 ` Taco Hoekwater
  0 siblings, 0 replies; 2+ messages in thread
From: Taco Hoekwater @ 2005-01-07  9:23 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-07  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-06 19:24 optional arguments, if(nth)argument Henning Hraban Ramm
2005-01-07  9:23 ` Taco Hoekwater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).