ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Same counter for figures as theorems
       [not found] <1697c9e5-a649-4569-a35e-071bf1594300@Spark>
@ 2020-08-11  9:41 ` Tim Steenvoorden
  2020-08-13  8:06   ` Tim Steenvoorden
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Steenvoorden @ 2020-08-11  9:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1035 bytes --]

Hi all,

I’ve a text where chapters are numbered 1, 2, 3, … and sections 1.1, 1.2, 1.3, …
Now I’d like all elements (figures, tables, examples, definitions, theorems, …) to be numbered consecutively prefixed by the chapter and section number, so 1.1.1, 1.1.2, 1.2.1, ...

I’ve managed to change figure/table captions to do this by:

\setupcaptions[
  way=bysection,
  prefixsegments=chapter:section,
]

And I’ve setup my enumerations by:

\setupenumerations[
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]

But how do I use the same counter for figures, tables, and all enumerations?
Trying to share a counter with:

\definecounter[object][
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]
\setupenumerations[
  counter=object,
]
\setupcaptions[
  counter=object,
]

Results in enumerations numbered 1, 2, 3, ... instead of 1.1.1, 1.1.2, 1.1.3, … And figures and tables are still numbered in the default way.

Cheers,
Tim

[-- Attachment #1.2: Type: text/html, Size: 3949 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Same counter for figures as theorems
  2020-08-11  9:41 ` Same counter for figures as theorems Tim Steenvoorden
@ 2020-08-13  8:06   ` Tim Steenvoorden
  2020-08-13 11:11     ` Taco Hoekwater
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Steenvoorden @ 2020-08-13  8:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1239 bytes --]

Hi all,

Anybody some pointers?

Cheers,
Tim
On 11 Aug 2020, 11:41 +0200, Tim Steenvoorden <tim.steenvoorden@gmail.com>, wrote:
> Hi all,
>
> I’ve a text where chapters are numbered 1, 2, 3, … and sections 1.1, 1.2, 1.3, …
> Now I’d like all elements (figures, tables, examples, definitions, theorems, …) to be numbered consecutively prefixed by the chapter and section number, so 1.1.1, 1.1.2, 1.2.1, ...
>
> I’ve managed to change figure/table captions to do this by:
>
> \setupcaptions[
>   way=bysection,
>   prefixsegments=chapter:section,
> ]
>
> And I’ve setup my enumerations by:
>
> \setupenumerations[
>   way=bysection,
>   prefix=yes,
>   prefixsegments=chapter:section,
> ]
>
> But how do I use the same counter for figures, tables, and all enumerations?
> Trying to share a counter with:
>
> \definecounter[object][
>   way=bysection,
>   prefix=yes,
>   prefixsegments=chapter:section,
> ]
> \setupenumerations[
>   counter=object,
> ]
> \setupcaptions[
>   counter=object,
> ]
>
> Results in enumerations numbered 1, 2, 3, ... instead of 1.1.1, 1.1.2, 1.1.3, … And figures and tables are still numbered in the default way.
>
> Cheers,
> Tim

[-- Attachment #1.2: Type: text/html, Size: 4390 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Same counter for figures as theorems
  2020-08-13  8:06   ` Tim Steenvoorden
@ 2020-08-13 11:11     ` Taco Hoekwater
  2020-08-14  7:49       ` Tim Steenvoorden
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2020-08-13 11:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]



> On 13 Aug 2020, at 10:06, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> 
> Hi all,
> 
> Anybody some pointers?

Next time, prepare a minimal (non)working example. Because the attachment works for me.

Best wishes,
Taco

