ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Issue with Custom Conversion Code in Latest Version of ConTeXt
       [not found] <c162a633-8188-4fdb-bce9-2304c4823943@Spark>
@ 2024-10-06 15:44 ` Jorge Manuel
  2024-10-07 19:51   ` [NTG-context] " Wolfgang Schuster
  2024-10-07 21:16   ` Wolfgang Schuster
  0 siblings, 2 replies; 10+ messages in thread
From: Jorge Manuel @ 2024-10-06 15:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Dear ConTeXt Support Team,

I hope this message finds you well.
In the latest version of ConTeXt, the following piece of code no longer works as expected. I use it to define a custom legal numbering format for itemized lists:

\def\legalconversion#1{
 \dorecurse{\numexpr\currentitemlevel-1}{%
 \namedstructurecounter{itemgroup}{\currentparentitemgroup}{\recurselevel}.}%
 #1%
}

\defineconversion[legal][\legalconversion]

Could you kindly advise on how to modify or fix this code to be compatible with the current version of ConTeXt?
Thank you very much for your assistance and support!
Best regards,

Jorge

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-06 15:44 ` [NTG-context] Issue with Custom Conversion Code in Latest Version of ConTeXt Jorge Manuel
@ 2024-10-07 19:51   ` Wolfgang Schuster
  2024-10-07 21:16   ` Wolfgang Schuster
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2024-10-07 19:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jorge Manuel


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

Jorge Manuel schrieb am 06.10.2024 um 17:44:
> Dear ConTeXt Support Team,
>
> I hope this message finds you well.
> In the latest version of ConTeXt, the following piece of code no 
> longer works as expected. I use it to define a custom legal numbering 
> format for itemized lists:
>
> \def\legalconversion#1{
>  \dorecurse{\numexpr\currentitemlevel-1}{%
>  \namedstructurecounter{itemgroup}{\currentparentitemgroup}{\recurselevel}.}%
>  #1%
> }
>
> \defineconversion[legal][\legalconversion]
>
> Could you kindly advise on how to modify or fix this code to be 
> compatible with the current version of ConTeXt?
> Thank you very much for your assistance and support

Can you show a complete (non) working example.

Wolfgang


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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-06 15:44 ` [NTG-context] Issue with Custom Conversion Code in Latest Version of ConTeXt Jorge Manuel
  2024-10-07 19:51   ` [NTG-context] " Wolfgang Schuster
@ 2024-10-07 21:16   ` Wolfgang Schuster
  2024-10-11 11:41     ` desdechaves
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2024-10-07 21:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jorge Manuel

Jorge Manuel schrieb am 06.10.2024 um 17:44:
> Dear ConTeXt Support Team,
> 
> I hope this message finds you well.
> In the latest version of ConTeXt, the following piece of code no longer 
> works as expected. I use it to define a custom legal numbering format 
> for itemized lists:
> 
> \def\legalconversion#1{
>   \dorecurse{\numexpr\currentitemlevel-1}{%
>   \namedstructurecounter{itemgroup}{\currentparentitemgroup}{\recurselevel}.}%
>   #1%
> }
> 
> \defineconversion[legal][\legalconversion]
> 
> Could you kindly advise on how to modify or fix this code to be 
> compatible with the current version of ConTeXt?


Do you want this kind of numbering for itemize?

\starttext

\startitemize[n,repeat][stopper=,width=\widthofstring{0},distance=.5em]
   \item 1
   \startitemize[n,repeat][stopper=,width=\widthofstring{0.0},distance=.5em]
     \item 1.1
     \startitemize[n][stopper=,width=\widthofstring{0.0.0},distance=.5em]
       \item 1.1.1
     \stopitemize
   \stopitemize
\stopitemize

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-07 21:16   ` Wolfgang Schuster
@ 2024-10-11 11:41     ` desdechaves
  2024-10-11 17:15       ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: desdechaves @ 2024-10-11 11:41 UTC (permalink / raw)
  To: ntg-context

Yes, that's exactly what I'm looking for. However, regarding multiple-choice questions, I would like the options to appear simply as A) rather than 1.1.1.A). Additionally, Is it possible to display each digit of the item numbering in boxes, similar to the style used in Pearson exams? Example: |1|.|1|." 
Like this:  https://filestore.aqa.org.uk/sample-papers-and-mark-schemes/2023/june/AQA-74051-QP-JUN23.PDF

Have a nice day

Thanks in advance.

