ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Spacing issue in itemize
@ 2022-01-13 16:48 Gavin via ntg-context
  2022-01-13 17:15 ` Aditya Mahajan via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: Gavin via ntg-context @ 2022-01-13 16:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

Hi list,

When I define an items group, it seems to mess up the spacing for a nested item group. See example below. Any ideas?

I’m typesetting with

	> ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: english/english

on an M1 Mac.

Thanks!
Gavin


\usemodule[visual]

\defineitemgroup[questions]
\setupquestions [each] [n]

\starttext
This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
\startquestions
  \item \fakewords{15}{20}
    \startitemize[a][left=(,stopper=,right=)]
      \item \fakewords{10}{15}
      \item \fakewords{10}{15}
    \stopitemize
  \item \fakewords{10}{15}
\stopquestions

This numbered list uses itemize. The itemize inside has the expected space above item (a).
\startitemize[n]
  \item \fakewords{15}{20}
    \startitemize[a][left=(,stopper=,right=)]
      \item \fakewords{10}{15}
      \item \fakewords{10}{15}
    \stopitemize
  \item \fakewords{10}{15}
\stopitemize

\stoptext
___________________________________________________________________________________
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: Spacing issue in itemize
  2022-01-13 16:48 Spacing issue in itemize Gavin via ntg-context
@ 2022-01-13 17:15 ` Aditya Mahajan via ntg-context
  2022-01-13 21:32   ` Gavin via ntg-context
  2022-01-14  8:09   ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 6+ messages in thread
From: Aditya Mahajan via ntg-context @ 2022-01-13 17:15 UTC (permalink / raw)
  To: Gavin via ntg-context; +Cc: Aditya Mahajan

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

On Thu, 13 Jan 2022, Gavin via ntg-context wrote:

> Hi list,
> 
> When I define an items group, it seems to mess up the spacing for a nested item group. See example below. Any ideas?
> 
> I’m typesetting with
> 
> 	> ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: english/english
> 
> on an M1 Mac.
> 
> Thanks!
> Gavin
> 
> 
> \usemodule[visual]
> 
> \defineitemgroup[questions]
> \setupquestions [each] [n]
> 
> \starttext
> This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
> \startquestions
>   \item \fakewords{15}{20}
>     \startitemize[a][left=(,stopper=,right=)]
>       \item \fakewords{10}{15}
>       \item \fakewords{10}{15}
>     \stopitemize
>   \item \fakewords{10}{15}
> \stopquestions
> 
> This numbered list uses itemize. The itemize inside has the expected space above item (a).
> \startitemize[n]
>   \item \fakewords{15}{20}
>     \startitemize[a][left=(,stopper=,right=)]
>       \item \fakewords{10}{15}
>       \item \fakewords{10}{15}
>     \stopitemize
>   \item \fakewords{10}{15}
> \stopitemize
> 
> \stoptext

This is by design. This is what is happening:

\usemodule[visual]

\defineitemgroup[questions]

\starttext
This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
\startquestions[n][inbetween={AAA}]
  \item \fakewords{15}{20}
    \startitemize[a][left=(,stopper=,right=),before={BBB}]
      \item \fakewords{10}{15}
      \item \fakewords{10}{15}
    \stopitemize
  \item \fakewords{10}{15}
\stopquestions

This numbered list uses itemize. The itemize inside has the expected space above item (a).
\startitemize[n][inbetween={AAA}]
  \item \fakewords{15}{20}
    \startitemize[a][left=(,stopper=,right=),before={BBB}]
      \item \fakewords{10}{15}
      \item \fakewords{10}{15}
    \stopitemize
  \item \fakewords{10}{15}
\stopitemize

\stoptext

Note that in the first case, the inbetween does not get inserted at the start of the nested itemization (because, ConTeXt doesn't think that they are nested as the names are different). But the before key of the nested itemization doesn't get inserted in both cases because ConTeXt thinks that the itemization is nested!

You can change this behavior by using:

\unprotect
\c_strc_itemgroups_spacing_mode\plusone
\protect

in which case both outputs are similar. 

@Hans: Does it make sense to add a setups key to \setupitemize to keep such changes local?

Aditya

[-- 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: Spacing issue in itemize
  2022-01-13 17:15 ` Aditya Mahajan via ntg-context
