Wolfgang Schuster wrote:
> On Tue, 6 Feb 2007 10:36:42 -0500 (EST)
> Aditya Mahajan <[EMAIL PROTECTED]> wrote:
>
>   
>> On Tue, 6 Feb 2007, Hans Hagen wrote:
>>
>>     
>>> Aditya Mahajan wrote:
>>>       
>>>>> Can someone suggest a better way to do this?
>>>>>
>>>>>           
>>>> I found another way, I hope that it has no gotcha's
>>>>
>>>>         
>>> search for group(ed)(empty|argument) in cont-sys.tex
>>>       
>> Did you mean syst-gen.tex? I tied dodoublegroupempty but it did not 
>> work in one case (see previous post) and I can not figure out why.
>>
>> Aditya
>>     
>
> Hi Aditya,
>
> I tried something similiar and copied a example from core-rul.tex
>
> The following macro use a method copied from textrule and the second
> argument between the braces should be optional. I looked into the log
> file created with tracingmacros and it seems TeX cannot find the
> optional argument.
>
> \long\def\startDEBITS#1\stopDEBITS
>   {\bgroup
>    \def\debit{\dosingleempty\dodebit}%
>    \def\dodebit[##1]%
>      {\def\dododebit####1{\dodododebit[##1]{####1}}%
>       \dosinglegroupempty\dododebit}%
>    \def\dodododebit[##1]##2%
>      {\hbox to\hsize{\strut##1\hfill##2}}%
>    \vbox{\hsize4cm\hrule#1\hrule}%
>    \egroup}
>
> \starttext
>
> %\tracingmacros1
> \startDEBITS
> \debit [Text] {100} ttt
> \debit [Text] {200} xxx
> \stopDEBITS
> %\tracingmacros0
>
> \stoptext
>
> Hans, can you give us a hint what we are doing wrong or can you make a
> simple example to show us how we can create optional arguments between
> braces.
>   
\long\def\startDEBITS#1\stopDEBITS
  {\vbox \bgroup
   \hsize4cm
   \def\debit
     {\dosingleempty\dodebit}
   \def\dodebit[##1]%
     {\def\dododebit{\dodododebit[##1]}%
      \permitspacesbetweengroups
      \dosinglegroupempty\dododebit}
   \def\dodododebit[##1]##2%
     {\dontleavehmode\hbox to\hsize{\strut##1\hfill##2}}
   \hrule#1\hrule
   \egroup}

\starttext

\startDEBITS
\debit [Text]{100} ttt
\debit [Text] {200} xxx
\stopDEBITS

the magic is in \permitspacesbetweengroups

i suppose some \par needs to be added someplace 
-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to