Resetcounter in custom enumeration environment
![](https://secure.gravatar.com/avatar/3a901cfc04dc94f9e6f29e33c2f80be1.jpg?s=120&d=mm&r=g)
Hi! I’ve been doing this in my exams to define exercises in a structural way. \defineenumeration[uppgift] \setupenumerations[uppgift][alternative=left,width=1cm,text= ,after={\blank[2*big]}] \starttext \startuppgift Here comes the exercise \stopuppgift \stoptext I want a simple solution to reset the counter so it achieves the following result: Exercises 1 First exercise 2 Second exercise Answers to exercises 1 Answers to first exercise 2 Answers to second exercise I hope that is clear enough to describe what I want to achieve Many thanks in advance Yours Sincerely Jan-Erik
![](https://secure.gravatar.com/avatar/b04967b5f7eb23e9f63b1357c7e8b3cb.jpg?s=120&d=mm&r=g)
On Monday, January 3, 2022 4:21:27 PM IST Jan-Erik Hägglöf via ntg-context wrote:
I want a simple solution to reset the counter so it achieves the following result:
Exercises
1 First exercise
2 Second exercise
Answers to exercises
1 Answers to first exercise
2 Answers to second exercise
After all, one can do \resetcounter[uppgift] before 'Answers to exercises'. If 'Exercises' and 'Answers to exercises' are some head structure (assuming unnumbered since they are so in your example): \definehead[exercises][subject] \definehead[answers][subject] then you can simply do \setupenumeration[uppgift] [alternative=left, width=1cm, text=, after={\blank[2*big]}, way=bysubject] and ConTeXt will automatically restart the number at every new subject block. Best, kauśika
![](https://secure.gravatar.com/avatar/b04967b5f7eb23e9f63b1357c7e8b3cb.jpg?s=120&d=mm&r=g)
On Monday, January 3, 2022 4:34:50 PM IST kauśika wrote:
If 'Exercises' and 'Answers to exercises' are some head structure (assuming unnumbered since they are so in your example): \definehead[exercises][subject] \definehead[answers][subject] then you can simply do \setupenumeration[uppgift] [alternative=left, width=1cm, text=, after={\blank[2*big]}, way=bysubject] and ConTeXt will automatically restart the number at every new subject block.
In this case you would have something like : \startexercise[title={Exercises}] \startuppgift first exercise \stopuppgift \startuppgift second exercise \stopuppgift \stopexercise \startanswers \startuppgift answer to first exercise \stopuppgift \startuppgift answer to second exercise \stopuppgift \stopanswers kauśika
![](https://secure.gravatar.com/avatar/3a901cfc04dc94f9e6f29e33c2f80be1.jpg?s=120&d=mm&r=g)
Many thanks, that was very structured and helpful. /Jan-Erik
3 jan. 2022 kl. 12:07 skrev kauśika
: On Monday, January 3, 2022 4:34:50 PM IST kauśika wrote:
If 'Exercises' and 'Answers to exercises' are some head structure (assuming unnumbered since they are so in your example): \definehead[exercises][subject] \definehead[answers][subject] then you can simply do \setupenumeration[uppgift] [alternative=left, width=1cm, text=, after={\blank[2*big]}, way=bysubject] and ConTeXt will automatically restart the number at every new subject block.
In this case you would have something like :
\startexercise[title={Exercises}] \startuppgift first exercise \stopuppgift
\startuppgift second exercise \stopuppgift \stopexercise
\startanswers \startuppgift answer to first exercise \stopuppgift
\startuppgift answer to second exercise \stopuppgift \stopanswers
kauśika
participants (2)
-
Jan-Erik Hägglöf
-
kauśika