[NTG-context] Chapter endings

2013-11-10 Thread Francisco Gracia
This is a disclaimer to my former message about this subject.

I continued considering the solution to the problem of using *fleurons* in
a document via the suggested *\leaders* command and it turned out to be a
dead end for the following reasons:

1) it acts wrongly if the page in which the *fleuron* is to appear has
a lot of blank space availabe, as the following test code demonstrates:

\setuplayout[lines=30]

\def\Fleuron
{\par
\leaders\vbox to \lineheight{\midaligned{Finis\\coronat\\opus}}\vfil}
\starttext

\dorecurse{32}{Line \recurselevel\par}

\Fleuron

\stoptext

where the intended *fleuron* appears superposed several times instead of
the only one desired;

2) the use of such an instruction is touchy and not dependable. As I
have experienced, things work satisfactorily or not according to the degree
of nesting of the command *\fleuron* in the whole launching command and
possibly according to many other unnoticed factors;

3) the suggested formulation does not allow enough control for the
placement of the *fleuron* in the final document.

In the end all this seems reasonable: the straigth use of the *\leaders*
command  is almost the contrary of the one demanded for the present
functionality. The effect of the (obscure in more than one sense) *Tex*
command *\leaders* is to fill a (rather implicitly defined) surface with
repeated copies of a certain motive. The visibility or not of the result
according to the surrounding text or space in the page has to be considered
therefore as a purely accidental (and noxious) side effect. The content
typesett via *\leaders* is not supposed in any way to disappear when
following lines are added.

I conclude that the only lawful use of *\leaders* in the true context of
*fleurons* would be for the generation of certain repetitive motives (for
instance a kind of small checkered board), but this is only a hint; I have
not explored this possibility.

Fortunately I have been able to advance in another direction and to get
what seems to me a consistent solution to the original problem. I open the
new thread *Using *fleurons** for explaining it more fully.

Regards

Francisco
___
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
___

Re: [NTG-context] Chapter endings

2013-11-10 Thread Wolfgang Schuster


   	   
   	Francisco Gracia  
  10. November 2013
 16:07
  This is a 
disclaimer to my former message about this subject.I continued 
considering the solution to the problem of using *fleurons* in a 
document via the suggested *\leaders* command and it turned out to be a 
dead end for the following reasons:
 1) it acts wrongly if the page in which the *fleuron* is to 
appear has a lot of blank space availabe, as the following test code 
demonstrates:\setuplayout[lines=30]\def\Fleuron{\par\leaders\vbox
 to \lineheight{\midaligned{Finis\\coronat\\opus}}\vfil} \starttext
\dorecurse{32}{Line \recurselevel\par}\Fleuron\stoptextwhere
 the intended *fleuron* appears superposed several times instead of the 
only one desired;

You can avoid this when you limit the space for the leaders command.

\unexpanded\def\Fleuron
 {\par
 \begingroup
 \setupalign[middle]%
 \dowithnextbox
 {\scratchdimen\htdp\nextbox
  \cleaders\box\nextbox\vskip\dimexpr\scratchdimen+\lineheight\relax
  \endgroup}
 \vbox}

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
___

Re: [NTG-context] Chapter endings

2013-11-04 Thread Hans Hagen

On 11/4/2013 1:37 AM, Wolfgang Schuster wrote:


Am 02.11.2013 um 21:54 schrieb Francisco Gracia fgragu...@gmail.com:


There is plenty of information available about how to deal with issues related 
to chapter openings (*headings*) in *Context* but I have not found any related 
to document endings.

I would like to end the chapters of a book with some small decorative element, 
be it text or graphics; let us call it a *Fleuron*. Just putting it in the last 
line of the text file to be typeset, one can take for sure that earlier or 
later it will end appearing as the only element of the last page of the product 
of some run. To avoid this undesirable outcome, it seems to me that one is 
forced to provide some help to *Context* via some text marks or some code, but 
I have not been able to conjecture what they should be.

The clearest arrangement would seem to be the inclusion at the end of the 
source document of some *Context* instructions equivalent to the following 
pseudocode:

 if *Fleuron* fits into the current page:
 typeset *Fleuron*

But how do I formulate the condition? How do I know what is the *current page*, 
what is the size that *Context* has calculated for *Fleuron* and what is the 
amount of space remaining in the page?

One can imagine that this method could even be helpful in other situations of 
the typesetting operation not related to the last page.

Does someone know how to handle it?



You can use leaders to place a box with the symbols/ornament because the 
disappear when they are placed at the begin of a page.


A real nice trick /solution!


