ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* sections
@ 2014-06-01 11:51 Hans Hagen
  2014-06-01 15:40 ` sections Rik
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hans Hagen @ 2014-06-01 11:51 UTC (permalink / raw)
  To: Pablo Rodriguez, mailing list for ConTeXt users

Hi Pablo,

The section breaks are a bit of a headache. In the old mechanism (also 
mkii) we used penalties between different section levels (different 
values so that there is some hierarchy).

In mkiv we have a weighted penalty/glue mechanism which has advantages 
but can also create side effects. The method of a few weeks ago coul 
deal with

\section followed by 100 \subsections

i.e. no text between this. In a strict mechanism you end up with one 
long page fur to all the penalties. So, there was some precaution for 
this. However that didn't work well with content following sections that 
prefers breaks (read: section head followed by e.g. itemize or tabulate).

So, the newer mechanism tries to analyze the page stream which 
(currently) is somewhat tricky. That's why we need to iterate to an 
acceptable solution.

Some of these mkiv mechanisms are already a bit old and could be done 
better using some newer luatex trickery (but i need tome to do that).

It would be nice to have a large test case for this (sort of hard to 
make one as some trial and error is involved). As you already have some, 
best collect them for future reference.

A new beta ...

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sections
  2014-06-01 11:51 sections Hans Hagen
@ 2014-06-01 15:40 ` Rik
  2014-06-01 16:52   ` sections Hans Hagen
  2014-06-01 17:54 ` sections Pablo Rodriguez
  2014-06-01 18:18 ` sections Pablo Rodriguez
  2 siblings, 1 reply; 6+ messages in thread
From: Rik @ 2014-06-01 15:40 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 5436 bytes --]

On 2014-06-01 07:51, Hans Hagen wrote:
> Hi Pablo,
>
> The section breaks are a bit of a headache. In the old mechanism (also 
> mkii) we used penalties between different section levels (different 
> values so that there is some hierarchy).
>
> In mkiv we have a weighted penalty/glue mechanism which has advantages 
> but can also create side effects. The method of a few weeks ago coul 
> deal with
>
> \section followed by 100 \subsections
>
> i.e. no text between this. In a strict mechanism you end up with one 
> long page fur to all the penalties. So, there was some precaution for 
> this. However that didn't work well with content following sections 
> that prefers breaks (read: section head followed by e.g. itemize or 
> tabulate).
>
> So, the newer mechanism tries to analyze the page stream which 
> (currently) is somewhat tricky. That's why we need to iterate to an 
> acceptable solution.
>
> Some of these mkiv mechanisms are already a bit old and could be done 
> better using some newer luatex trickery (but i need tome to do that).
>
> It would be nice to have a large test case for this (sort of hard to 
> make one as some trial and error is involved). As you already have 
> some, best collect them for future reference.
>
> A new beta ...
>
> Hans
>
Hans,

Is this also the cause of problems I noted with heading placed into the 
margin, as in the example below?

    %   Extra whitespace after some marginal section headings
    %
    %   When section heads are set in the margin, the following body
    %   text should start on the same line as the heading. This is
    %   the case with plain text, but not always the case with other
    %   features (floats and enumerations). Wolfgang suggested adding
    %   insidesection={blank[overlay]} to the section heading setup, but
    %   that only helps with enumerations and with tabulate tables that do
    %   not start with an HL (it fails with natural tables as well). And
    %   that success only comes with start/stop sectioning. With traditional
    %   sectioning, there are more failures.
    %
    %
           \setupexternalfigures[location=default]
           \setuphead
             [section]
             [alternative=text,
              command=\SectionCommand,
              distance=0pt,
              insidesection={\blank[overlay]},
             ]

           \define[2]\SectionCommand
             {\inmargin{#1 -- #2}}

           \setuplayout[backspace=4cm]

           \starttext
           \startchapter[title={Start/Stop sectioning}]
           \startsection[title={Okay with text first}]

           Text here
           \starttabulate
           \FL \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate

           \stopsection
           \startsection[title={Okay with itemize}]

           \startitemize
           \item One
           \item Two
           \item Three
           \stopitemize

           \stopsection
           \startsection[title={Okay with tabulate no HL}]

           \starttabulate
           \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate

           \page
           \stopsection
           \startsection[title={Fail with tabulate HL}]

           \starttabulate
           \FL \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate
           \stopsection
           \startsection[title={Fail with TABLE frame}]

           \bTABLE
           \bTR \bTD Knuth \eTD\bTD \input{knuth} \eTD\eTR
           \eTABLE

           \stopsection
           \startsection[title={Fail with TABLE no frame}]

           \bTABLE[frame=off]
           \bTR \bTD Knuth \eTD\bTD \input{knuth} \eTD\eTR
           \eTABLE

           \page
           \stopsection
           \startsection[title={Fails with figures}]

    \startplacefigure[location=right,reference={fig:2},title={Caption}]
             \externalfigure[cow.pdf][width=2cm]
           \stopplacefigure

           \input{tufte}

           \stopsection
           \stopchapter

           \chapter{Traditional sectioning}

           \section{Okay with text first}

           Text here
           \starttabulate
           \FL \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate

           \section{Fail with itemize}

           \startitemize
           \item One
           \item Two
           \item Three
           \stopitemize

           \page
           \section{Fail with tabulate no HL}

           \starttabulate
           \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate

           \section{Fail with tabulate HL}

           \starttabulate
           \FL \NC Knuth \NC \input{knuth} \NC\NR
           \stoptabulate

           \section{Fail with TABLE frame}

           \bTABLE
           \bTR \bTD Knuth \eTD\bTD \input{knuth} \eTD\eTR
           \eTABLE

           \section{Fail with TABLE no frame}

           \bTABLE[frame=off]
           \bTR \bTD Knuth \eTD\bTD \input{knuth} \eTD\eTR
           \eTABLE

           \page
           \section[title={Fails with figures startstop}]

    \startplacefigure[location=right,reference={fig:2},title={Caption}]
             \externalfigure[cow.pdf][width=2cm]
           \stopplacefigure

           \input{tufte}

           \section[title={Fails with figures traditional}]

           \placefigure[right][fig:2]{Caption}
             {\externalfigure[cow.pdf][width=2cm]}

           \input{tufte}

           \stoptext

    -- 
    Rik Kabel


[-- Attachment #1.2: Type: text/html, Size: 11227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sections
  2014-06-01 15:40 ` sections Rik
