ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* long style of a row to put in a macro
@ 2006-04-10 10:33 olivier Turlier
  2006-04-10 12:18 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: olivier Turlier @ 2006-04-10 10:33 UTC (permalink / raw)


Hi everybody,

In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.

For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
with \bf style, etc.  : this leads to a rather long definition that I don't wish
to copy on each new letter row, so I made a little macro to recall this setup.

This system is not working yet, so i beg your help, TIA for any answer

%%%
\setupcolors[state=start]

\starttext

\def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
frame=off,align={middle,lohi}{#1}}

\bTABLE[frame=off,width=broad,split=yes]
\setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
\setupTABLE[column][2][style=\tf,align={lohi}]

\bTR  \bTD
[nc=2,background=color,backgroundcolor=Grisbleu,style=\bf,frame=off,
align={right,lohi}]
A \eTD \eTR %command=\Rowa
\bTR  \bTD abscisse \eTD \bTD	Axe horizontal d'un diagramme \eTD \eTR
\bTR  \bTD abside \eTD \bTD	Construction en forme de demi-cercle ou de polygone,
située derrière le chœur et constituant l'extrémité d'une église. \eTD \eTR
\bTR  \bTD action \eTD \bTD		Force ou déformation imposée agissant sur une
structure. \eTD \eTR
%...
\bTR  \bTD [command=\Rowa] B \eTD \eTR % NOT WORKING
\bTR  \bTD barre \eTD \bTD	Element de structure, généralement longiligne,
utilisé par exemple dans les treillis \eTD \eTR
\bTR  \bTD barre comprimée et fléchie \eTD \bTD	Element de structure soumis à
une compression excentrée.  \eTD \eTR
%...
\eTABLE

\stoptext

-- 

olivier Turlier

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

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

* Re: long style of a row to put in a macro
  2006-04-10 10:33 long style of a row to put in a macro olivier Turlier
@ 2006-04-10 12:18 ` Hans Hagen
  2006-04-10 12:47   ` Vit Zyka
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-04-10 12:18 UTC (permalink / raw)


olivier Turlier wrote:
> Hi everybody,
>
> In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.
>
> For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
> with \bf style, etc.  : this leads to a rather long definition that I don't wish
> to copy on each new letter row, so I made a little macro to recall this setup.
>
> This system is not working yet, so i beg your help, TIA for any answer
>
> %%%
> \setupcolors[state=start]
>
> \starttext
>
> \def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
> frame=off,align={middle,lohi}{#1}}
>
> \bTABLE[frame=off,width=broad,split=yes]
> \setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
> \setupTABLE[column][2][style=\tf,align={lohi}]
>   
you can say odd/even etc instead of 1,3,5 

-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------

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

* Re: long style of a row to put in a macro
  2006-04-10 12:18 ` Hans Hagen
@ 2006-04-10 12:47   ` Vit Zyka
  2006-04-11 11:45     ` olivier Turlier
  0 siblings, 1 reply; 6+ messages in thread
From: Vit Zyka @ 2006-04-10 12:47 UTC (permalink / raw)


Hans Hagen wrote:
> olivier Turlier wrote:
> 
>>Hi everybody,
>>
>>In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.
>>
>>For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
>>with \bf style, etc.  : this leads to a rather long definition that I don't wish
>>to copy on each new letter row, so I made a little macro to recall this setup.
>>
>>This system is not working yet, so i beg your help, TIA for any answer
>>
>>%%%
>>\setupcolors[state=start]
>>
>>\starttext
>>
>>\def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
>>frame=off,align={middle,lohi}{#1}}
>>
>>\bTABLE[frame=off,width=broad,split=yes]
>>\setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
>>\setupTABLE[column][2][style=\tf,align={lohi}]
>>  
> 
> you can say odd/even etc instead of 1,3,5 

Thinking about a feature request:

I very frequentely set every third (3,6,9,...) row with gray background 
to make wide tables well-arranged. I did it by a loop or with a script 
that generates data. Some 'everythird' equivalent to 'even' or 'odd' 
would be more strightforward.

Vit

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

* Re: long style of a row to put in a macro
  2006-04-10 12:47   ` Vit Zyka
@ 2006-04-11 11:45     ` olivier Turlier
  2006-04-11 13:56       ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: olivier Turlier @ 2006-04-11 11:45 UTC (permalink / raw)


On Mon, 10 Apr 2006 14:47:17 +0200, Vit Zyka wrote:

> Hans Hagen wrote:
>> olivier Turlier wrote:
>> 
>>>Hi everybody,
>>>
>>>In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.
>>>
>>>For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
>>>with \bf style, etc.  : this leads to a rather long definition that I don't wish
>>>to copy on each new letter row, so I made a little macro to recall this setup.
>>>
>>>This system is not working yet, so i beg your help, TIA for any answer
>>>
>>>%%%
>>>\setupcolors[state=start]
>>>
>>>\starttext
>>>
>>>\def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
>>>frame=off,align={middle,lohi}{#1}}
>>>
>>>\bTABLE[frame=off,width=broad,split=yes]
>>>\setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
>>>\setupTABLE[column][2][style=\tf,align={lohi}]
>>>  
>> 
>> you can say odd/even etc instead of 1,3,5 
> 
> Thinking about a feature request:
> 
> I very frequentely set every third (3,6,9,...) row with gray background 
> to make wide tables well-arranged. I did it by a loop or with a script 
> that generates data. Some 'everythird' equivalent to 'even' or 'odd' 
> would be more strightforward.
> 
> Vit

Maybe I was unclear, I just want to be able to recall a certain style for
certain rows : the position of the rows is not regular, as in my case,
it's for emphasis for each new letter (A,B,C, etc.) of glossary terms.

As this def is rather long, i just wanted to make a more readable code. So
I tried to put
[nc=2,background=color,backgroundcolor=screen,style=\bf,frame=off,align={right,lohi}]

in \def\Rowa#1{[nc=2,..]{#1}}

and call this def on new letter row by

%\bTR  \bTD [command=\Rowa] B \eTD \eTR % NOT WORKING
\bTR  \bTD[nc=2,background=color,backgroundcolor=screen,
	style=\bf,frame=off,align={right,lohi}command=\Rowa]B \eTD \eTR
\bTR  \bTD barre \eTD \bTD \'Element de structure .. \eTD \eTR 
\bTR  \bTD barre comprimée \eTD \bTD \'Eleme .. \eTD \eTR 
\bTR  \bTD [nc=2,background=color,backgroundcolor=screen,
	style=\bf,frame=off,align={right,lohi}command=\Rowa]C \eTD \eTR 
\bTR \bTD [command=\Rowa] C \eTD \eTR % NOT WORKING
\bTR  \bTD c.. \eTD \bTD ... \eTD \eTR

This is obviousluy a minor request, since i've already copied this def on
each row manually.

Thanks again

-- 
olivier Turlier

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

* Re: long style of a row to put in a macro
  2006-04-11 11:45     ` olivier Turlier
@ 2006-04-11 13:56       ` Hans Hagen
  2006-04-11 17:23         ` olivier Turlier
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-04-11 13:56 UTC (permalink / raw)


olivier Turlier wrote:
> On Mon, 10 Apr 2006 14:47:17 +0200, Vit Zyka wrote:
>
>   
>> Hans Hagen wrote:
>>     
>>> olivier Turlier wrote:
>>>
>>>       
>>>> Hi everybody,
>>>>
>>>> In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.
>>>>
>>>> For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
>>>> with \bf style, etc.  : this leads to a rather long definition that I don't wish
>>>> to copy on each new letter row, so I made a little macro to recall this setup.
>>>>
>>>> This system is not working yet, so i beg your help, TIA for any answer
>>>>
>>>> %%%
>>>> \setupcolors[state=start]
>>>>
>>>> \starttext
>>>>
>>>> \def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
>>>> frame=off,align={middle,lohi}{#1}}
>>>>
>>>> \bTABLE[frame=off,width=broad,split=yes]
>>>> \setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
>>>> \setupTABLE[column][2][style=\tf,align={lohi}]
>>>>  
>>>>         
>>> you can say odd/even etc instead of 1,3,5 
>>>       
>> Thinking about a feature request:
>>
>> I very frequentely set every third (3,6,9,...) row with gray background 
>> to make wide tables well-arranged. I did it by a loop or with a script 
>> that generates data. Some 'everythird' equivalent to 'even' or 'odd' 
>> would be more strightforward.
>>
>> Vit
>>     
>
> Maybe I was unclear, I just want to be able to recall a certain style for
> certain rows : the position of the rows is not regular, as in my case,
> it's for emphasis for each new letter (A,B,C, etc.) of glossary terms.
>
> As this def is rather long, i just wanted to make a more readable code. So
> I tried to put
> [nc=2,background=color,backgroundcolor=screen,style=\bf,frame=off,align={right,lohi}]
>
> in \def\Rowa#1{[nc=2,..]{#1}}
>
> and call this def on new letter row by
>
> %\bTR  \bTD [command=\Rowa] B \eTD \eTR % NOT WORKING
> \bTR  \bTD[nc=2,background=color,backgroundcolor=screen,
> 	style=\bf,frame=off,align={right,lohi}command=\Rowa]B \eTD \eTR
> \bTR  \bTD barre \eTD \bTD \'Element de structure .. \eTD \eTR 
> \bTR  \bTD barre comprim�e \eTD \bTD \'Eleme .. \eTD \eTR 
> \bTR  \bTD [nc=2,background=color,backgroundcolor=screen,
> 	style=\bf,frame=off,align={right,lohi}command=\Rowa]C \eTD \eTR 
> \bTR \bTD [command=\Rowa] C \eTD \eTR % NOT WORKING
> \bTR  \bTD c.. \eTD \bTD ... \eTD \eTR
>
> This is obviousluy a minor request, since i've already copied this def on
> each row manually.
>   
\starttext

\unprotect

\def\defineTABLEsetup
  {\dodoubleargument\dodefineTABLEsetup}

\def\dodefineTABLEsetup[#1][#2]%
  {\setvalue{\@@tbl:set:#1}{#2}}

\long\def\bTDs[#1]#2\eTDs
  {\doifdefinedelse{\@@tbl:set:#1}
    {\@EA\@EA\@EA\bTD\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTD}
    {\bTD[]#2\eTD}}

\long\def\bTRs[#1]#2\eTRs
  {\doifdefinedelse{\@@tbl:set:#1}
    {\@EA\@EA\@EA\bTR\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTR}
    {\bTR[]#2\eTR}}

\protect

\defineTABLEsetup [xx] [foregroundcolor=red]

\setupcolors[state=start]

\bTABLE
    \bTR      \bTD      oeps \eTD  \bTD oeps \eTD \eTR
    \bTR      \bTDs[xx] oeps \eTDs \bTD oeps \eTD \eTR
    \bTRs[xx] \bTD      oeps \eTD  \bTD oeps \eTD \eTRs
\eTABLE

\stoptext

-----------------------------------------------------------------
                                          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

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

* Re: long style of a row to put in a macro
  2006-04-11 13:56       ` Hans Hagen
@ 2006-04-11 17:23         ` olivier Turlier
  0 siblings, 0 replies; 6+ messages in thread
From: olivier Turlier @ 2006-04-11 17:23 UTC (permalink / raw)


On Tue, 11 Apr 2006 15:56:48 +0200, Hans Hagen wrote:

> olivier Turlier wrote:
>> On Mon, 10 Apr 2006 14:47:17 +0200, Vit Zyka wrote:
>>
>>   
>>> Hans Hagen wrote:
>>>     
>>>> olivier Turlier wrote:
>>>>
>>>>       
>>>>> Hi everybody,
>>>>>
>>>>> In writing a glossary of building terms (approx. 400 entries) in a natural TABLE.
>>>>>
>>>>> For each letter, A, B, C, I want a screen background, spanning on 2 colomns,
>>>>> with \bf style, etc.  : this leads to a rather long definition that I don't wish
>>>>> to copy on each new letter row, so I made a little macro to recall this setup.
>>>>>
>>>>> This system is not working yet, so i beg your help, TIA for any answer
>>>>>
>>>>> %%%
>>>>> \setupcolors[state=start]
>>>>>
>>>>> \starttext
>>>>>
>>>>> \def\Rowa#1{nc=2,background=color,backgroundcolor=screen,style=\bf,
>>>>> frame=off,align={middle,lohi}{#1}}
>>>>>
>>>>> \bTABLE[frame=off,width=broad,split=yes]
>>>>> \setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
>>>>> \setupTABLE[column][2][style=\tf,align={lohi}]
>>>>>  
>>>>>         
>>>> you can say odd/even etc instead of 1,3,5 
>>>>       
>>> Thinking about a feature request:
>>>
>>> I very frequentely set every third (3,6,9,...) row with gray background 
>>> to make wide tables well-arranged. I did it by a loop or with a script 
>>> that generates data. Some 'everythird' equivalent to 'even' or 'odd' 
>>> would be more strightforward.
>>>
>>> Vit
>>>     
>>
>> Maybe I was unclear, I just want to be able to recall a certain style for
>> certain rows : the position of the rows is not regular, as in my case,
>> it's for emphasis for each new letter (A,B,C, etc.) of glossary terms.
>>
>> As this def is rather long, i just wanted to make a more readable code. So
>> I tried to put
>> [nc=2,background=color,backgroundcolor=screen,style=\bf,frame=off,align={right,lohi}]
>>
>> in \def\Rowa#1{[nc=2,..]{#1}}
>>
>> and call this def on new letter row by
>>
>> %\bTR  \bTD [command=\Rowa] B \eTD \eTR % NOT WORKING
>> \bTR  \bTD[nc=2,background=color,backgroundcolor=screen,
>> 	style=\bf,frame=off,align={right,lohi}command=\Rowa]B \eTD \eTR
>> \bTR  \bTD barre \eTD \bTD \'Element de structure .. \eTD \eTR 
>> \bTR  \bTD barre comprim \eTD \bTD \'Eleme .. \eTD \eTR 
>> \bTR  \bTD [nc=2,background=color,backgroundcolor=screen,
>> 	style=\bf,frame=off,align={right,lohi}command=\Rowa]C \eTD \eTR 
>> \bTR \bTD [command=\Rowa] C \eTD \eTR % NOT WORKING
>> \bTR  \bTD c.. \eTD \bTD ... \eTD \eTR
>>
>> This is obviousluy a minor request, since i've already copied this def on
>> each row manually.
>>   
> \starttext
> 
> \unprotect
> 
> \def\defineTABLEsetup
>   {\dodoubleargument\dodefineTABLEsetup}
> 
> \def\dodefineTABLEsetup[#1][#2]%
>   {\setvalue{\@@tbl:set:#1}{#2}}
> 
> \long\def\bTDs[#1]#2\eTDs
>   {\doifdefinedelse{\@@tbl:set:#1}
>     {\@EA\@EA\@EA\bTD\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTD}
>     {\bTD[]#2\eTD}}
> 
> \long\def\bTRs[#1]#2\eTRs
>   {\doifdefinedelse{\@@tbl:set:#1}
>     {\@EA\@EA\@EA\bTR\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTR}
>     {\bTR[]#2\eTR}}
> 
> \protect
> 
> \defineTABLEsetup [xx] [foregroundcolor=red]
> 
> \setupcolors[state=start]
> 
> \bTABLE
>     \bTR      \bTD      oeps \eTD  \bTD oeps \eTD \eTR
>     \bTR      \bTDs[xx] oeps \eTDs \bTD oeps \eTD \eTR
>     \bTRs[xx] \bTD      oeps \eTD  \bTD oeps \eTD \eTRs
> \eTABLE
> 
> \stoptext
> 

Thanks a lot, it's working like a charm. What complex code before for
getting much more simple code after, in the tables ! It's that kind of
stuff that makes Context attractive, even for an end user like me.


\starttext

\unprotect

\def\defineTABLEsetup
  {\dodoubleargument\dodefineTABLEsetup}

\def\dodefineTABLEsetup[#1][#2]%
  {\setvalue{\@@tbl:set:#1}{#2}}

\long\def\bTDs[#1]#2\eTDs
  {\doifdefinedelse{\@@tbl:set:#1}
    {\@EA\@EA\@EA\bTD\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTD}
    {\bTD[]#2\eTD}}

\long\def\bTRs[#1]#2\eTRs
  {\doifdefinedelse{\@@tbl:set:#1}
    {\@EA\@EA\@EA\bTR\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTR}
    {\bTR[]#2\eTR}}

\protect

\defineTABLEsetup [xx] [foregroundcolor=red]

\setupcolors[state=start]

\bTABLE
    \bTR      \bTD      oeps \eTD  \bTD oeps \eTD \eTR
    \bTR      \bTDs[xx] oeps \eTDs \bTD oeps \eTD \eTR
    \bTRs[xx] \bTD      oeps \eTD  \bTD oeps \eTD \eTRs
\eTABLE

\blank[2*big]

\defineTABLEsetup
    [bb]
    [nc=2,background=color,backgroundcolor=blue,foregroundcolor=white,style=\bf,frame=off,align={right,lohi}]

\bTABLE[frame=off,width=broad,split=yes]
\setupTABLE[column][1][style=\bf,align={right,lohi},width=3cm]
\setupTABLE[column][2][style=\tf,align={lohi}]
%
\bTRs[bb] \bTD  A \eTD \eTRs
%
\bTR  \bTD abscisse \eTD \bTD	Axe horizontal d'un diagramme \eTD \eTR
\bTR  \bTD abside \eTD \bTD	Construction en forme de demi-cercle ou de polygone, située derrière le choeur et constituant l'extrémité d'une église. \eTD \eTR
\bTR  \bTD action \eTD \bTD	Force ou déformation imposée agissant sur une structure. \eTD \eTR
%
\bTRs[bb]  \bTD  B \eTD \eTRs
%
\bTR  \bTD barre \eTD \bTD \'Element de structure, généralement longiligne,utilisé par exemple dans les treillis \eTD \eTR
\bTR  \bTD barre comprimée et fléchie \eTD \bTD \'Element de structure soumis à une compression excentrée.  \eTD \eTR
\eTABLE

\stoptext

-- 
olivier Turlier

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

end of thread, other threads:[~2006-04-11 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-10 10:33 long style of a row to put in a macro olivier Turlier
2006-04-10 12:18 ` Hans Hagen
2006-04-10 12:47   ` Vit Zyka
2006-04-11 11:45     ` olivier Turlier
2006-04-11 13:56       ` Hans Hagen
2006-04-11 17:23         ` olivier Turlier

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).