* Working with conditionals
@ 2011-01-03 9:46 Cecil Westerhof
2011-01-03 9:57 ` Vianney le Clément
0 siblings, 1 reply; 5+ messages in thread
From: Cecil Westerhof @ 2011-01-03 9:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
I have the folowing function for a title:
\def\Title[#1]{
\testpage[10]
\startalignment[center]
{
\blank[2*big]
\switchtobodyfont[1.5em]
\bf\em#1
}
\blank
\stopalignment
}
What I would like is that there is an optional second parameter. When
it is there, it is used in the testpage command. Otherwise the default
value is used. How would I do this?
--
Cecil Westerhof
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Working with conditionals
2011-01-03 9:46 Working with conditionals Cecil Westerhof
@ 2011-01-03 9:57 ` Vianney le Clément
2011-01-03 10:05 ` luigi scarso
2011-01-03 11:04 ` Cecil Westerhof
0 siblings, 2 replies; 5+ messages in thread
From: Vianney le Clément @ 2011-01-03 9:57 UTC (permalink / raw)
To: mailing list for ConTeXt users
\def\Title{\dodoubleempty\doTitle}
\def\doTitle[#1][#2]{
\ifsecondargument
\testpage[#2]
\else
\testpage[10]
\fi
\startalignment[center]
{
\blank[2*big]
\switchtobodyfont[1.5em]
\bf\em#1
}
\blank
\stopalignment
}
Vianney
On Mon, Jan 3, 2011 at 10:46, Cecil Westerhof <cldwesterhof@gmail.com> wrote:
> I have the folowing function for a title:
> \def\Title[#1]{
> \testpage[10]
> \startalignment[center]
> {
> \blank[2*big]
> \switchtobodyfont[1.5em]
> \bf\em#1
> }
> \blank
> \stopalignment
> }
>
> What I would like is that there is an optional second parameter. When
> it is there, it is used in the testpage command. Otherwise the default
> value is used. How would I do this?
>
> --
> Cecil Westerhof
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Working with conditionals
2011-01-03 9:57 ` Vianney le Clément
@ 2011-01-03 10:05 ` luigi scarso
2011-01-03 10:08 ` luigi scarso
2011-01-03 11:04 ` Cecil Westerhof
1 sibling, 1 reply; 5+ messages in thread
From: luigi scarso @ 2011-01-03 10:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
2011/1/3 Vianney le Clément <vleclement@gmail.com>:
> \def\Title{\dodoubleempty\doTitle}
> \def\doTitle[#1][#2]{
> \ifsecondargument
> \testpage[#2]
> \else
> \testpage[10]
> \fi
> \startalignment[center]
> {
> \blank[2*big]
> \switchtobodyfont[1.5em]
> \bf\em#1
> }
> \blank
> \stopalignment
> }
>
> Vianney
>
> On Mon, Jan 3, 2011 at 10:46, Cecil Westerhof <cldwesterhof@gmail.com> wrote:
>> I have the folowing function for a title:
>> \def\Title[#1]{
>> \testpage[10]
>> \startalignment[center]
>> {
>> \blank[2*big]
>> \switchtobodyfont[1.5em]
>> \bf\em#1
>> }
>> \blank
>> \stopalignment
>> }
>>
>> What I would like is that there is an optional second parameter. When
>> it is there, it is used in the testpage command. Otherwise the default
>> value is used. How would I do this?
>>
>> --
>> Cecil Westerhof
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>>
>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
>> archive : http://foundry.supelec.fr/projects/contextrev/
>> wiki : http://contextgarden.net
>> ___________________________________________________________________________________
>>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
You can also use a key/value approach, which is more flexible
\unprotect
\def\Title[#1]{
\getparameters[CecWes@@][param1={default},param2={default2},
param3={default3},#1]
\testpage[10]
\startalignment[center]
{
\blank[2*big]
\switchtobodyfont[1.5em]
\bf\em\getvalue{CecWes@@param1}
}
\blank
\stopalignment
}
\protect
\starttext
....
%% param1= FOO, param2=BOO, param3=default3
%% the order is not important
\Title[param2={BOO},param1={BOO}]
.....
\stoptext
--
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Working with conditionals
2011-01-03 10:05 ` luigi scarso
@ 2011-01-03 10:08 ` luigi scarso
0 siblings, 0 replies; 5+ messages in thread
From: luigi scarso @ 2011-01-03 10:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Mon, Jan 3, 2011 at 11:05 AM, luigi scarso <luigi.scarso@gmail.com> wrote:
> You can also use a key/value approach, which is more flexible
>
> \unprotect
> \def\Title[#1]{
> \getparameters[CecWes@@][param1={default},param2={default2},
> param3={default3},#1]
> \testpage[10]
> \startalignment[center]
> {
> \blank[2*big]
> \switchtobodyfont[1.5em]
> \bf\em\getvalue{CecWes@@param1}
> }
> \blank
> \stopalignment
> }
> \protect
>
>
> \starttext
> ....
> %% param1= FOO, param2=BOO, param3=default3
> %% the order is not important
> \Title[param2={BOO},param1={BOO}]
sorry, typo ^^^
> \Title[param2={BOO},param1={FOO}]
--
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Working with conditionals
2011-01-03 9:57 ` Vianney le Clément
2011-01-03 10:05 ` luigi scarso
@ 2011-01-03 11:04 ` Cecil Westerhof
1 sibling, 0 replies; 5+ messages in thread
From: Cecil Westerhof @ 2011-01-03 11:04 UTC (permalink / raw)
To: mailing list for ConTeXt users
2011/1/3 Vianney le Clément <vleclement@gmail.com>:
> \def\Title{\dodoubleempty\doTitle}
> \def\doTitle[#1][#2]{
> \ifsecondargument
> \testpage[#2]
> \else
> \testpage[10]
> \fi
> \startalignment[center]
> {
> \blank[2*big]
> \switchtobodyfont[1.5em]
> \bf\em#1
> }
> \blank
> \stopalignment
> }
Works, thanks.
--
Cecil Westerhof
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-03 11:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 9:46 Working with conditionals Cecil Westerhof
2011-01-03 9:57 ` Vianney le Clément
2011-01-03 10:05 ` luigi scarso
2011-01-03 10:08 ` luigi scarso
2011-01-03 11:04 ` Cecil Westerhof
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).