Jorge
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-11 11:41     ` desdechaves
@ 2024-10-11 17:15       ` Wolfgang Schuster
  2024-10-12  9:40         ` Jorge Manuel
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2024-10-11 17:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, desdechaves

desdechaves@gmail.com schrieb am 11.10.2024 um 13:41:
> Yes, that's exactly what I'm looking for. However, regarding multiple-choice questions, I would like the options to appear simply as A) rather than 1.1.1.A).

Don't use the "repeat" option when you don't want repeated counter values.

> Additionally, Is it possible to display each digit of the item numbering in boxes, similar to the style used in Pearson exams? Example: |1|.|1|."

This requires a custom number conversion, the following example works 
only for single digits only.

%%%% begin example
\define[1]\BoxedNumber
   {\inframed[width=3ex]{\convertnumber{n}{#1}}}

\defineconversion [BoxedNumber] [\BoxedNumber]

\starttext

\startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
   \item xxx
   \startitemize[BoxedNumber,fit][stopper=,distance=\spaceamount]
     \item xxx
   \stopitemize
\stopitemize

\stoptext
%%%% end example

> Like this:  https://filestore.aqa.org.uk/sample-papers-and-mark-schemes/2023/june/AQA-74051-QP-JUN23.PDF

For question blocks like here you want to use an enumeration environment 
rather than itemize.

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-11 17:15       ` Wolfgang Schuster
@ 2024-10-12  9:40         ` Jorge Manuel
  2024-10-12 10:12           ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Jorge Manuel @ 2024-10-12  9:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster


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

Good morning to all,

Thank you for the code to insert numbers into boxes. However, I can't prevent the multiple-choice questions from repeating labels like 1.1.A). It looks very bad. How can I control this behavior? Thank you.

%%% sample code
\define[1]\BoxedNumber{\inframed[width=3ex]{\convertnumber{n}{#1}}}

\defineconversion [BoxedNumber] [\BoxedNumber]

\starttext

\startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
   \item xxx
   \startitemize[BoxedNumber,fit][stopper=,distance=\spaceamount]
     \item multiple choice
    	\startitemize[A, columns, two, random][stopper={)},style=bold]
 		\item choice 1
		 \item choice 2
		 \item choice 3
		 \item choice 4
	 \stopitemize

   \stopitemize
\stopitemize

\stoptext

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-12  9:40         ` Jorge Manuel
@ 2024-10-12 10:12           ` Wolfgang Schuster
  2024-10-12 10:59             ` Jorge Manuel
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2024-10-12 10:12 UTC (permalink / raw)
  To: Jorge Manuel; +Cc: mailing list for ConTeXt users

