* Repeat (*) key in TaBlE
@ 2007-06-06 22:38 Aditya Mahajan
2007-10-24 18:09 ` Aditya Mahajan
0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2007-06-06 22:38 UTC (permalink / raw)
To: Context Mailing List List
Hi,
What is the correct way of using * key with TaBlE? The following does not work
\starttext
\starttable[|*{2}l|]
\HL
\NC A \NC B \NC \NR
\HL
\stoptable
\starttable[|l|l|]
\HL
\NC A \NC B \NC \NR
\HL
\stoptable
\stoptext
Thanks,
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Repeat (*) key in TaBlE
2007-06-06 22:38 Repeat (*) key in TaBlE Aditya Mahajan
@ 2007-10-24 18:09 ` Aditya Mahajan
2007-10-25 4:47 ` Aditya Mahajan
0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2007-10-24 18:09 UTC (permalink / raw)
To: mailing list for ConTeXt users
Restarting an old thread ...
On Wed, 6 Jun 2007, Aditya Mahajan wrote:
> What is the correct way of using * key with TaBlE? The following does not work
>
> \starttext
>
> \starttable[|*{2}l|]
This should be [*{2}{l|}] but even then it does not work.
> \HL
> \NC A \NC B \NC \NR
> \HL
> \stoptable
> \starttable[|l|l|]
> \HL
> \NC A \NC B \NC \NR
> \HL
> \stoptable
>
> \stoptext
I finally found out why this is not working. \getTABLEnofcolumns does
not expand *. For example
This works fine.
\getTABLEnofcolumns{|l|l|}
\the\maxTABLEcolumn % gives 2.
This does not.
\getTABLEnofcolumns{|*{2}{l|}}
\the\maxTABLEcolumn %gives 1
\getTABLEnoofcolumns is simply counting the number of | in the format.
It should first expand the *#1#2, and then do the counting. A really
ugly workaround
\starttable[|*{2}{l|}]
% Manually set the number of columns :-(
\noalign{\global\maxTABLEcolumn=2}
\NC AA \NC 5 \NC \AR
\NC AAA \NC 6 \NC \AR
\stoptable
I do not understand TeX well enough to correct the
\get\TABLEnofcolumns macro.
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Repeat (*) key in TaBlE
2007-10-24 18:09 ` Aditya Mahajan
@ 2007-10-25 4:47 ` Aditya Mahajan
0 siblings, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2007-10-25 4:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Wed, 24 Oct 2007, Aditya Mahajan wrote:
> Restarting an old thread ...
>
> On Wed, 6 Jun 2007, Aditya Mahajan wrote:
>
>> What is the correct way of using * key with TaBlE? The following does not work
>>
>> \starttext
>>
>> \starttable[|*{2}l|]
>
> This should be [*{2}{l|}] but even then it does not work.
>
>> \HL
>> \NC A \NC B \NC \NR
>> \HL
>> \stoptable
>> \starttable[|l|l|]
>> \HL
>> \NC A \NC B \NC \NR
>> \HL
>> \stoptable
>>
>> \stoptext
>
> I finally found out why this is not working. \getTABLEnofcolumns does
> not expand *. For example
>
> This works fine.
> \getTABLEnofcolumns{|l|l|}
> \the\maxTABLEcolumn % gives 2.
>
> This does not.
> \getTABLEnofcolumns{|*{2}{l|}}
> \the\maxTABLEcolumn %gives 1
>
> \getTABLEnoofcolumns is simply counting the number of | in the format.
> It should first expand the *#1#2, and then do the counting. A really
> ugly workaround
>
> \starttable[|*{2}{l|}]
> % Manually set the number of columns :-(
> \noalign{\global\maxTABLEcolumn=2}
> \NC AA \NC 5 \NC \AR
> \NC AAA \NC 6 \NC \AR
> \stoptable
>
> I do not understand TeX well enough to correct the
> \get\TABLEnofcolumns macro.
Here is another solution. We first need a fully expandable \dorecurse
macro. I copied David Kastrup's replicate from TeX pearls
http://www-stary.gust.org.pl/pearls/2005/david-kastrup/bachotex2005-david-kastrup-pearl3.pdf
This works as expected.
\def\replicate#1#2{\ifnum#1>0 #2%
\expandafter\replicate\expandafter{\number\numexpr#1-1}{#2}\fi}
\starttable[|\replicate{2}{l|}]
\NC AA \NC 5 \NC \AR
\NC AAA \NC 6 \NC \AR
\stoptable
Questions:
1. Is there something equivalent to replicate in ConTeXt.
(\dorecuse is not expandable)? If not, should it be added?
2. Are there any plans to ensure that the * form works? I am happy
with the above solution, but I am curious from the purpose of
documentation. I am writing about some the advanced features of
\starttable. If the * version will not be supported, I can just say
that the replicate trick is the correct way to do things.
3. BTW, there are other things that do not work with \starttable. All
the keys of TaBlE that start with \ do not work (\LeftGlue,
\RightGlue, \{, \|), as they are tried to be expanded, and result in
a undefined control sequence error. One solution is to pad
each of them with \noexpand. Are there plans to work on this, or
should I just say (in the tugboat article) that the \noexpand is the
correct way to do things.
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-25 4:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-06 22:38 Repeat (*) key in TaBlE Aditya Mahajan
2007-10-24 18:09 ` Aditya Mahajan
2007-10-25 4:47 ` Aditya Mahajan
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).