ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Resetcounter in custom enumeration environment
@ 2022-01-03 10:51 Jan-Erik Hägglöf via ntg-context
  2022-01-03 11:04 ` kauśika via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Jan-Erik Hägglöf via ntg-context @ 2022-01-03 10:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jan-Erik Hägglöf

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

* Re: Resetcounter in custom enumeration environment
  2022-01-03 10:51 Resetcounter in custom enumeration environment Jan-Erik Hägglöf via ntg-context
@ 2022-01-03 11:04 ` kauśika via ntg-context
  2022-01-03 11:07   ` kauśika via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: kauśika via ntg-context @ 2022-01-03 11:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users
  Cc: kauśika, Jan-Erik Hägglöf via ntg-context

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


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

* Re: Resetcounter in custom enumeration environment
  2022-01-03 11:04 ` kauśika via ntg-context
@ 2022-01-03 11:07   ` kauśika via ntg-context
  2022-01-04 16:10     ` Jan-Erik Hägglöf via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: kauśika via ntg-context @ 2022-01-03 11:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users
  Cc: kauśika, Jan-Erik Hägglöf via ntg-context

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


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

* Re: Resetcounter in custom enumeration environment
  2022-01-03 11:07   ` kauśika via ntg-context
@ 2022-01-04 16:10     ` Jan-Erik Hägglöf via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: Jan-Erik Hägglöf via ntg-context @ 2022-01-04 16:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jan-Erik Hägglöf

Many thanks, that was very structured and helpful.

/Jan-Erik

> 3 jan. 2022 kl. 12:07 skrev kauśika <citturs@gmail.com>:
> 
> 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
> 
> 

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

end of thread, other threads:[~2022-01-04 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 10:51 Resetcounter in custom enumeration environment Jan-Erik Hägglöf via ntg-context
2022-01-03 11:04 ` kauśika via ntg-context
2022-01-03 11:07   ` kauśika via ntg-context
2022-01-04 16:10     ` Jan-Erik Hägglöf via ntg-context

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