[-- Attachment #2: tryme.tex --]
[-- Type: application/octet-stream, Size: 562 bytes --]

\setupcaptions[
  way=bysection,
  prefixsegments=chapter:section,
]

\setupenumerations[
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]

\defineenumeration[enumeration][text=Enumeration]

\definecounter[object][
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]
\setupenumerations[
  counter=object,
]
\setupcaptions[
  counter=object,
]

\starttext

\dorecurse{4}{
  \chapter{Hi}
  \section{Knuth}
  \input knuth
  \enumeration
   \input zapf 
   \par
  \placefigure{This is the caption}{This is some content}
}

\stoptext

[-- Attachment #3: Type: text/plain, Size: 3 bytes --]





[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Same counter for figures as theorems
  2020-08-13 11:11     ` Taco Hoekwater
@ 2020-08-14  7:49       ` Tim Steenvoorden
  2020-08-14 21:11         ` Taco Hoekwater
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Steenvoorden @ 2020-08-14  7:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1630 bytes --]

Hi Taco,

Thanks for your example and the pointer to make a MWE.

Sadly, it doesn’t work for me. It numbers the first enumeration 1.1.1 and the first figure _also_ 1.1.1, which I’d like to be 1.1.2.

This time, you’ll find the code and the output pdf in the attachment!

Cheers,
Tim


P.S. I’m on Context MacTeX/TeXLive 2020:

mtx-context     | ConTeXt Process Management 1.03
mtx-context     |
mtx-context     | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2020.03.10 14:44
mtx-context     | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkxl
mtx-context     | current version: 2020.03.10 14:44
On 13 Aug 2020, 13:12 +0200, Taco Hoekwater <taco@elvenkind.com>, wrote:
>
>
> > On 13 Aug 2020, at 10:06, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> >
> > Hi all,
> >
> > Anybody some pointers?
>
> Next time, prepare a minimal (non)working example. Because the attachment works for me.
>
> Best wishes,
> Taco
>
>
>
>
>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 2344 bytes --]

[-- Attachment #2: test-counters.tex --]
[-- Type: application/octet-stream, Size: 593 bytes --]

\setupcaptions[
  way=bysection,
  prefixsegments=chapter:section,
]

\setupenumerations[
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]

\defineenumeration[enumeration][text=Enumeration]

\definecounter[object][
  way=bysection,
  prefix=yes,
  prefixsegments=chapter:section,
]
\setupenumerations[
  counter=object,
]
\setupcaptions[
  counter=object,
]



\starttext

\dorecurse{4}{
  \chapter{Hi}
  \section{Knuth}
  \input knuth
  \dorecurse{3}{
    \enumeration
      \input zapf
      \par
    \placefigure{This is the caption}{This is some content}
  }
}

\stoptext

[-- Attachment #3: test-counters.pdf --]
[-- Type: application/octet-stream, Size: 30432 bytes --]

[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Same counter for figures as theorems
  2020-08-14  7:49       ` Tim Steenvoorden
@ 2020-08-14 21:11         ` Taco Hoekwater
  2020-08-18  8:30           ` Tim Steenvoorden
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2020-08-14 21:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Tim,

I misunderstood your goal, sorry. Proposed setup below.


But first, what I think is a bug in ConTeXt:

Neither
  \setupcaptions
    [counter=object]
nor
  \setupcaption
    [figure]
    [counter=object]

work. the caption always falls back to the ‘current float counter’; figure or table or …

For the singular explicit \setupcaption[figure], I think this is a bug.


The solution I found is to blatantly redefine the ‘figure’ counter, that works!


Second, it seems that \setupenumerations does not modify the counter of an explicit defined enumeration, so you need to use the explicit \setupenumeration[enumeration] form. This may be intentional, I do not know for sure.



Here is what I believe is the required code for your desired effect (re-indented for Hans' style):

\setupcaptions
  [way=bysection,
   prefixsegments=chapter:section]

\setupenumerations
  [prefix=yes,
   prefixsegments=chapter:section]

\defineenumeration
  [enumeration]
  [text=Enumeration]

\definecounter
  [object]
  [way=bysection]

\setupenumeration
  [enumeration]
  [counter=object]

\definecounter
  [figure]
  [object]

Best wishes,
Taco


> On 14 Aug 2020, at 09:49, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> 
> Hi Taco,
> 
> Thanks for your example and the pointer to make a MWE.
> 
> Sadly, it doesn’t work for me. It numbers the first enumeration 1.1.1 and the first figure _also_ 1.1.1, which I’d like to be 1.1.2.
> 
> This time, you’ll find the code and the output pdf in the attachment!
> 
> Cheers,
> Tim
> 
> 
> P.S. I’m on Context MacTeX/TeXLive 2020:
> 
> mtx-context     | ConTeXt Process Management 1.03
> mtx-context     |
> mtx-context     | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkiv
> mtx-context     | current version: 2020.03.10 14:44
> mtx-context     | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkxl
> mtx-context     | current version: 2020.03.10 14:44
> On 13 Aug 2020, 13:12 +0200, Taco Hoekwater <taco@elvenkind.com>, wrote:
>> 
>> 
>>> On 13 Aug 2020, at 10:06, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
>>> 
>>> Hi all,
>>> 
>>> Anybody some pointers?
>> 
>> Next time, prepare a minimal (non)working example. Because the attachment works for me.
>> 
>> Best wishes,
>> Taco
>> 
>> 
>> 
>> 
>> 
>> ___________________________________________________________________________________
>> 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://context.aanhet.net
>> archive : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___________________________________________________________________________________
> <test-counters.tex><test-counters.pdf>___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

Taco Hoekwater
Elvenkind BV




___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Same counter for figures as theorems
  2020-08-14 21:11         ` Taco Hoekwater
@ 2020-08-18  8:30           ` Tim Steenvoorden
  0 siblings, 0 replies; 6+ messages in thread
From: Tim Steenvoorden @ 2020-08-18  8:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4937 bytes --]

Hi Taco,

Thanks! This works for me.

It indeed seems at least inconsistent. Also, using
	\definecounter[enumeration][object]
instead of
	\setupenumeration[enumeration][counter=object]
Numbers figures correctly but forgets the object counter in enumerations, it numbers 1.1., 1.1., 1.1., ...

Hans: is this indeed the intended way it should work?

Cheers,
Tim

----
T.J. Steenvoorden, MSc

PhD Candidate | Radboud University Nijmegen
Faculty of Science | Department of Software Science
Mercator 1 Building | Room 01.08
Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
+31 24 365 22 91 | tim@cs.ru.nl
On 14 Aug 2020, 23:12 +0200, Taco Hoekwater <taco@elvenkind.com>, wrote:
> Hi Tim,
>
> I misunderstood your goal, sorry. Proposed setup below.
>
>
> But first, what I think is a bug in ConTeXt:
>
> Neither
> \setupcaptions
> [counter=object]
> nor
> \setupcaption
> [figure]
> [counter=object]
>
> work. the caption always falls back to the ‘current float counter’; figure or table or …
>
> For the singular explicit \setupcaption[figure], I think this is a bug.
>
>
> The solution I found is to blatantly redefine the ‘figure’ counter, that works!
>
>
> Second, it seems that \setupenumerations does not modify the counter of an explicit defined enumeration, so you need to use the explicit \setupenumeration[enumeration] form. This may be intentional, I do not know for sure.
>
>
>
> Here is what I believe is the required code for your desired effect (re-indented for Hans' style):
>
> \setupcaptions
> [way=bysection,
> prefixsegments=chapter:section]
>
> \setupenumerations
> [prefix=yes,
> prefixsegments=chapter:section]
>
> \defineenumeration
> [enumeration]
> [text=Enumeration]
>
> \definecounter
> [object]
> [way=bysection]
>
> \setupenumeration
> [enumeration]
> [counter=object]
>
> \definecounter
> [figure]
> [object]
>
> Best wishes,
> Taco
>
>
> > On 14 Aug 2020, at 09:49, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> >
> > Hi Taco,
> >
> > Thanks for your example and the pointer to make a MWE.
> >
> > Sadly, it doesn’t work for me. It numbers the first enumeration 1.1.1 and the first figure _also_ 1.1.1, which I’d like to be 1.1.2.
> >
> > This time, you’ll find the code and the output pdf in the attachment!
> >
> > Cheers,
> > Tim
> >
> >
> > P.S. I’m on Context MacTeX/TeXLive 2020:
> >
> > mtx-context | ConTeXt Process Management 1.03
> > mtx-context |
> > mtx-context | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkiv
> > mtx-context | current version: 2020.03.10 14:44
> > mtx-context | main context file: /usr/local/texlive/2020basic/texmf-dist/tex/context/base/mkiv/context.mkxl
> > mtx-context | current version: 2020.03.10 14:44
> > On 13 Aug 2020, 13:12 +0200, Taco Hoekwater <taco@elvenkind.com>, wrote:
> > >
> > >
> > > > On 13 Aug 2020, at 10:06, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > Anybody some pointers?
> > >
> > > Next time, prepare a minimal (non)working example. Because the attachment works for me.
> > >
> > > Best wishes,
> > > Taco
> > >
> > >
> > >
> > >
> > >
> > > ___________________________________________________________________________________
> > > 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://context.aanhet.net
> > > archive : https://bitbucket.org/phg/context-mirror/commits/
> > > wiki : http://contextgarden.net
> > > ___________________________________________________________________________________
> > <test-counters.tex><test-counters.pdf>___________________________________________________________________________________
> > 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://context.aanhet.net
> > archive : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> > ___________________________________________________________________________________
>
> Taco Hoekwater
> Elvenkind BV
>
>
>
>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 6172 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2020-08-18  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1697c9e5-a649-4569-a35e-071bf1594300@Spark>
2020-08-11  9:41 ` Same counter for figures as theorems Tim Steenvoorden
2020-08-13  8:06   ` Tim Steenvoorden
2020-08-13 11:11     ` Taco Hoekwater
2020-08-14  7:49       ` Tim Steenvoorden
2020-08-14 21:11         ` Taco Hoekwater
2020-08-18  8:30           ` Tim Steenvoorden

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