@ 2014-06-01 16:52   ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2014-06-01 16:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 6/1/2014 5:40 PM, Rik wrote:

> Is this also the cause of problems I noted with heading placed into the
> margin, as in the example below?

no, unrelated, try this:

\setuphead
   [section]
   [after={\strut\blank[-2*line,samepage,disable]},
    command=\SectionCommand,
    distance=0pt]

\define[2]\SectionCommand{\inleft{XXXXXX}}


-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sections
  2014-06-01 11:51 sections Hans Hagen
  2014-06-01 15:40 ` sections Rik
@ 2014-06-01 17:54 ` Pablo Rodriguez
  2014-06-01 18:18 ` sections Pablo Rodriguez
  2 siblings, 0 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2014-06-01 17:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

many thanks for your explanation and sorry for the trouble.

I created the test case that only contains three issues related to page
breaks.

Many thanks for the new beta, I’m afraid I’m still experiencing issues.

    \showframe\showgrid
    \setupbodyfont[pagella,15pt]
    \starttext
    \dorecurse{100}{This is a sentence. }

    \startitemize
    \dorecurse{3}{\item This is an item.\par}
    \stopitemize
    \stoptext

Previous beta located two items on the first page. Latest beta locates
only one. But when items are higher than two, the first item disappears
from the first page in the second run.

And my first sample works fine with the new beta, but not with the real
book. I’ll try to get a new sample.

Many thanks for your help again,


Pablo.


On 06/01/2014 01:51 PM, Hans Hagen wrote:
> Hi Pablo,
> 
> The section breaks are a bit of a headache. In the old mechanism (also 
> mkii) we used penalties between different section levels (different 
> values so that there is some hierarchy).
> 
> In mkiv we have a weighted penalty/glue mechanism which has advantages 
> but can also create side effects. The method of a few weeks ago could 
> deal with
> 
> \section followed by 100 \subsections
> 
> i.e. no text between this. In a strict mechanism you end up with one 
> long page fur to all the penalties. So, there was some precaution for 
> this. However that didn't work well with content following sections that 
> prefers breaks (read: section head followed by e.g. itemize or tabulate).
> 
> So, the newer mechanism tries to analyze the page stream which 
> (currently) is somewhat tricky. That's why we need to iterate to an 
> acceptable solution.
> 
> Some of these mkiv mechanisms are already a bit old and could be done 
> better using some newer luatex trickery (but i need tome to do that).
> 
> It would be nice to have a large test case for this (sort of hard to 
> make one as some trial and error is involved). As you already have some, 
> best collect them for future reference.
> 
> A new beta ...
> 
> Hans


-- 
http://www.ousia.tk
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sections
  2014-06-01 11:51 sections Hans Hagen
  2014-06-01 15:40 ` sections Rik
  2014-06-01 17:54 ` sections Pablo Rodriguez
@ 2014-06-01 18:18 ` Pablo Rodriguez
  2014-06-01 21:15   ` sections Hans Hagen
  2 siblings, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2014-06-01 18:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

I found out that the issue I wrote about in my previous message is about
widow and orphan lines.

Here is the sample:

    \showframe\showgrid
    \setuplayout[setups=*lessstrict]
    \startsetups[*lessstrict]
        \setup[reset]
        \widowpenalty=10000
        \clubpenalty=10000
    \stopsetups
    \setupbodyfont[pagella,15pt]
    \starttext
    \chapter{Chapter}
    \section{Section}
    \dorecurse{103}{\ConTeXt\ is fun! }

    \subsection{Subsection}

    \ConTeXt\ is fun!
    \stoptext

Many thanks for your excellent work,

Pablo



On 06/01/2014 01:51 PM, Hans Hagen wrote:
> Hi Pablo,
> 
> The section breaks are a bit of a headache. In the old mechanism (also 
> mkii) we used penalties between different section levels (different 
> values so that there is some hierarchy).
> 
> In mkiv we have a weighted penalty/glue mechanism which has advantages 
> but can also create side effects. The method of a few weeks ago coul 
> deal with
> 
> \section followed by 100 \subsections
> 
> i.e. no text between this. In a strict mechanism you end up with one 
> long page fur to all the penalties. So, there was some precaution for 
> this. However that didn't work well with content following sections that 
> prefers breaks (read: section head followed by e.g. itemize or tabulate).
> 
> So, the newer mechanism tries to analyze the page stream which 
> (currently) is somewhat tricky. That's why we need to iterate to an 
> acceptable solution.
> 
> Some of these mkiv mechanisms are already a bit old and could be done 
> better using some newer luatex trickery (but i need tome to do that).
> 
> It would be nice to have a large test case for this (sort of hard to 
> make one as some trial and error is involved). As you already have some, 
> best collect them for future reference.
> 
> A new beta ...
> 
> Hans


-- 
http://www.ousia.tk
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: sections
  2014-06-01 18:18 ` sections Pablo Rodriguez
@ 2014-06-01 21:15   ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2014-06-01 21:15 UTC (permalink / raw)
  To: ntg-context

On 6/1/2014 8:18 PM, Pablo Rodriguez wrote:
> Hi Hans,
>
> I found out that the issue I wrote about in my previous message is about
> widow and orphan lines.

indeed, when testing setting them to 0 helps (there are more cases when 
such penalties interfere, idem for (ex)hyphenpenalty)

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-01 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 11:51 sections Hans Hagen
2014-06-01 15:40 ` sections Rik
2014-06-01 16:52   ` sections Hans Hagen
2014-06-01 17:54 ` sections Pablo Rodriguez
2014-06-01 18:18 ` sections Pablo Rodriguez
2014-06-01 21:15   ` sections Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).