[NTG-context] Figure numbering with parts

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat May 17 12:40:35 CEST 2014


Am 17.05.2014 um 12:28 schrieb Pol Stra <ryzz at hotmail.fr>:

> Le samedi 17 mai 2014, 11:25:04 Wolfgang Schuster a écrit :
>> Am 17.05.2014 um 11:21 schrieb Pol Stra <ryzz at hotmail.fr>:
>>> Hello,
>>> 
>>> I want to number my figures like this:
>>> partnumber.sectionnumber.figurenumber
>>> 
>>> I didn't find documentation on \setupnumber.
>>> 
>>> I tried:
>>> 
>>> \setupnumber[figure][way=bypart, numberpart=yes]
>>> \setupnumber[figure][way=bypart, numberpart=yes, prefixsegments=part]
>>> 
>>> But when changing part, the numbering starts again at 1.
>> 
>> The counter setup for floats are controlled with the \setupcaption command.
>> 
>> When you set “way=bypart” you tell context to reset the counter with each
>> new \part heading.
>> 
>> Wolfgang
> 
> Ok, I see: "way=bypart" is related to "figurenumber". But what about the 
> "numeberpart" attribute?
> 
> Let's say I have two parts with two sections in each. Currently, with 
> "\setupnumber[figure][way=bypart, numberpart=yes]" I have:
> 
> Part 1
> 	Section 1
> 		figure 1.1
> 		figure 1.2
> 	Section 2
> 		figure 2.3
> 		figure 2.4
> Part 2
> 	Section 1
> 		figure 1.1 % here we start again at 1 instead of 2
> 		figure 1.2 % the 2 is OK, but not the 1
> 	Section 2
> 		figure 2.3
> 		figure 2.4
> 
> While I want:
> 
> Part 1
> 	Section 1
> 		figure 1.1.1
> 		figure 1.1.2
> 	Section 2
> 		figure 1.2.3
> 		figure 1.2.4
> Part 2
> 	Section 1
> 		figure 2.1.1
> 		figure 2.1.2
> 	Section 2
> 		figure 2.2.3
> 		figure 2.2.4
> 
> I think you missed an example in my previous message. ;-)

I still miss some example code.

You want to do is not possible with this structure because you go from parts to section
without a chapter between them which leaves a gap in the prefix numbers.

To fix this you have to change your sections to chapters or replace your parts with chapters.

\useMPlibrary[dum]

\setupcaption
  [figure]
  [way=bypart,
   prefixsegments=part:chapter]

\starttext

\dorecurse{2}
  {\part{Part #1}
   \dorecurse{2}
     {\chapter{Chapter ##1}
	  \dorecurse{2}
	    {\placefigure[force]{Dummy Figure ####1}{\externalfigure[dummy]}}}}

\stoptext

Wolfgang


More information about the ntg-context mailing list