ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Numbers in Tables
@ 2008-01-29 19:12 Bart Wise
  2008-01-30 12:41 ` Peter Rolf
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Wise @ 2008-01-29 19:12 UTC (permalink / raw)
  To: ntg-context

The code below defines a number and then on each row, displays then increments 
the number.  The number is defined and reset to 0 before the table is 
declared.  However, when the number is displayed in the table, it's not zero 
as expected, but some other number (usually between 3 and 9).  The reset at 
reset point #1 does reset the number to 0, but it doesn't stay that way when 
the table is declared.  The only thing I have found to work, is to define a 
row and column and put the reset there (see reset point #2).  

I would like to declare and reset the number outside of the table definition, 
but it doesn't seem to work.  What am I doing wrong?


\definenumber[MyNum]

\starttext
\resetnumber[MyNum]      % reset point #1
\bTABLE
%  \bTR\bTD \resetnumber[MyNum] \eTD\eTR      % reset point #2
  \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
  \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
  \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
  \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
\eTABLE
\stoptext
___________________________________________________________________________________
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: Numbers in Tables
  2008-01-29 19:12 Numbers in Tables Bart Wise
@ 2008-01-30 12:41 ` Peter Rolf
  2008-01-30 14:33   ` Bart C. Wise
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Rolf @ 2008-01-30 12:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Bart Wise schrieb:
> The code below defines a number and then on each row, displays then increments 
> the number.  The number is defined and reset to 0 before the table is 
> declared.  However, when the number is displayed in the table, it's not zero 
> as expected, but some other number (usually between 3 and 9).  The reset at 
> reset point #1 does reset the number to 0, but it doesn't stay that way when 
> the table is declared.  The only thing I have found to work, is to define a 
> row and column and put the reset there (see reset point #2).  
> 
> I would like to declare and reset the number outside of the table definition, 
> but it doesn't seem to work.  What am I doing wrong?
> 
the table is passed several times to get the size maxima, etc.
your number is also incremented in every pass (how many passes?). ;)

use something like this to take care of trial typesetting:


\definenumber[MyNum]

\def\IncrTABLEnum[#1]%
   {\iftrialtypesetting
       \hbox{00}% allocate some space in the first pass
     \else
       \getnumber[#1]\incrementnumber[#1]%
     \fi}

\starttext

\resetnumber[MyNum]      % reset point #1
\bTABLE
%  \bTR\bTD \resetnumber[MyNum] \eTD\eTR      % reset point #2
   \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
   \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
   \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
   \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
\eTABLE

\stoptext


best, peter


> 
> \definenumber[MyNum]
> 
> \starttext
> \resetnumber[MyNum]      % reset point #1
> \bTABLE
> %  \bTR\bTD \resetnumber[MyNum] \eTD\eTR      % reset point #2
>   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
>   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
>   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
>   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
> \eTABLE
> \stoptext
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________


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

* Re: Numbers in Tables
  2008-01-30 12:41 ` Peter Rolf
@ 2008-01-30 14:33   ` Bart C. Wise
  0 siblings, 0 replies; 3+ messages in thread
From: Bart C. Wise @ 2008-01-30 14:33 UTC (permalink / raw)
  To: ntg-context

Peter,

Thanks for you input.  It works great and it would have take me forever to 
figure that one out!

Thanks,
Bart

On Wednesday January 30 2008, Peter Rolf wrote:
> Bart Wise schrieb:
> > The code below defines a number and then on each row, displays then
> > increments the number.  The number is defined and reset to 0 before the
> > table is declared.  However, when the number is displayed in the table,
> > it's not zero as expected, but some other number (usually between 3 and
> > 9).  The reset at reset point #1 does reset the number to 0, but it
> > doesn't stay that way when the table is declared.  The only thing I have
> > found to work, is to define a row and column and put the reset there (see
> > reset point #2).
> >
> > I would like to declare and reset the number outside of the table
> > definition, but it doesn't seem to work.  What am I doing wrong?
>
> the table is passed several times to get the size maxima, etc.
> your number is also incremented in every pass (how many passes?). ;)
>
> use something like this to take care of trial typesetting:
>
>
> \definenumber[MyNum]
>
> \def\IncrTABLEnum[#1]%
>    {\iftrialtypesetting
>        \hbox{00}% allocate some space in the first pass
>      \else
>        \getnumber[#1]\incrementnumber[#1]%
>      \fi}
>
> \starttext
>
> \resetnumber[MyNum]      % reset point #1
> \bTABLE
> %  \bTR\bTD \resetnumber[MyNum] \eTD\eTR      % reset point #2
>    \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
>    \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
>    \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
>    \bTR\bTD \IncrTABLEnum[MyNum] \eTD\eTR
> \eTABLE
>
> \stoptext
>
>
> best, peter
>
> > \definenumber[MyNum]
> >
> > \starttext
> > \resetnumber[MyNum]      % reset point #1
> > \bTABLE
> > %  \bTR\bTD \resetnumber[MyNum] \eTD\eTR      % reset point #2
> >   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
> >   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
> >   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
> >   \bTR\bTD \getnumber[MyNum]\incrementnumber[MyNum] \eTD\eTR
> > \eTABLE
> > \stoptext
> > _________________________________________________________________________
> >__________ 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
> ___________________________________________________________________________
>________


___________________________________________________________________________________
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:[~2008-01-30 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-29 19:12 Numbers in Tables Bart Wise
2008-01-30 12:41 ` Peter Rolf
2008-01-30 14:33   ` Bart C. Wise

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