How to keep nested itemize group together with parent itemize item?
I have a nested itemize list like this, with first a question, then answer: \starttext \startitemize[n] \startitem What is the color of the sky? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \startitem What is the color of the grass? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \startitem What is the color of the butterfly? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \stopitemize \stoptext My copyeditor has noticed that often times a page break will appear after a question, leaving the answers, or some answers on a new page. He's requested I make sure the page breaks can only occur in front of a question, such that if a new page is needed, it places the question and answers always on the same page. Is there any way to make that happen in ConTeXt? --Joel
Hi,
you can probably control this a bit with penalties, but it would be
better to post an example where the unwanted break actually occur.
You can do \showmakeup[vpenalty] to see what penalties are added, and
you can play with for example
\startitemize[3,intro]
for the inner itemizations. But without an example showing the problem
it is a bit difficult...
/Mikael
On Wed, Sep 25, 2024 at 4:08 AM Joel via ntg-context
I have a nested itemize list like this, with first a question, then answer:
\starttext
\startitemize[n] \startitem What is the color of the sky? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \startitem What is the color of the grass? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \startitem What is the color of the butterfly? \stopitem \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize
\stopitemize
\stoptext
My copyeditor has noticed that often times a page break will appear after a question, leaving the answers, or some answers on a new page. He's requested I make sure the page breaks can only occur in front of a question, such that if a new page is needed, it places the question and answers always on the same page. Is there any way to make that happen in ConTeXt?
--Joel ___________________________________________________________________________________ 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 ___________________________________________________________________________________
If you don't mind using a little trick, try wrapping the questions and options in a vbox to avoid pagination. The best solution may be to use penalty to do so. \def\startnewitem{\vbox\bgroup\startitem} \def\stopnewitem{\stopitem\egroup} \starttext \startitemize[n] \startnewitem% <-- wrap What is the color of the sky? \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \stopnewitem % <-- wrap \startnewitem % <-- wrap What is the color of the grass? \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \stopnewitem% <-- wrap \startnewitem% <-- wrap What is the color of the butterfly? \startitemize[3] \startitem blue \stopitem \startitem green \stopitem \startitem red \stopitem \startitem yellow \stopitem \stopitemize \stopnewitem% <-- wrap \stopitemize Muyik
participants (3)
-
ai2472206007@yeah.net
-
Joel
-
Mikael Sundqvist