ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* page breaks before titles
@ 2015-03-06 23:46 mf
  2015-03-07 10:05 ` Wolfgang Schuster
  2015-03-07 11:24 ` Pablo Rodriguez
  0 siblings, 2 replies; 4+ messages in thread
From: mf @ 2015-03-06 23:46 UTC (permalink / raw)
  To: ntg-context

Hello,
I'm trying to typeset a book made of letters with ConTeXt.
Every letter has a title a subtitle and a date, before it
starts with "Dear ..."
Like this:
---------------------------------
          Title
         subtitle
                    where, when
Dear ...,
the rest of the letter
...                 
---------------------------------

The letters are very different in length -- some are long,
some are made of a couple of lines --, so I'd like to
typeset them continuously, without skipping to a new page
every new letter (\setuphead[LetterTitle][page=no]).

This way a letter could finish beyond the half of a page,
and the next one could have no space left to get the part
from Title to the first lines of the body on the same page.

That's why I disabled page breaks from Title to the first
paragraph after "Dear ...": it would be ugly having only
the title in one page and the rest in the next ones.

But there's a side effect: the title of the new letter
"pulls" the last two lines (the penalties are set to avoid
one-line widows) of the previous letter to the new page,
even when there's room for them on the previous page.
In this case I would like ConTeXt to break the page at
the end of the previous letter, before the next letter title.
That's why I've set 
  before={\blank[2*line]\page[preference]} 
in LetterTitle. But it does not work.
Example:
         ---------------------       ---------------------
         text of the previous        text of the previous 
         letter with room to be      letter with room to be
         all typeset here            all typeset here
page 11                              last two lines of the
         [room for >2 lines]         the previous letter

page break-------------------   ==>  -------------------
         last two lines of the             Title
         the previous letter             subtitle
                                     ...
page 12       Title
            subtitle 
         ...

         --------------------        --------------------

Is there a way to know the vertical location where the
previous letter ends, to decide whether to skip to a new
page?

Thanks in advance,
Massi



___________________________________________________________________________________
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] 4+ messages in thread

* Re: page breaks before titles
  2015-03-06 23:46 page breaks before titles mf
@ 2015-03-07 10:05 ` Wolfgang Schuster
  2015-03-07 12:28   ` mf
  2015-03-07 11:24 ` Pablo Rodriguez
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2015-03-07 10:05 UTC (permalink / raw)
  To: massifr, mailing list for ConTeXt users


> Am 07.03.2015 um 00:46 schrieb mf <massifr@fastwebnet.it>:
> 
> Hello,
> I'm trying to typeset a book made of letters with ConTeXt.
> Every letter has a title a subtitle and a date, before it
> starts with "Dear ..."
> Like this:
> ---------------------------------
>          Title
>         subtitle
>                    where, when
> Dear ...,
> the rest of the letter
> ...                 
> ---------------------------------
> 
> The letters are very different in length -- some are long,
> some are made of a couple of lines --, so I'd like to
> typeset them continuously, without skipping to a new page
> every new letter (\setuphead[LetterTitle][page=no]).
> 
> This way a letter could finish beyond the half of a page,
> and the next one could have no space left to get the part
> from Title to the first lines of the body on the same page.
> 
> That's why I disabled page breaks from Title to the first
> paragraph after "Dear ...": it would be ugly having only
> the title in one page and the rest in the next ones.
> 
> But there's a side effect: the title of the new letter
> "pulls" the last two lines (the penalties are set to avoid
> one-line widows) of the previous letter to the new page,
> even when there's room for them on the previous page.
> In this case I would like ConTeXt to break the page at
> the end of the previous letter, before the next letter title.
> That's why I've set 
>  before={\blank[2*line]\page[preference]} 
> in LetterTitle. But it does not work.
> Example:
>         ---------------------       ---------------------
>         text of the previous        text of the previous 
>         letter with room to be      letter with room to be
>         all typeset here            all typeset here
> page 11                              last two lines of the
>         [room for >2 lines]         the previous letter
> 
> page break-------------------   ==>  -------------------
>         last two lines of the             Title
>         the previous letter             subtitle
>                                     ...
> page 12       Title
>            subtitle 
>         ...
> 
>         --------------------        --------------------
> 
> Is there a way to know the vertical location where the
> previous letter ends, to decide whether to skip to a new
> page?

You can use the \testpage command where you can set how many
lines should remain on the page before a page breaks happens.

\setuphead[LetterTitle][before={\testpage[8]\blank[2*line]}]

If this doesn’t help you should make a *working* minimal example.

Wolfgang
___________________________________________________________________________________
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] 4+ messages in thread

* Re: page breaks before titles
  2015-03-06 23:46 page breaks before titles mf
  2015-03-07 10:05 ` Wolfgang Schuster
@ 2015-03-07 11:24 ` Pablo Rodriguez
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Rodriguez @ 2015-03-07 11:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 03/07/2015 12:46 AM, mf wrote:
> Hello,
> I'm trying to typeset a book made of letters with ConTeXt.
> Every letter has a title a subtitle and a date, before it
> starts with "Dear ..."
> Like this:
> ---------------------------------
>           Title
>          subtitle
>                     where, when
> Dear ...,
> the rest of the letter
> ...                 
> ---------------------------------
> 
> The letters are very different in length -- some are long,
> some are made of a couple of lines --, so I'd like to
> typeset them continuously, without skipping to a new page
> every new letter (\setuphead[LetterTitle][page=no]).
> 
> This way a letter could finish beyond the half of a page,
> and the next one could have no space left to get the part
> from Title to the first lines of the body on the same page.
> 
> That's why I disabled page breaks from Title to the first
> paragraph after "Dear ...": it would be ugly having only
> the title in one page and the rest in the next ones.
> 
> But there's a side effect: the title of the new letter
> "pulls" the last two lines (the penalties are set to avoid
> one-line widows) of the previous letter to the new page,
> even when there's room for them on the previous page.
> In this case I would like ConTeXt to break the page at
> the end of the previous letter, before the next letter title.
> That's why I've set 
>   before={\blank[2*line]\page[preference]} 
> in LetterTitle. But it does not work.

Hi Massi,

how about "before={\blank[2*line]\page[bigpreference]}"?

As Wolgang noted before, a minimal sample is essential to be able to
provide a solution.


Pablo
-- 
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] 4+ messages in thread

* Re: page breaks before titles
  2015-03-07 10:05 ` Wolfgang Schuster
@ 2015-03-07 12:28   ` mf
  0 siblings, 0 replies; 4+ messages in thread
From: mf @ 2015-03-07 12:28 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


> You can use the \testpage command where you can set how many
> lines should remain on the page before a page breaks happens.
> 
> \setuphead[LetterTitle][before={\testpage[8]\blank[2*line]}]
> 
> If this doesn’t help you should make a *working* minimal example.
> 
> Wolfgang

Thanks Wolfgang (and Pablo),
\testpage[lines] solved the problem.

Massi

___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2015-03-07 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 23:46 page breaks before titles mf
2015-03-07 10:05 ` Wolfgang Schuster
2015-03-07 12:28   ` mf
2015-03-07 11:24 ` Pablo Rodriguez

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).