\def\Fleuron
   {\par
\leaders\vbox to \lineheight{MIDDLE OF THE PAGE}\vfil}

\setuplayout[lines=10]

\starttext

% Method 1

\dorecurse{5}{Line \recurselevel\par}

\Fleuron

\page

\dorecurse{10}{Line \recurselevel\par}

\Fleuron

\page

\dorecurse{5}{Line \recurselevel\par}

\Fleuron

\stoptext

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
___




--

-
  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
___


[NTG-context] Chapter endings

2013-11-04 Thread Francisco Gracia
Many thanks, Wolfgang, for your quick and complete solution to my riddle.
As Hans has commented, it is really brilliant.

I must confess that I do not understand yet the substance of it, i.e. the
definition itself of *Fleuron*, but I will keep studying it and will end
for getting it, I hope.

For the moment I have analyzed and elaborated a bit on your example, first
and mostly by commenting it, but also by slightly modifying it so that it
shows more clearly the characteristics of your solution. I attach it here
just in case it could be as helpful for someone else as it has been for me.

Many thanks again and good luck!

Francisco

% Fleuron.tex

% Example script of the creation and use of a documental ornament


% We first define the documental ornament

% under the traditional name of *Fleuron*

% in the way brilliantly formulated by Herr Schuster

\def\Fleuron

{\par

\leaders\vbox to \lineheight{I am the \em Fleuron\em}\vfil}


% and create a page 10 lines high for testing its behaviour

\setuplayout[lines=10]


% We put *Context* to work

\starttext


% Method 1 (really?)


% Typesetting the ornament as the first element of the page

% results disappointing: it just does not show up

\Fleuron


% but other texts that follow it get their normal treatment;

% for instance, this sentence

I am not really the start:\par

\ \ \ the \em Fleuron\em\ went before me\par

% or this automatically generated text

\dorecurse{4}{Line \recurselevel\par}


% Even the *Fleuron* is treated the same,

% if it is the last element of this page

\Fleuron


% so we create a new page and repeat the same

% instructions

\page

I am not really the start:\par

\ \ \ the \em Fleuron\em\ went before me\par

\dorecurse{4}{Line \recurselevel\par}

\Fleuron

I am after the \em Fleuron\em\

% surprisingly, although there is room available,

% the ornament disappears

% if there is more text coming after it


% so we go to another page, the third one,

% for our last and definitive test

\page


% This time the space of the page is full

\dorecurse{10}{Line \recurselevel\par}

% when the turn of the *Fleuron* arrives

\Fleuron


% The result is that not only the *Fleuron* does not show up

% in this page, which was to be expected because it is full,

% but even the implied next page, the fourth,

% does not get generated by *Context*. PERFECT!



\stoptext
___
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
___

Re: [NTG-context] Chapter endings

2013-11-03 Thread Wolfgang Schuster

Am 02.11.2013 um 21:54 schrieb Francisco Gracia fgragu...@gmail.com:

 There is plenty of information available about how to deal with issues 
 related to chapter openings (*headings*) in *Context* but I have not found 
 any related to document endings.
 
 I would like to end the chapters of a book with some small decorative 
 element, be it text or graphics; let us call it a *Fleuron*. Just putting it 
 in the last line of the text file to be typeset, one can take for sure that 
 earlier or later it will end appearing as the only element of the last page 
 of the product of some run. To avoid this undesirable outcome, it seems to me 
 that one is forced to provide some help to *Context* via some text marks or 
 some code, but I have not been able to conjecture what they should be.
 
 The clearest arrangement would seem to be the inclusion at the end of the 
 source document of some *Context* instructions equivalent to the following 
 pseudocode:
 
 if *Fleuron* fits into the current page:
 typeset *Fleuron*
 
 But how do I formulate the condition? How do I know what is the *current 
 page*, what is the size that *Context* has calculated for *Fleuron* and what 
 is the amount of space remaining in the page?
 
 One can imagine that this method could even be helpful in other situations of 
 the typesetting operation not related to the last page.
 
 Does someone know how to handle it?


You can use leaders to place a box with the symbols/ornament because the 
disappear when they are placed at the begin of a page.

\def\Fleuron
  {\par
   \leaders\vbox to \lineheight{MIDDLE OF THE PAGE}\vfil}

\setuplayout[lines=10]  

\starttext

% Method 1

\dorecurse{5}{Line \recurselevel\par}

\Fleuron

\page

\dorecurse{10}{Line \recurselevel\par}

\Fleuron

\page

\dorecurse{5}{Line \recurselevel\par}

\Fleuron

\stoptext

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
___