@ 2022-01-13 21:32   ` Gavin via ntg-context
  2022-01-14  8:09   ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 6+ messages in thread
From: Gavin via ntg-context @ 2022-01-13 21:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

Thank you again, Aditya!

I changed my documents so I use three levels of question, which solved the problem.

My code might be more readable if the different levels had different names (question, part, subpart), rather than nested questions in questions. This was my original intention. I was certainly surprised by the result.

Now I’m moving on to the problem set's diagrams with MetaFun.

Gavin


> On Jan 13, 2022, at 10:15 AM, Aditya Mahajan via ntg-context <ntg-context@ntg.nl> wrote:
> 
> On Thu, 13 Jan 2022, Gavin via ntg-context wrote:
> 
>> Hi list,
>> 
>> When I define an items group, it seems to mess up the spacing for a nested item group. See example below. Any ideas?
>> 
>> I’m typesetting with
>> 
>> 	> ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: english/english
>> 
>> on an M1 Mac.
>> 
>> Thanks!
>> Gavin
>> 
>> 
>> \usemodule[visual]
>> 
>> \defineitemgroup[questions]
>> \setupquestions [each] [n]
>> 
>> \starttext
>> This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
>> \startquestions
>>  \item \fakewords{15}{20}
>>    \startitemize[a][left=(,stopper=,right=)]
>>      \item \fakewords{10}{15}
>>      \item \fakewords{10}{15}
>>    \stopitemize
>>  \item \fakewords{10}{15}
>> \stopquestions
>> 
>> This numbered list uses itemize. The itemize inside has the expected space above item (a).
>> \startitemize[n]
>>  \item \fakewords{15}{20}
>>    \startitemize[a][left=(,stopper=,right=)]
>>      \item \fakewords{10}{15}
>>      \item \fakewords{10}{15}
>>    \stopitemize
>>  \item \fakewords{10}{15}
>> \stopitemize
>> 
>> \stoptext
> 
> This is by design. This is what is happening:
> 
> \usemodule[visual]
> 
> \defineitemgroup[questions]
> 
> \starttext
> This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
> \startquestions[n][inbetween={AAA}]
>  \item \fakewords{15}{20}
>    \startitemize[a][left=(,stopper=,right=),before={BBB}]
>      \item \fakewords{10}{15}
>      \item \fakewords{10}{15}
>    \stopitemize
>  \item \fakewords{10}{15}
> \stopquestions
> 
> This numbered list uses itemize. The itemize inside has the expected space above item (a).
> \startitemize[n][inbetween={AAA}]
>  \item \fakewords{15}{20}
>    \startitemize[a][left=(,stopper=,right=),before={BBB}]
>      \item \fakewords{10}{15}
>      \item \fakewords{10}{15}
>    \stopitemize
>  \item \fakewords{10}{15}
> \stopitemize
> 
> \stoptext
> 
> Note that in the first case, the inbetween does not get inserted at the start of the nested itemization (because, ConTeXt doesn't think that they are nested as the names are different). But the before key of the nested itemization doesn't get inserted in both cases because ConTeXt thinks that the itemization is nested!
> 
> You can change this behavior by using:
> 
> \unprotect
> \c_strc_itemgroups_spacing_mode\plusone
> \protect
> 
> in which case both outputs are similar. 
> 
> @Hans: Does it make sense to add a setups key to \setupitemize to keep such changes local?
> 
> Aditya
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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: Spacing issue in itemize
  2022-01-13 17:15 ` Aditya Mahajan via ntg-context
  2022-01-13 21:32   ` Gavin via ntg-context
@ 2022-01-14  8:09   ` Hans Hagen via ntg-context
  2022-01-14 13:52     ` Gavin via ntg-context
  2022-01-14 15:22     ` Aditya Mahajan via ntg-context
  1 sibling, 2 replies; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2022-01-14  8:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen, Wolfgang Schuster