Jorge Manuel schrieb am 12.10.2024 um 11:40:
> Good morning to all,
> 
> Thank you for the code to insert numbers into boxes. However, I can't 
> prevent the multiple-choice questions from repeating labels like 1.1.A). 
> It looks very bad. How can I control this behavior? Thank you.
> 
> %%% sample code
> \define[1]\BoxedNumber{\inframed[width=3ex]{\convertnumber{n}{#1}}}
> 
> \defineconversion [BoxedNumber] [\BoxedNumber]
> 
> \starttext
> 
> \startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
>     \item xxx
>     \startitemize[BoxedNumber,fit][stopper=,distance=\spaceamount]

Add norepeat:

\startitemize[BoxedNumber,norepeat,fit][stopper=,distance=\spaceamount]

>       \item multiple choice
>       \startitemize[A, columns, two, random][stopper={)},style=bold]
>    \item choice 1

You have to replace \item with \startitem ... \stopitem to make use of 
the random option, i.e.

\startitem choice 1 \stopitem

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-12 10:12           ` Wolfgang Schuster
@ 2024-10-12 10:59             ` Jorge Manuel
  2024-10-12 11:24               ` Jorge Manuel
  0 siblings, 1 reply; 10+ messages in thread
From: Jorge Manuel @ 2024-10-12 10:59 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


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

To achieve a norepeat in a specific itemize block, I need to introduce the norepeat at a higher level. This affects all the children of that itemize. See the example below, please. In the multiple-choice block, I want to avoid repetition, but afterward, I want to restore the default behavior.

\define[1]\BoxedNumber{\inframed[width=3ex]{\convertnumber{n}{#1}}}

\defineconversion [BoxedNumber] [\BoxedNumber]

\starttext

\startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
   \item xxx
   \startitemize[BoxedNumber,fit, norepeat][stopper=,distance=\spaceamount]
     \item multiple choice
 \startitemize[A, columns, two, random, fit][stopper={)},style=bold] %%
 \item choice 1
 \item choice 2
 \item choice 3
 \item choice 4
 \stopitemize

 \item normal question 1
 \startitemize[BoxedNumber, repeat] %%
 \item question 1 \par\thinrules[n=2]
 \item question2 \par\thinrules[n=2]

 \stopitemize


   \stopitemize
\stopitemize

\stoptext

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-12 10:59             ` Jorge Manuel
@ 2024-10-12 11:24               ` Jorge Manuel
  2024-10-12 11:58                 ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Jorge Manuel @ 2024-10-12 11:24 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


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

I applied a trick: I created a phantom itemize.

\define[1]\BoxedNumber{\inframed[width=3ex]{\convertnumber{n}{#1}}}

\defineconversion [BoxedNumber] [\BoxedNumber]

\starttext

\startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
   \item xxx
   \startitemize[BoxedNumber,fit, repeat][stopper=,distance=\spaceamount]
     \item multiple choice
 \startitemize[norepeat]
 \item Your choice: \_\_\_\_
 \startitemize[A, columns, two, random, fit][stopper={)},style=bold] %%
 \item choice 1
 \item choice 2
 \item choice 3
 \item choice 4
 \stopitemize
 \stopitemize

 \item normal question 1
 \startitemize[BoxedNumber, repeat] %%
 \item question 1 \par\thinrules[n=2]
 \item question2 \par\thinrules[n=2]

 \stopitemize


   \stopitemize
\stopitemize

\stoptext


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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Issue with Custom Conversion Code in Latest Version of ConTeXt
  2024-10-12 11:24               ` Jorge Manuel
@ 2024-10-12 11:58                 ` Wolfgang Schuster
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2024-10-12 11:58 UTC (permalink / raw)
  To: Jorge Manuel; +Cc: mailing list for ConTeXt users

Jorge Manuel schrieb am 12.10.2024 um 13:24:
> I applied a trick: I created a phantom itemize.
> 
> \define[1]\BoxedNumber{\inframed[width=3ex]{\convertnumber{n}{#1}}}
> 
> \defineconversion [BoxedNumber] [\BoxedNumber]
> 
> \starttext
> 
> \startitemize[BoxedNumber,fit,repeat][stopper=,distance=\spaceamount]
>     \item xxx
>     \startitemize[BoxedNumber,fit, repeat][stopper=,distance=\spaceamount]
>       \item multiple choice
> * \startitemize[norepeat]*
> * \item Your choice: \_\_\_\_*
>   \startitemize[A, columns, two, random, fit][stopper={)},style=bold] %%
>   \item choice 1
>   \item choice 2
>   \item choice 3
>   \item choice 4
>   \stopitemize
> * \stopitemize*
> 
>   \item normal question 1
>   \startitemize[BoxedNumber, repeat] %%
>   \item question 1 \par\thinrules[n=2]
>   \item question2 \par\thinrules[n=2]
>   \stopitemize
>     \stopitemize
> \stopitemize
> 
> \stoptext

You can use an enumeration to have more control about the numbering and 
spacing/width of the counter.

%%%% begin example
\define[1]\BoxedNumber
   {\inframed[width=3ex]{\convertnumber{n}{#1}}}

\defineconversion [BoxedNumber] [\BoxedNumber]

\defineenumeration
   [Question]
   [text=,
    alternative=hang,
    width=broad,
    numberconversion=BoxedNumber]

\starttext

\startQuestion
   xxx
   \startsubQuestion
     multiple choice
     \startitemize[A,columns,tworandom][stopper={)},style=bold]
       \startitem choice 1 \stopitem
       \startitem choice 2 \stopitem
       \startitem choice 3 \stopitem
       \startitem choice 4 \stopitem
     \stopitemize
   \stopsubQuestion
   \startsubQuestion
     normal question 1
     \startsubsubQuestion
       question 1 \par\thinrules[n=2]
     \stopsubsubQuestion
     \startsubsubQuestion
       question2 \par\thinrules[n=2]
     \stopsubsubQuestion
   \stopsubQuestion
\stopQuestion

\stoptext
%%%% end example

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2024-10-12 12:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <c162a633-8188-4fdb-bce9-2304c4823943@Spark>
2024-10-06 15:44 ` [NTG-context] Issue with Custom Conversion Code in Latest Version of ConTeXt Jorge Manuel
2024-10-07 19:51   ` [NTG-context] " Wolfgang Schuster
2024-10-07 21:16   ` Wolfgang Schuster
2024-10-11 11:41     ` desdechaves
2024-10-11 17:15       ` Wolfgang Schuster
2024-10-12  9:40         ` Jorge Manuel
2024-10-12 10:12           ` Wolfgang Schuster
2024-10-12 10:59             ` Jorge Manuel
2024-10-12 11:24               ` Jorge Manuel
2024-10-12 11:58                 ` 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).