[NTG-context] \definestartstop with arguments

2007-07-13 Thread Vyatcheslav Yatskovsky
Hello,

I want to convert my following code into a custom \start \stop pair.

\starttextrule{Use Case: Logging-On}\startpacked
Text
\stoppacked\stoptextrule

It seems to me that using \definestartstop[usecase][...] command is the most 
approprate, but I cannot get how to achieve different captions:

\startusecase[Logging-On]
Text...
\stopusecase

\startusecase[Reminding Password]
Text...
\stopusecase

Best,
Vaytcheslav Yatskovsky

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \definestartstop with arguments

2007-07-13 Thread Vyatcheslav Yatskovsky
Hello,

Pleeease, I need a help. 

I might formulate my previous question badly, so let me restate it.

How to handle optional arguments (one or two) with \definestartstop? More 
specifically, how to replace hard-coded Logging-On string so that I could 
write 
\startusecase[Logging-Out]
Bla-bla
\stopusecase

or even 

\startusecase[Reminding password][User should be already logged on] 
% where the last argument is completely optional and is shown on an additional 
line 
% with prerequisite mark
Bla-bla-bla
\stopusecase

My current startstop definition is 

\definestartstop[usecase][before={\starttextrule{Use Case: 
Logging-On}\startpacked\startmypar{\bf User Intentions}\mypar{\bf System 
Responsibilities}\stopmypar},
after={\stoppacked\stoptextrule}]

Best,
Vyatcheslav


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \definestartstop with arguments

2007-07-13 Thread Peter Rolf
Hi Vyatcheslav,

Vyatcheslav Yatskovsky schrieb:
 Hello,
 
 Pleeease, I need a help. 
 
 I might formulate my previous question badly, so let me restate it.
 
 How to handle optional arguments (one or two) with \definestartstop? More 
 specifically, how to replace hard-coded Logging-On string so that I could 
 write 
 \startusecase[Logging-Out]
 Bla-bla
 \stopusecase
 
 or even 
 
 \startusecase[Reminding password][User should be already logged on] 
 % where the last argument is completely optional and is shown on an 
 additional line 
 % with prerequisite mark
 Bla-bla-bla
 \stopusecase

AFAIK startstop doesn't support optional|additional arguments. But maybe
I'm wrong or there is a better fitting macro somewhere in the deep of
'the base'. I simply dunno.

Anyhow, this is what I would do in such a case

\def\startFOO{\dodoubleempty\dostartFOO}

\long\def\dostartFOO[#1][#2]#3\stopFOO{%
  \iffirstargument
[do something with #1]
  \else
[do something without #1]
  \fi
  \ifsecondargument
[do something with #2]
  \else
[do something without #2]
  \fi
  [whatever before]
  #3
  [whatever after]
}

\let\stopFOO\relax % or define the [whatever after] stuff here


This is the basic construct, the rest is parameter evaluation and some
additional whatever.


HTH, Peter


 My current startstop definition is 
 
 \definestartstop[usecase][before={\starttextrule{Use Case: 
 Logging-On}\startpacked\startmypar{\bf User Intentions}\mypar{\bf System 
 Responsibilities}\stopmypar},
 after={\stoppacked\stoptextrule}]
 
 Best,
 Vyatcheslav
 
 
 ___
 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  : https://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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___