On 1/13/2022 6:15 PM, Aditya Mahajan via ntg-context wrote:
> On Thu, 13 Jan 2022, Gavin via ntg-context wrote:
> 
>> Hi list,
>>
>> When I define an items group, it seems to mess up the spacing for a nested item group. See example below. Any ideas?
>>
>> I’m typesetting with
>>
>> 	> ConTeXt  ver: 2022.01.06 19:51 LMTX  fmt: 2022.1.9  int: english/english
>>
>> on an M1 Mac.
>>
>> Thanks!
>> Gavin
>>
>>
>> \usemodule[visual]
>>
>> \defineitemgroup[questions]
>> \setupquestions [each] [n]
>>
>> \starttext
>> This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
>> \startquestions
>>    \item \fakewords{15}{20}
>>      \startitemize[a][left=(,stopper=,right=)]
>>        \item \fakewords{10}{15}
>>        \item \fakewords{10}{15}
>>      \stopitemize
>>    \item \fakewords{10}{15}
>> \stopquestions
>>
>> This numbered list uses itemize. The itemize inside has the expected space above item (a).
>> \startitemize[n]
>>    \item \fakewords{15}{20}
>>      \startitemize[a][left=(,stopper=,right=)]
>>        \item \fakewords{10}{15}
>>        \item \fakewords{10}{15}
>>      \stopitemize
>>    \item \fakewords{10}{15}
>> \stopitemize
>>
>> \stoptext
> 
> This is by design. This is what is happening:
> 
> \usemodule[visual]
> 
> \defineitemgroup[questions]
> 
> \starttext
> This numbered list uses my item group \quotation{questions.} The itemize inside is missing space above item (a).
> \startquestions[n][inbetween={AAA}]
>    \item \fakewords{15}{20}
>      \startitemize[a][left=(,stopper=,right=),before={BBB}]
>        \item \fakewords{10}{15}
>        \item \fakewords{10}{15}
>      \stopitemize
>    \item \fakewords{10}{15}
> \stopquestions
> 
> This numbered list uses itemize. The itemize inside has the expected space above item (a).
> \startitemize[n][inbetween={AAA}]
>    \item \fakewords{15}{20}
>      \startitemize[a][left=(,stopper=,right=),before={BBB}]
>        \item \fakewords{10}{15}
>        \item \fakewords{10}{15}
>      \stopitemize
>    \item \fakewords{10}{15}
> \stopitemize
> 
> \stoptext
> 
> Note that in the first case, the inbetween does not get inserted at the start of the nested itemization (because, ConTeXt doesn't think that they are nested as the names are different). But the before key of the nested itemization doesn't get inserted in both cases because ConTeXt thinks that the itemization is nested!
> 
> You can change this behavior by using:
> 
> \unprotect
> \c_strc_itemgroups_spacing_mode\plusone
> \protect
> 
> in which case both outputs are similar.
> 
> @Hans: Does it make sense to add a setups key to \setupitemize to keep such changes local?
% 0 = before/after
% 1 = between unless before
% 2 = between

\c_strc_itemgroups_spacing_mode\plustwo

The question then is: "what key" (we have c!inherit available) and "what 
values" (numbers ?) ...

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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: Spacing issue in itemize
  2022-01-14  8:09   ` Hans Hagen via ntg-context
@ 2022-01-14 13:52     ` Gavin via ntg-context
  2022-01-14 15:22     ` Aditya Mahajan via ntg-context
  1 sibling, 0 replies; 6+ messages in thread
From: Gavin via ntg-context @ 2022-01-14 13:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin, Wolfgang Schuster

Hi Hans, Aditya, and all,

Let me add another case to this discussion. For multiple choice questions, it is nice to have the columns option. However, this produces somewhat inconsistent results. In the code below, without Aditya's tweak, there is space before the choices in the first two cases, which use columns, but not the last. Aditya’s  tweak makes them more consistent.

Adding [columns, one] to the last \startchoices makes the results consistent. When doing that, I noticed that the spacing between column rows is slightly larger than the spacing between items without columns. So, I am happy using [columns, one] as a solution for multiple choice problems, just somewhat surprised by the difference.

Gavin


\starttext

%\unprotect
%\c_strc_itemgroups_spacing_mode\plusone
%\protect

\defineitemgroup[questions]
\setupquestions [1] [n]
\define\question{\item}

\defineitemgroup[choices]
\setupchoices [each] [A] [left=(, right=), width=1.7em, stopper=,]
\define\choice{\item}

Here are a few great looking multiple choice questions about colors.
\startquestions
\question What is your favorite color?
\startchoices[columns,four]
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\question What is your least favorite color?
\startchoices[columns]
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\question Toward which colors do you feel indifferent?
\startchoices
  \item Red
  \item Blue
  \item Green
  \item Magenta
\stopitemize
\stopquestions
That's it for questions about colors!

\stoptext
___________________________________________________________________________________
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: Spacing issue in itemize
  2022-01-14  8:09   ` Hans Hagen via ntg-context
  2022-01-14 13:52     ` Gavin via ntg-context
@ 2022-01-14 15:22     ` Aditya Mahajan via ntg-context
  1 sibling, 0 replies; 6+ messages in thread
From: Aditya Mahajan via ntg-context @ 2022-01-14 15:22 UTC (permalink / raw)
  To: Hans Hagen
  Cc: Aditya Mahajan, mailing list for ConTeXt users, Wolfgang Schuster

On Fri, 14 Jan 2022, Hans Hagen wrote:

> > @Hans: Does it make sense to add a setups key to \setupitemize to keep such
> > changes local?
> % 0 = before/after
> % 1 = between unless before
> % 2 = between
> 
> \c_strc_itemgroups_spacing_mode\plustwo
> 
> The question then is: "what key" (we have c!inherit available) and "what
> values" (numbers ?) ...

alternative = (a|b|c) like placelist?

Aditya
___________________________________________________________________________________
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:[~2022-01-14 15:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 16:48 Spacing issue in itemize Gavin via ntg-context
2022-01-13 17:15 ` Aditya Mahajan via ntg-context
2022-01-13 21:32   ` Gavin via ntg-context
2022-01-14  8:09   ` Hans Hagen via ntg-context
2022-01-14 13:52     ` Gavin via ntg-context
2022-01-14 15:22     ` Aditya Mahajan 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).