Re: [NTG-context] Progressively encouraging page/column breaks at \blank with penalties
That works for my purposes; thank you for letting me know about it! Joey On Sun, Aug 15, 2021 at 1:53 AM Aditya Mahajan via ntg-context < ntg-context@ntg.nl> wrote: > On Sun, 15 Aug 2021, Joey McCollum via ntg-context wrote: > > > Hi, > > > > I'm trying to implement a section break marker in a grid layout. At a > > section break, two lines of space should separate the subsequent segments > > of text (just plain paragraphs, in this case), and a symbol (in the > example > > below, "X") should be set in the middle of these two lines. For my > > purposes, the section break symbol should never occur at the top of a > page > > or column, and it is more desirable to have a page or column end with the > > section break symbol than to have a single orphaned line follow the > symbol > > at the end of the page or column. Based on these constraints, I thought > > that using the "samepage" and "preference" options for the first and > second > > line breaks would work nicely: > > > > ``` > > \define\SectionBreak{% > > \blank[halfline, samepage]% non-breaking to ensure that no column > > begins with the section break symbol > > \startalignment[middle]% > > {X}% section break symbol > > \stopalignment% > > \blank[halfline, preference]% this can (and, if possible, should) be > > broken across a column > > ``` > > > > This does successfully prevent the placement of the symbol at the top of > a > > page/column, but it doesn't encourage the placement of the symbol at the > > end of a page/column as often as I would like. > > Depending on what you want, you can try adding \testpage[n] (where n is a > number). This checks if the remainder of the page has enough space for n > lines; if not, then it issues a page-break. > > 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 ___
Re: [NTG-context] Progressively encouraging page/column breaks at \blank with penalties
On Sun, 15 Aug 2021, Joey McCollum via ntg-context wrote: > Hi, > > I'm trying to implement a section break marker in a grid layout. At a > section break, two lines of space should separate the subsequent segments > of text (just plain paragraphs, in this case), and a symbol (in the example > below, "X") should be set in the middle of these two lines. For my > purposes, the section break symbol should never occur at the top of a page > or column, and it is more desirable to have a page or column end with the > section break symbol than to have a single orphaned line follow the symbol > at the end of the page or column. Based on these constraints, I thought > that using the "samepage" and "preference" options for the first and second > line breaks would work nicely: > > ``` > \define\SectionBreak{% > \blank[halfline, samepage]% non-breaking to ensure that no column > begins with the section break symbol > \startalignment[middle]% > {X}% section break symbol > \stopalignment% > \blank[halfline, preference]% this can (and, if possible, should) be > broken across a column > ``` > > This does successfully prevent the placement of the symbol at the top of a > page/column, but it doesn't encourage the placement of the symbol at the > end of a page/column as often as I would like. Depending on what you want, you can try adding \testpage[n] (where n is a number). This checks if the remainder of the page has enough space for n lines; if not, then it issues a page-break. 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 ___
[NTG-context] Progressively encouraging page/column breaks at \blank with penalties
Hi, I'm trying to implement a section break marker in a grid layout. At a section break, two lines of space should separate the subsequent segments of text (just plain paragraphs, in this case), and a symbol (in the example below, "X") should be set in the middle of these two lines. For my purposes, the section break symbol should never occur at the top of a page or column, and it is more desirable to have a page or column end with the section break symbol than to have a single orphaned line follow the symbol at the end of the page or column. Based on these constraints, I thought that using the "samepage" and "preference" options for the first and second line breaks would work nicely: ``` \define\SectionBreak{% \blank[halfline, samepage]% non-breaking to ensure that no column begins with the section break symbol \startalignment[middle]% {X}% section break symbol \stopalignment% \blank[halfline, preference]% this can (and, if possible, should) be broken across a column ``` This does successfully prevent the placement of the symbol at the top of a page/column, but it doesn't encourage the placement of the symbol at the end of a page/column as often as I would like. I tried replacing the "preference" option with options with better negative penalties, like "penalty:-1000", "penalty:-2000", and even "penalty:-5000", but these didn't make any difference. The option "penalty:-1" trivially works, but it forces a page/column break at every section break marker, which is far too extreme. Is this normal behavior? I would have thought that progressively more negative penalties would gradually encourage page/column breaks, but this doesn't seem to happen. In the following MWE, the "preference" and "penalty" options (apart from "penalty:-1") for the second line break don't change the total page count or appearance of the final page at all (which would be expected in a document of this size): ``` \setuplayout[ grid=yes %enable baseline grid ] \setupinterlinespace[18bp] % text line spacing %Define macro for section break: \define\SectionBreak{% \blank[halfline, samepage]%non-breaking to ensure that no column begins with the section break symbol \startalignment[middle]% {X}% section break symbol \stopalignment% \blank[halfline]% a column break here is neither encouraged nor discouraged % \blank[halfline, preference]% this should encourage a column break here, but it doesn't seem to make a difference % \blank[halfline, penalty:-1000]% still no difference % \blank[halfline, penalty:-2000]% still no difference % \blank[halfline, penalty:-5000]% still no difference % \blank[halfline, penalty:-1]% this works, but it is too extreme! } %Set things up for fakewords: \usemodule[visual] \setupsystem[random=10] \starttext \dorecurse{400}{\fakewords{20}{100}\SectionBreak} \stoptext ``` As always, any help is appreciated! Joey ___ 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 ___