ConTeXt: Page break preference between nested itemize environments











up vote
1
down vote

favorite












I frequently have nested itemize environments that must appear on the same page as the item that they are nested under, such as parts of a question on an assignment or exam. I can't seem to figure out the right options to force this behavior in all cases where nested content is physically able to fit on the page.



I had tried to use page[bigpreference] after the nested itemize:



usemodule[visual]

setupitemize[2][after={page[bigpreference]}]

starttext

startitemize
dorecurse{20}{
item This is an exam/assignment question item: fakewords{10}{20}

startitemize
dorecurse{3}{
item subquestion or multiple choice answer: fakewords{10}{20}
}
stopitemize
}
stopitemize

stoptext


But I get an unwanted break immediately on the first page:



unwanted break



I found a reference to c_strc_itemgroups_spacing_mode=0 in another question and while this helps, I still see an unwanted page break on page 3. I also tried setupitemize[1][inbetween={page[bigpreference]}] with no improvement.



I'm not entirely sure whether this behavior is specific to nested itemize environments but is there any general way to make sure that the top-level item content is never split across pages?



Update:



While playing around some more with the page preference options, I found that the combination of page[no] and page[bigpreference] seems to work best, but as it is based on preferences, the end result is not guaranteed. Including the following options into the above code still results in an unwanted page break on page 6:



setupitemize[2][inbetween={page[no]},
before={page[no]},
after={page[bigpreference]}]


Perhaps some sort of framing solution would be best, but I'm not sure how to implement one in a generic fashion (without manually defining frames).










share|improve this question
























  • A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
    – sztruks
    Oct 11 at 19:05










  • @sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
    – ssokolen
    Oct 11 at 19:34












  • unfortunately not, I am just beginning my travel with TeX boxes…
    – sztruks
    Oct 11 at 19:44















up vote
1
down vote

favorite












I frequently have nested itemize environments that must appear on the same page as the item that they are nested under, such as parts of a question on an assignment or exam. I can't seem to figure out the right options to force this behavior in all cases where nested content is physically able to fit on the page.



I had tried to use page[bigpreference] after the nested itemize:



usemodule[visual]

setupitemize[2][after={page[bigpreference]}]

starttext

startitemize
dorecurse{20}{
item This is an exam/assignment question item: fakewords{10}{20}

startitemize
dorecurse{3}{
item subquestion or multiple choice answer: fakewords{10}{20}
}
stopitemize
}
stopitemize

stoptext


But I get an unwanted break immediately on the first page:



unwanted break



I found a reference to c_strc_itemgroups_spacing_mode=0 in another question and while this helps, I still see an unwanted page break on page 3. I also tried setupitemize[1][inbetween={page[bigpreference]}] with no improvement.



I'm not entirely sure whether this behavior is specific to nested itemize environments but is there any general way to make sure that the top-level item content is never split across pages?



Update:



While playing around some more with the page preference options, I found that the combination of page[no] and page[bigpreference] seems to work best, but as it is based on preferences, the end result is not guaranteed. Including the following options into the above code still results in an unwanted page break on page 6:



setupitemize[2][inbetween={page[no]},
before={page[no]},
after={page[bigpreference]}]


Perhaps some sort of framing solution would be best, but I'm not sure how to implement one in a generic fashion (without manually defining frames).










share|improve this question
























  • A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
    – sztruks
    Oct 11 at 19:05










  • @sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
    – ssokolen
    Oct 11 at 19:34












  • unfortunately not, I am just beginning my travel with TeX boxes…
    – sztruks
    Oct 11 at 19:44













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I frequently have nested itemize environments that must appear on the same page as the item that they are nested under, such as parts of a question on an assignment or exam. I can't seem to figure out the right options to force this behavior in all cases where nested content is physically able to fit on the page.



I had tried to use page[bigpreference] after the nested itemize:



usemodule[visual]

setupitemize[2][after={page[bigpreference]}]

starttext

startitemize
dorecurse{20}{
item This is an exam/assignment question item: fakewords{10}{20}

startitemize
dorecurse{3}{
item subquestion or multiple choice answer: fakewords{10}{20}
}
stopitemize
}
stopitemize

stoptext


But I get an unwanted break immediately on the first page:



unwanted break



I found a reference to c_strc_itemgroups_spacing_mode=0 in another question and while this helps, I still see an unwanted page break on page 3. I also tried setupitemize[1][inbetween={page[bigpreference]}] with no improvement.



I'm not entirely sure whether this behavior is specific to nested itemize environments but is there any general way to make sure that the top-level item content is never split across pages?



Update:



While playing around some more with the page preference options, I found that the combination of page[no] and page[bigpreference] seems to work best, but as it is based on preferences, the end result is not guaranteed. Including the following options into the above code still results in an unwanted page break on page 6:



setupitemize[2][inbetween={page[no]},
before={page[no]},
after={page[bigpreference]}]


Perhaps some sort of framing solution would be best, but I'm not sure how to implement one in a generic fashion (without manually defining frames).










share|improve this question















I frequently have nested itemize environments that must appear on the same page as the item that they are nested under, such as parts of a question on an assignment or exam. I can't seem to figure out the right options to force this behavior in all cases where nested content is physically able to fit on the page.



I had tried to use page[bigpreference] after the nested itemize:



usemodule[visual]

setupitemize[2][after={page[bigpreference]}]

starttext

startitemize
dorecurse{20}{
item This is an exam/assignment question item: fakewords{10}{20}

startitemize
dorecurse{3}{
item subquestion or multiple choice answer: fakewords{10}{20}
}
stopitemize
}
stopitemize

