ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Counters again
@ 2012-01-17 14:55 Felix Ingram
  2012-01-17 18:10 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Ingram @ 2012-01-17 14:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello all,

I'm now trying to use counters that will tally some values. The value
of these could be zero, which the wiki states will be the default
value. The following shows that nothing is displayed when the counter
is 0.

\definenumber[examplecounter]
\setnumber[examplecounter]{1}
\starttext
This is the default value: \getnumber[examplecounter]
\incrementnumber[examplecounter]
This is the new value: \getnumber[examplecounter]
\resetnumber[examplecounter]
This is the reset value: \getnumber[examplecounter]
\setnumber[examplecounter]{0}
This is the set value: \getnumber[examplecounter]
\stoptext

I can include some conditionals to check this but thought I'd report
it in case I'm doing it wrong/the wiki needs updating.

Many thanks,

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


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

* Re: Counters again
  2012-01-17 14:55 Counters again Felix Ingram
@ 2012-01-17 18:10 ` Wolfgang Schuster
  2012-01-18 13:08   ` Felix Ingram
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2012-01-17 18:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.01.2012 um 15:55 schrieb Felix Ingram:

> Hello all,
> 
> I'm now trying to use counters that will tally some values. The value
> of these could be zero, which the wiki states will be the default
> value. The following shows that nothing is displayed when the counter
> is 0.
> 
> \definenumber[examplecounter]
> \setnumber[examplecounter]{1}
> \starttext
> This is the default value: \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> This is the new value: \getnumber[examplecounter]
> \resetnumber[examplecounter]
> This is the reset value: \getnumber[examplecounter]
> \setnumber[examplecounter]{0}
> This is the set value: \getnumber[examplecounter]
> \stoptext
> 
> I can include some conditionals to check this but thought I'd report
> it in case I'm doing it wrong/the wiki needs updating.

The wiki explains often the behavior for MkII but MkIV does sometimes things different
but when you need only the value of the counter without chapter or section prefixes
you can use \rawnumber which shows also the start value.

BTW: In the next beta the syntax for \setnumber will change, now both arguments are
written in brackets, e.g. \setnumber[mycount][4]

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


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

* Re: Counters again
  2012-01-17 18:10 ` Wolfgang Schuster
@ 2012-01-18 13:08   ` Felix Ingram
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Ingram @ 2012-01-18 13:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 17 January 2012 18:10, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 17.01.2012 um 15:55 schrieb Felix Ingram:
>
>>
>> I'm now trying to use counters that will tally some values. The value
>> of these could be zero, which the wiki states will be the default
>> value. The following shows that nothing is displayed when the counter
>> is 0.
>>
>> \definenumber[examplecounter]
>> \setnumber[examplecounter]{1}
>> \starttext
>> This is the default value: \getnumber[examplecounter]
>> \incrementnumber[examplecounter]
>> This is the new value: \getnumber[examplecounter]
>> \resetnumber[examplecounter]
>> This is the reset value: \getnumber[examplecounter]
>> \setnumber[examplecounter]{0}
>> This is the set value: \getnumber[examplecounter]
>> \stoptext
>>
>> I can include some conditionals to check this but thought I'd report
>> it in case I'm doing it wrong/the wiki needs updating.
>
> The wiki explains often the behavior for MkII but MkIV does sometimes things different
> but when you need only the value of the counter without chapter or section prefixes
> you can use \rawnumber which shows also the start value.
>
> BTW: In the next beta the syntax for \setnumber will change, now both arguments are
> written in brackets, e.g. \setnumber[mycount][4]

Thanks Wolfgang - \rawnumber works as expected.

I think that my approach is flawed, however. I'm letting users set a
userstructurevariable that I'm tying to counters in order to produce
a(nother) summary table. The problem is that the table is at the start
of the document and so the counters will all be at their initial
value. I'll need to find a way to save the counters over compile runs
or to delay the building of the summary table until after the rest of
the document is done.

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


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

end of thread, other threads:[~2012-01-18 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17 14:55 Counters again Felix Ingram
2012-01-17 18:10 ` Wolfgang Schuster
2012-01-18 13:08   ` Felix Ingram

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