ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug? Counters inherit chapter number
@ 2012-01-16 14:43 Felix Ingram
  2012-01-16 14:52 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Ingram @ 2012-01-16 14:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

This works as expected* (empty section title with "5 6 7 8" on the next line

\definenumber[examplecounter]
\setnumber[examplecounter]{5}
\starttext
\startsection
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\stopsection
\stoptext

This does not:

\definenumber[examplecounter]
\setnumber[examplecounter]{5}
\starttext
\startchapter
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\getnumber[examplecounter]
\incrementnumber[examplecounter]
\stopchapter
\stoptext

The second example has an empty chapter heading followed by "1. 1.1 1.2 1.3".

This is on version: 2011.11.29. Apologies if this is has been
addressed - I'm holding off updating until I've worked out some more
features in my doc.

Felix

* As expected by me
___________________________________________________________________________________
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] 2+ messages in thread

* Re: Bug? Counters inherit chapter number
  2012-01-16 14:43 Bug? Counters inherit chapter number Felix Ingram
@ 2012-01-16 14:52 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2012-01-16 14:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 16.01.2012 um 15:43 schrieb Felix Ingram:

> Hi all,
> 
> This works as expected* (empty section title with "5 6 7 8" on the next line
> 
> \definenumber[examplecounter]
> \setnumber[examplecounter]{5}
> \starttext
> \startsection
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \stopsection
> \stoptext
> 
> This does not:
> 
> \definenumber[examplecounter]
> \setnumber[examplecounter]{5}
> \starttext
> \startchapter
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \getnumber[examplecounter]
> \incrementnumber[examplecounter]
> \stopchapter
> \stoptext
> 
> The second example has an empty chapter heading followed by "1. 1.1 1.2 1.3".
> 
> This is on version: 2011.11.29. Apologies if this is has been
> addressed - I'm holding off updating until I've worked out some more
> features in my doc.

By default the counter is reset with each new chapter, since you have chapters
in your first example the counter is incremented but in your second example
\startchapter sets the counter back to zero.

To have a counter which isn’t reset you need “way=bytext" and to remove
the chapter number from the \getnumber result you have to add “prefix=no”.

The full \definenumber declaration is then \definenumber[examplecounter][way=bytext,prefix=no]

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] 2+ messages in thread

end of thread, other threads:[~2012-01-16 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16 14:43 Bug? Counters inherit chapter number Felix Ingram
2012-01-16 14:52 ` Wolfgang Schuster

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