page ends with a section title followed by a table
Dear List, In the following example, the section title appears at the very end of the first page. \showframe \starttext \dorecurse{94}{a b c }\\ \dorecurse{94}{a b c }\\ \dorecurse{94}{a b c }\\ \dorecurse{94}{a b c }\\ \dorecurse{94}{a b c }\\ \dorecurse{30}{a b c } \section{title} \startxtable \startxrow \startxcell[ny=10]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{9}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page? Thanks! Best, Sylvain
On 11/10/20 9:55 AM, Sylvain Hubert wrote:
Dear List,
In the following example, the section title appears at the very end of the first page. [...] Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page?
Hi Sylvain, \setuphead[title] [before={\blank[preference, big], after={\blank[samepage, big]] In this case, the blank space before sets a preference for inserting a page break. The blank space after requires to be in the same page with next paragraph. Of course, you don’t need both simultaneously. Just in case it helps, Pablo -- http://www.ousia.tk
On Tue, 10 Nov 2020 at 16:00, Pablo Rodriguez
On 11/10/20 9:55 AM, Sylvain Hubert wrote:
Dear List,
In the following example, the section title appears at the very end of the first page. [...] Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page?
Hi Sylvain,
\setuphead[title] [before={\blank[preference, big], after={\blank[samepage, big]]
In this case, the blank space before sets a preference for inserting a page break. The blank space after requires to be in the same page with next paragraph.
Of course, you don’t need both simultaneously.
Just in case it helps,
Pablo
Hello Pablo, Thank you very much for the help. The penalty of \blank indeed brings the solution closer and it does format the previous example correctly. However, when I went back to the original document, neither [before={\blank[preference, big]}] nor [after={\blank[samepage, big]}] nor both worked. I trimmed it into the following example which behaves the same: \starttext \showframe \dorecurse{50}{a } \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}] \startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext Do you have an idea on how this could also be formatted correctly or how one could inspect and debug the penalty? Thanks again! Sylvain
My mistake, but the problem survives the fix:
\setuphead[section][after={\blank[samepage,big]}]
\starttext
\showframe
\dorecurse{50}{a }
\startsection[title=spec]
\startxtable
\startxrow
\startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell
\stopxrow
\dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow}
\stopxtable
\stoptext
Sylvain
On Tue, 10 Nov 2020 at 17:11, Sylvain Hubert
On Tue, 10 Nov 2020 at 16:00, Pablo Rodriguez
wrote: On 11/10/20 9:55 AM, Sylvain Hubert wrote:
Dear List,
In the following example, the section title appears at the very end of the first page. [...] Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page?
Hi Sylvain,
\setuphead[title] [before={\blank[preference, big], after={\blank[samepage, big]]
In this case, the blank space before sets a preference for inserting a page break. The blank space after requires to be in the same page with next paragraph.
Of course, you don’t need both simultaneously.
Just in case it helps,
Pablo
Hello Pablo,
Thank you very much for the help. The penalty of \blank indeed brings the solution closer and it does format the previous example correctly.
However, when I went back to the original document, neither [before={\blank[preference, big]}] nor [after={\blank[samepage, big]}] nor both worked. I trimmed it into the following example which behaves the same:
\starttext \showframe \dorecurse{50}{a } \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}] \startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext
Do you have an idea on how this could also be formatted correctly or how one could inspect and debug the penalty?
Thanks again!
Sylvain
On 11/10/20 5:23 PM, Sylvain Hubert wrote:
My mistake, but the problem survives the fix:
\setuphead[section][after={\blank[samepage,big]}] \starttext \showframe \dorecurse{50}{a } \startsection[title=spec] \startxtable Hi Sylvain,
no fix is required when you allow the table to be split: \startxtable[split=yes] Pablo -- http://www.ousia.tk
On Tue, 10 Nov 2020 at 17:37, Pablo Rodriguez
On 11/10/20 5:23 PM, Sylvain Hubert wrote:
My mistake, but the problem survives the fix:
\setuphead[section][after={\blank[samepage,big]}] \starttext \showframe \dorecurse{50}{a } \startsection[title=spec] \startxtable Hi Sylvain,
no fix is required when you allow the table to be split:
\startxtable[split=yes]
Pablo
Hi Pablo, Thanks for the suggestion, but unlike the MWE, in the original document, the table has ten rows and is visually not suitable for a split. The large row span is meant to represent this restriction. Sylvain
Pablo Rodriguez schrieb am 10.11.2020 um 15:59:
On 11/10/20 9:55 AM, Sylvain Hubert wrote:
Dear List,
In the following example, the section title appears at the very end of the first page. [...] Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page? Hi Sylvain,
\setuphead[title] [before={\blank[preference, big], after={\blank[samepage, big]]
In this case, the blank space before sets a preference for inserting a page break. The blank space after requires to be in the same page with next paragraph.
Another method is to move the section title to the next page when the remaining spaces is below a specified number of lines. The following setup forces a page break when less than 4 lines remain on the current page. \setuphead [section] [before={\testpage[4]\blank[2*big]}] Wolfgang
On Tue, 10 Nov 2020 at 17:54, Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote:
Pablo Rodriguez schrieb am 10.11.2020 um 15:59:
On 11/10/20 9:55 AM, Sylvain Hubert wrote:
Dear List,
In the following example, the section title appears at the very end of the first page. [...] Does anyone know where to adjust the penalty in this case, so that the section title can be repositioned to the next page? Hi Sylvain,
\setuphead[title] [before={\blank[preference, big], after={\blank[samepage, big]]
In this case, the blank space before sets a preference for inserting a page break. The blank space after requires to be in the same page with next paragraph.
Another method is to move the section title to the next page when the remaining spaces is below a specified number of lines. The following setup forces a page break when less than 4 lines remain on the current page.
\setuphead [section] [before={\testpage[4]\blank[2*big]}]
Wolfgang
Hi Wolfgang, Thanks for the suggestion, but as illustrated by the second example, copied here, where the section title is at the top of the page: \starttext \showframe \dorecurse{50}{a } \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}] \startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext it is sometimes difficult to predict how much remaining space should trigger a line break. Sylvain
Sylvain Hubert schrieb am 10.11.2020 um 18:06:
Thanks for the suggestion, but as illustrated by the second example, copied here, where the section title is at the top of the page:
\starttext \showframe \dorecurse{50}{a } \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}]
Your settings in the second argument of \startsection make no sense because the optional argument is for userdata (values like author etc.)
\startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext
it is sometimes difficult to predict how much remaining space should trigger a line break.
You can either reformat your table or put the table in a float environment to move it to a place where it fits. Wolfgang
On Tue, 10 Nov 2020 at 18:25, Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote:
Sylvain Hubert schrieb am 10.11.2020 um 18:06:
Thanks for the suggestion, but as illustrated by the second example, copied here, where the section title is at the top of the page:
\starttext \showframe \dorecurse{50}{a } \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}]
Your settings in the second argument of \startsection make no sense because the optional argument is for userdata (values like author etc.)
\startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext
it is sometimes difficult to predict how much remaining space should trigger a line break.
You can either reformat your table or put the table in a float environment to move it to a place where it fits.
Wolfgang
Weirdly enough, "\hskip 0pt" solves the problem. \setuphead[section][after={\blank[samepage]\hskip 0pt}] \starttext \showframe \dorecurse{50}{a } \startsection[title=spec] \startxtable \startxrow \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell \stopxrow \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow} \stopxtable \stoptext Sylvain
Sylvain Hubert schrieb am 10.11.2020 um 19:11:
Weirdly enough, "\hskip 0pt" solves the problem.
\setuphead[section][after={\blank[samepage]\hskip 0pt}] \starttext \showframe \dorecurse{50}{a } \startsection[title=spec] \startxtable
What happens when you \hskip is that you switch to horizontal mode and the preferred to do this is to use \dontleavehmode. \dontleavehmode \startxtable Wolfgang
On Tue, 10 Nov 2020 at 19:23, Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote:
Sylvain Hubert schrieb am 10.11.2020 um 19:11:
Weirdly enough, "\hskip 0pt" solves the problem.
\setuphead[section][after={\blank[samepage]\hskip 0pt}] \starttext \showframe \dorecurse{50}{a } \startsection[title=spec] \startxtable
What happens when you \hskip is that you switch to horizontal mode and the preferred to do this is to use \dontleavehmode.
\dontleavehmode \startxtable
Wolfgang
Indeed. Thanks for the information! For the record, this is how the problem is finally solved: \setuphead[section][after={\blank[sampage]}] \begingroup\setupindenting[no]\dontleavehmode\startxtable … \stopxtable\endgroup Sylvain
On Tue, 10 Nov 2020, Sylvain Hubert wrote:
Indeed. Thanks for the information!
For the record, this is how the problem is finally solved:
\setuphead[section][after={\blank[sampage]}] \begingroup\setupindenting[no]\dontleavehmode\startxtable … \stopxtable\endgroup
Unless you have other reasons to create a group, you can just use: \noindentation\dontleavehmode \startxtable ... \stopxtable Aditya
participants (4)
-
Aditya Mahajan
-
Pablo Rodriguez
-
Sylvain Hubert
-
Wolfgang Schuster