stoptext


But I get an unwanted break immediately on the first page:



unwanted break



I found a reference to c_strc_itemgroups_spacing_mode=0 in another question and while this helps, I still see an unwanted page break on page 3. I also tried setupitemize[1][inbetween={page[bigpreference]}] with no improvement.



I'm not entirely sure whether this behavior is specific to nested itemize environments but is there any general way to make sure that the top-level item content is never split across pages?



Update:



While playing around some more with the page preference options, I found that the combination of page[no] and page[bigpreference] seems to work best, but as it is based on preferences, the end result is not guaranteed. Including the following options into the above code still results in an unwanted page break on page 6:



setupitemize[2][inbetween={page[no]},
before={page[no]},
after={page[bigpreference]}]


Perhaps some sort of framing solution would be best, but I'm not sure how to implement one in a generic fashion (without manually defining frames).







context itemize






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 11 at 20:08

























asked Oct 11 at 18:10









ssokolen

752110




752110












  • A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
    – sztruks
    Oct 11 at 19:05










  • @sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
    – ssokolen
    Oct 11 at 19:34












  • unfortunately not, I am just beginning my travel with TeX boxes…
    – sztruks
    Oct 11 at 19:44


















  • A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
    – sztruks
    Oct 11 at 19:05










  • @sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
    – ssokolen
    Oct 11 at 19:34












  • unfortunately not, I am just beginning my travel with TeX boxes…
    – sztruks
    Oct 11 at 19:44
















A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
– sztruks
Oct 11 at 19:05




A very dirty trick is putting your items and subitems in a vbox, but the layout may look quite awful. So does the code.
– sztruks
Oct 11 at 19:05












@sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
– ssokolen
Oct 11 at 19:34






@sztruks Thanks! That wouldn't be too bad if I didn't have to use vbox manually (I'm usually dealing with quite a few such pages at a time). Do you know how I could incorporate vbox into any of the before/after/inbetween options or something similar? I didn't have much luck when I played around with that idea earlier.
– ssokolen
Oct 11 at 19:34














unfortunately not, I am just beginning my travel with TeX boxes…
– sztruks
Oct 11 at 19:44




unfortunately not, I am just beginning my travel with TeX boxes…
– sztruks
Oct 11 at 19:44










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Does changing the spacing mode work for you?



usemodule[visual]

unprotect
% 0 = before/after
% 1 = between unless before
% 2 = between
c_strc_itemgroups_spacing_mode=0
protect

setupitemize[2][before={blank[samepage]}]

starttext

startitemize
dorecurse{20}{
item This is an exam/assignment question item: fakewords{10}{20}

startitemize
dorecurse{3}{
item subquestion or multiple choice answer: fakewords{10}{20}
}
stopitemize
}
stopitemize

stoptext


Click to enlarge picture:



enter image description here






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454806%2fcontext-page-break-preference-between-nested-itemize-environments%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Does changing the spacing mode work for you?



    usemodule[visual]

    unprotect
    % 0 = before/after
    % 1 = between unless before
    % 2 = between
    c_strc_itemgroups_spacing_mode=0
    protect

    setupitemize[2][before={blank[samepage]}]

    starttext

    startitemize
    dorecurse{20}{
    item This is an exam/assignment question item: fakewords{10}{20}

    startitemize
    dorecurse{3}{
    item subquestion or multiple choice answer: fakewords{10}{20}
    }
    stopitemize
    }
    stopitemize

    stoptext


    Click to enlarge picture:



    enter image description here






    share|improve this answer

























      up vote
      0
      down vote













      Does changing the spacing mode work for you?



      usemodule[visual]

      unprotect
      % 0 = before/after
      % 1 = between unless before
      % 2 = between
      c_strc_itemgroups_spacing_mode=0
      protect

      setupitemize[2][before={blank[samepage]}]

      starttext

      startitemize
      dorecurse{20}{
      item This is an exam/assignment question item: fakewords{10}{20}

      startitemize
      dorecurse{3}{
      item subquestion or multiple choice answer: fakewords{10}{20}
      }
      stopitemize
      }
      stopitemize

      stoptext


      Click to enlarge picture:



      enter image description here






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Does changing the spacing mode work for you?



        usemodule[visual]

        unprotect
        % 0 = before/after
        % 1 = between unless before
        % 2 = between
        c_strc_itemgroups_spacing_mode=0
        protect

        setupitemize[2][before={blank[samepage]}]

        starttext

        startitemize
        dorecurse{20}{
        item This is an exam/assignment question item: fakewords{10}{20}

        startitemize
        dorecurse{3}{
        item subquestion or multiple choice answer: fakewords{10}{20}
        }
        stopitemize
        }
        stopitemize

        stoptext


        Click to enlarge picture:



        enter image description here






        share|improve this answer












        Does changing the spacing mode work for you?



        usemodule[visual]

        unprotect
        % 0 = before/after
        % 1 = between unless before
        % 2 = between
        c_strc_itemgroups_spacing_mode=0
        protect

        setupitemize[2][before={blank[samepage]}]

        starttext

        startitemize
        dorecurse{20}{
        item This is an exam/assignment question item: fakewords{10}{20}

        startitemize
        dorecurse{3}{
        item subquestion or multiple choice answer: fakewords{10}{20}
        }
        stopitemize
        }
        stopitemize

        stoptext


        Click to enlarge picture:



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 5 hours ago









        Henri Menke

        67.2k7148255




        67.2k7148255






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454806%2fcontext-page-break-preference-between-nested-itemize-environments%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)