![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
Hello, Here is a strange page break (version 2010.04.29 22:30): \def\mySection{\section{bla}\dorecurse{30}{text }} \starttext \dorecurse8{ \mySection\par bla} \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Wed, May 05 2010, Taco Hoekwater wrote:
Looks rather normal here, see attached (ver: 2010.05.02 16:43)
A better page break would be after the last line of section 7: \def\mySection{\section{bla}\dorecurse{30}{text }} \starttext \dorecurse8{ \mySection\par bla \doif{\recurselevel}{7}{\page}} \stoptext This is just a minimal example. In my real life documents I have a lot of situations like this, and often it's not just one line that has to be moved to the previous page, but a lot more. So I have now a lot of "\page" commands in my documents... :( If needed, I'll try to make a better minimal example tomorrow. Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Peter Münster wrote:
On Wed, May 05 2010, Taco Hoekwater wrote:
Looks rather normal here, see attached (ver: 2010.05.02 16:43)
A better page break would be after the last line of section 7:
Oh, I see. Yes, it is odd that that last line is taken over to the second page in the original test file. But the same thing happens in mkii, so I suspect this is an unavoidable side-effect of page breaking. What happens is that TeX first attempts the break after two lines into section 7 and finds a badness value for that. Then it tries the third line, and finds another badness value for that. Normally, TeX considers the break after the second line better, but in your second example the \page adds a big negative penalty for the third line which skews the result in favor of that line. (TeX's page break algorithm is not all that smart really, because it does not know about sectioning at all: it only sees lines and penalties). Best wishes, Taco
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Wed, May 5, 2010 at 4:50 PM, Taco Hoekwater
Peter Münster wrote:
On Wed, May 05 2010, Taco Hoekwater wrote:
Looks rather normal here, see attached (ver: 2010.05.02 16:43)
A better page break would be after the last line of section 7:
Oh, I see. Yes, it is odd that that last line is taken over to the second page in the original test file. But the same thing happens in mkii, so I suspect this is an unavoidable side-effect of page breaking. in mkii the same example looks ok but I suppose it doesn't really matter
-- luigi
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Wed, May 05 2010, Taco Hoekwater wrote:
(TeX's page break algorithm is not all that smart really, because it does not know about sectioning at all: it only sees lines and penalties).
So the question is: what can be done? I know, that LaTeX doesn't suffer from such problems... Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 05.05.10 17:33, schrieb Peter Münster:
On Wed, May 05 2010, Taco Hoekwater wrote:
(TeX's page break algorithm is not all that smart really, because it does not know about sectioning at all: it only sees lines and penalties).
So the question is: what can be done? I know, that LaTeX doesn't suffer from such problems...
Without setting your own penalty values you can do this: \setuplayout[setups=*strict] Wolfgang
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Wed, May 05 2010, Wolfgang Schuster wrote:
Without setting your own penalty values you can do this:
\setuplayout[setups=*strict]
I'm sorry Wolfgang, I don't understand this command. In the following example, there is still a bad page break: \setuplayout[setups=*strict] \def\mySection{\section{bla}\dorecurse{30}{text }\par bla} \starttext \dorecurse8{\mySection} \stoptext Perhaps, there is a possibility to check easily what LaTeX does with penalties and sections and apply it to ConTeXt? Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 05.05.10 18:23, schrieb Peter Münster:
On Wed, May 05 2010, Wolfgang Schuster wrote
Without setting your own penalty values you can do this:
\setuplayout[setups=*strict]
I'm sorry Wolfgang, I don't understand this command. In the following example, there is still a bad page break:
The problem is in your example the page happens between two separate paragraphs and not in a paragraph where a penalty values is available. Wolfgang
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Wed, May 05 2010, Wolfgang Schuster wrote:
The problem is in your example the page happens between two separate paragraphs and not in a paragraph where a penalty values is available.
What is setups=*strict supposed to do? In the following example, the page break is even before section 7: \showframe \setuplayout[setups=*strict] \def\mySection{\section{bla}\dorecurse{40}{text }} \starttext \dorecurse8{\mySection} % try \dorecurse7 here \stoptext I would really like to solve this problem: read the relevant chapters in my TeXbook, take a look into latex-code and then patch context, but unfortunately I don't have time for this right now, so any help is really welcome. Currently I'm working on two documents, where I have a lot of \page commands as workaround. Tomorrow, I'll try to make a better example, where page-breaks are really bad... Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 05.05.10 19:21, schrieb Peter Münster:
What is setups=*strict supposed to do? In the following example, the page break is even before section 7:
\showframe \setuplayout[setups=*strict] \def\mySection{\section{bla}\dorecurse{40}{text }} \starttext \dorecurse8{\mySection} % try \dorecurse7 here \stoptext
The *strict prevents widows and orphans (comment \setuplayout in this example) but the important setting here is \setupalign[line]. \showframe \setuplayout[setups=*strict] \setupalign[line] \def\mySection{\section{bla}\dorecurse{40}{text }} \starttext \dorecurse8{\mySection} % try \dorecurse7 here \vfil\stoptext Wolfgang
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Wed, May 05 2010, Wolfgang Schuster wrote:
The *strict prevents widows and orphans (comment \setuplayout in this example) but the important setting here is \setupalign[line].
Hello Wolfgang, I know that \setupalign[line] means: last line should touch the bottom. It can be useful, but it's not always what I want. Here an example from real life (not the content... ;). I hope you agree, that there should be done something in the default setup of ConTeXT: %\setuplayout[setups=*strict] % this helps only in some cases... %\setupalign[line] % this means "flushbottom" and I don't always want that \def\Lines#1{\dorecurse{#1}{\dorecurse{17}{text }}\par} \def\Table#1{\starttable[|l|]\dorecurse{#1}{\NC bla \NC\AR}\stoptable} \showframe \starttext \completecontent \section{bla} \Lines{10} \Lines3 \section{bla} \Table9 \section{bla} \subsection{bla} \Lines2 \placetable[force][bla1]{bla}{\Table7} \Lines2 \subsection{bla} \Lines7 \placetable[force][bla2]{bla}{\Table{22}} \subsection{bla} \Lines2 \placefigure[force][bla3]{}{\framed[height=2cm]{bla}} \subsubsection{bla} \Lines8 \subsubsection{bla} \Lines2 \subsubsection{bla} \Lines4 \subsubsection{bla} \Lines2 \section{bla} \Lines{15} \Lines2 \section{bla} \Lines2 \Table9 \Lines2 \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/5faea8b4fa0adb143383811dc94f0d22.jpg?s=120&d=mm&r=g)
Hi Peter, I had noticed such strange page breaks before and since it was always in small documents (maths problem sheets), I used an elementary workaround which consists in adding a \medskip or \smallskip before every \section. Actually analogous bad page breaks happen in Plain TeX with \beginsection. Regarding the minimal example you sent, adding \setuphead[section][before=\smallskip] to the top of your document, solves the problem appearing in the first section. I don't know whether this solves all other strange page breaks or not. Best regards: OK On 6 mai 2010, at 10:13, Peter Münster wrote:
On Wed, May 05 2010, Wolfgang Schuster wrote:
The *strict prevents widows and orphans (comment \setuplayout in this example) but the important setting here is \setupalign[line].
Hello Wolfgang,
I know that \setupalign[line] means: last line should touch the bottom. It can be useful, but it's not always what I want.
Here an example from real life (not the content... ;). I hope you agree, that there should be done something in the default setup of ConTeXT:
%\setuplayout[setups=*strict] % this helps only in some cases... %\setupalign[line] % this means "flushbottom" and I don't always want that \def\Lines#1{\dorecurse{#1}{\dorecurse{17}{text }}\par} \def\Table#1{\starttable[|l|]\dorecurse{#1}{\NC bla \NC\AR}\stoptable} \showframe \starttext \completecontent \section{bla} \Lines{10} \Lines3 \section{bla} \Table9 \section{bla} \subsection{bla} \Lines2 \placetable[force][bla1]{bla}{\Table7} \Lines2 \subsection{bla} \Lines7 \placetable[force][bla2]{bla}{\Table{22}} \subsection{bla} \Lines2 \placefigure[force][bla3]{}{\framed[height=2cm]{bla}} \subsubsection{bla} \Lines8 \subsubsection{bla} \Lines2 \subsubsection{bla} \Lines4 \subsubsection{bla} \Lines2 \section{bla} \Lines{15} \Lines2 \section{bla} \Lines2 \Table9 \Lines2 \stoptext
Cheers, Peter
%%%%%%%%%%%%%%%%%% Otared Kavian Département de Mathématiques Université de Versailles Saint-Quentin Bâtiment Fermat 45 aveue des Etats Unis 78035 Versailles cedex Téléphone: +33 1 39 25 46 42 Secrétariat: +33 1 39 25 46 44 Secrétariat: +33 1 39 25 46 46 e-mail: Otared.Kavian@math.uvsq.fr
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 06.05.10 10:46, schrieb Otared Kavian:
Hi Peter,
I had noticed such strange page breaks before and since it was always in small documents (maths problem sheets), I used an elementary workaround which consists in adding a \medskip or \smallskip before every \section. Actually analogous bad page breaks happen in Plain TeX with \beginsection. Regarding the minimal example you sent, adding \setuphead[section][before=\smallskip] to the top of your document, solves the problem appearing in the first section. I don't know whether this solves all other strange page breaks or not.
You should at least keep the original space before the \section. \setuphead[section][before={\allowbreak\blank[2*big]}] The problem is indeed that ConTeXt tries to keep the header and the material before the header together and there is no real key to control this. What you can find in the core is this % \chardef\somestructureheadbreakmethod\plusone % 0=nothing, 1=weighted, 2=strict, 3=vspacing \chardef\somestructureheadbreakmethod\plusthree but that's not what i consider to be available for the user. Wolfgang
![](https://secure.gravatar.com/avatar/5faea8b4fa0adb143383811dc94f0d22.jpg?s=120&d=mm&r=g)
On 6 mai 2010, at 11:13, Wolfgang Schuster wrote:
Am 06.05.10 10:46, schrieb Otared Kavian:
Hi Peter,
I had noticed such strange page breaks before and since it was always in small documents (maths problem sheets), I used an elementary workaround which consists in adding a \medskip or \smallskip before every \section. Actually analogous bad page breaks happen in Plain TeX with \beginsection. Regarding the minimal example you sent, adding \setuphead[section][before=\smallskip] to the top of your document, solves the problem appearing in the first section. I don't know whether this solves all other strange page breaks or not.
You should at least keep the original space before the \section.
\setuphead[section][before={\allowbreak\blank[2*big]}]
Hi Wolfgang, Yes, indeed you are right: my point was that adding something before the section solves, sometimes such problems (I can't say why), but as you say one must, or it is wiser to, keep the original space around the \section.
The problem is indeed that ConTeXt tries to keep the header and the material before the header together and there is no real key to control this. What you can find in the core is this
% \chardef\somestructureheadbreakmethod\plusone % 0=nothing, 1=weighted, 2=strict, 3=vspacing \chardef\somestructureheadbreakmethod\plusthree
but that's not what i consider to be available for the user.
… well, at least not available for users such as me… But it is available for you :-) Best regards: OK
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 6-5-2010 11:33, Otared Kavian wrote:
On 6 mai 2010, at 11:13, Wolfgang Schuster wrote:
Am 06.05.10 10:46, schrieb Otared Kavian:
Hi Peter,
I had noticed such strange page breaks before and since it was always in small documents (maths problem sheets), I used an elementary workaround which consists in adding a \medskip or \smallskip before every \section. Actually analogous bad page breaks happen in Plain TeX with \beginsection. Regarding the minimal example you sent, adding \setuphead[section][before=\smallskip] to the top of your document, solves the problem appearing in the first section. I don't know whether this solves all other strange page breaks or not.
You should at least keep the original space before the \section.
\setuphead[section][before={\allowbreak\blank[2*big]}]
{\testpage[5]\blank[2*big]} this will make sure that at least there are 5 line equivalents of text. (I want to integrate that in the spacing code.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Thu, May 06 2010, Hans Hagen wrote:
\setuphead[section][before={\allowbreak\blank[2*big]}]
{\testpage[5]\blank[2*big]}
Hello Hans, When you take my example from this morning, then you'll see, that \allowbreak really helps, whereas \testpage[5] only helps in some cases. Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 06.05.10 12:09, schrieb Peter Münster:
On Thu, May 06 2010, Hans Hagen wrote:
\setuphead[section][before={\allowbreak\blank[2*big]}]
{\testpage[5]\blank[2*big]}
Hello Hans,
When you take my example from this morning, then you'll see, that \allowbreak really helps, whereas \testpage[5] only helps in some cases.
MkIV has a 'preference' option for \blank but it does not work for me. \setuphead[section][before={\blank[preference,2*big]}] Wolfgang
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 6-5-2010 12:09, Peter Münster wrote:
On Thu, May 06 2010, Hans Hagen wrote:
\setuphead[section][before={\allowbreak\blank[2*big]}]
{\testpage[5]\blank[2*big]}
Hello Hans,
When you take my example from this morning, then you'll see, that \allowbreak really helps, whereas \testpage[5] only helps in some cases.
yes but allowbreak introduces a penalty node that can interfere with spacing (as taco explained, it's all related to tex not being that clever in breaking pages and there is no 100% robust way to predict and calculate such situations) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Thu, May 06 2010, Hans Hagen wrote:
When you take my example from this morning, then you'll see, that \allowbreak really helps, whereas \testpage[5] only helps in some cases.
yes but allowbreak introduces a penalty node that can interfere with spacing
Anyway, I don't consider \allowbreak a solution, rather a work-around. Should I put this issue on the tracker? Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 6-5-2010 1:17, Peter Münster wrote:
On Thu, May 06 2010, Hans Hagen wrote:
When you take my example from this morning, then you'll see, that \allowbreak really helps, whereas \testpage[5] only helps in some cases.
yes but allowbreak introduces a penalty node that can interfere with spacing
Anyway, I don't consider \allowbreak a solution, rather a work-around. Should I put this issue on the tracker?
as long term issue ok, as it has to wait till we've opened up the par builder in luatex Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Thu, May 06 2010, Wolfgang Schuster wrote:
\setuphead[section][before={\allowbreak\blank[2*big]}]
Thanks for this workaround!
The problem is indeed that ConTeXt tries to keep the header and the material before the header together
And does this make sense? Keeping header and the material after the header together *does* make sense, but not the material *before*. Thanks for your investigations! Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
participants (6)
-
Hans Hagen
-
luigi scarso
-
Otared Kavian
-
Peter Münster
-
Taco Hoekwater
-
Wolfgang Schuster