From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85184 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Using *fleurons* Date: Sun, 10 Nov 2013 19:56:56 +0100 Message-ID: <527FD6F8.4010504@gmail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1429261518==" X-Trace: ger.gmane.org 1384109843 29613 80.91.229.3 (10 Nov 2013 18:57:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Nov 2013 18:57:23 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Nov 10 19:57:29 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VfaCO-0000Jn-Te for gctc-ntg-context-518@m.gmane.org; Sun, 10 Nov 2013 19:57:29 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3730F101E5; Sun, 10 Nov 2013 19:57:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id C1q2E5wuglwE; Sun, 10 Nov 2013 19:57:22 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 6096E101F6; Sun, 10 Nov 2013 19:57:22 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A08AC101F6 for ; Sun, 10 Nov 2013 19:57:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id P0RitFPp4m3v for ; Sun, 10 Nov 2013 19:57:17 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id 4EC48101E5 for ; Sun, 10 Nov 2013 19:57:17 +0100 (CET) Original-Received: from mail-bk0-x22f.google.com (mail-bk0-x22f.google.com [IPv6:2a00:1450:4008:c01::22f]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rAAIvDdt010589 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 10 Nov 2013 19:57:14 +0100 Original-Received: by mail-bk0-f47.google.com with SMTP id v11so973074bkz.20 for ; Sun, 10 Nov 2013 10:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=hadRRGbJQYPTOsbnq6XAwupBKI+8SjsPrEVxwmLe7Fk=; b=09YIEFX6Zch9L+d930jHsMU0ZOX5bvkuF/BJuYtYZPHoUGe+7CXtTWY/gSq9j1z8pm JUkr6DNws51EtYb3lVWBdMka34eMMgwb6enSOkn9VzDGLfo9yC5gNiURhtd5Y9YeBPs1 4Y5vjbu6gdO9VFMojHaIdh+mlCi0nKMoZYKHcwTtSb3v7vcqron2S+ld+p8uzpEKrvB7 9MRv/ceCchFE/WO+1TbIdnBhqP+eBnCKBb5w8E86Y6MzIHcd4t6+DLXWh4NIPb32USc+ b0NxKqHeFJAO1ZkqaYs1r1hvNpluNo9bn8bn5ooYMC9ggF1V+77rdgms5KEQTlDD6Zmi HCpQ== X-Received: by 10.204.117.3 with SMTP id o3mr197531bkq.38.1384109833524; Sun, 10 Nov 2013 10:57:13 -0800 (PST) Original-Received: from keima.localdomain (x2f24aac.dyn.telefonica.de. [2.242.74.172]) by mx.google.com with ESMTPSA id pk7sm11961278bkb.2.2013.11.10.10.57.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 Nov 2013 10:57:12 -0800 (PST) User-Agent: Postbox 3.0.8 (Macintosh/20130427) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:4008:c01::22f; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0WKLSVdp1 - 31c264d79afb - 20131110 X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:85184 Archived-At: This is a multi-part message in MIME format. --===============1429261518== Content-Type: multipart/alternative; boundary="------------010304070003060909030109" This is a multi-part message in MIME format. --------------010304070003060909030109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable > Francisco Gracia > 10. November 2013 16:12 > *Fleurons* are small decorative pieces that were often used in the=20 > past for filling big blank spaces in books. They are seldom used=20 > nowdays. As besides they will not appear more than a few times in any=20 > book (mainly at the end of chapters), the easiest thing to do if one=20 > insists in using them (for instance for simulating an old edition of=20 > some past work) is to arrange its presence manually in the source=20 > document in the way one would do for any other figure or piece of text. > > I subscribe to this, which is without doubt the way to proceed if the=20 > original document will allways be typesett in the same way. But if it=20 > were an extensive work and one foresees different layouts for its=20 > appearence as different *products*, then one would have one more=20 > source of worries after every run of the work through *Context*, as=20 > you can bet that sooner than later one page will have been included=20 > somewhere whose only content will be the damned *fleuron*, something=20 > that obviously should not happen. > > This is the problem that I tackled, because I did not find any=20 > previous reference or solution to it. My reasoning, my explanations=20 > and the working code are all contained in the rest of this message. > > It is conceived as being composed of two parts, but it can also be=20 > saved and dealt as one piece. If one saves it as two independent files=20 > (as should be done if one intends to use it for any other thing that=20 > running the tests samples) the content of the first file will be the=20 > one delimited as *Fleuron.tex* and that of the second=20 > (*Fleuron_test.tex*) would be the rest of the message. The line of=20 > this second file > > % \input {Fleuron} > > should be uncommented if one intends to run it as such. The one file=20 > version runs as it is. > > The script creates the new command *\Fleuron{\}*, which=20 > is the one to include at the place intended in the source document for=20 > the *fleuron* to appear (of course after having incorporated the=20 > contents of *Fleuron.tex* in its preamble with *\input{Fleuron}*). The=20 > argument ** allows the selection of a specific motive=20 > among the several of them that could be available; the user can create=20 > and organize all this according to his wishes. For instance=20 > *\Fleuron{\MotiveFive}* would use the example labelled *\MotiveFive*=20 > in the group of examples provided. The comments in *Fleuron.tex*=20 > explain how to handle all this. > > Enjoy and critizice > > Francisco > > %%%%%%%%%%%%%%%%%%%%%%% > % > % Fleuron.tex > % Script that explains and implements in *ConTeXt* Mk-IV the kind of=20 > small ornaments > % traditionally used by printers for filling big blank spaces in books=20 > and printed works. > > %*Fleuron*: subst. masc. 2b) =C9l=E9ment d=E9coratif de fantaisie ornan= t le=20 > titre ou les blancs des principales divisions d'un ouvrage [livre]=20 > (Tr=E9sor de la langue fran=E7aise informatis=E9). > % > %%%%%%%%%%%%%%%%%%%%%%%%%%% > > % Creation of the ornament as an entity (in the form of a box) > > % Typesetting true *fleurons* requires the use of *TeX*'s special *box=20 > registers* as arguments; > % here box register number *0* has been arbitrarily selected for the=20 > proceedings. > % The essential steps in the construction are: > % - (typo)graphical composition of the motive (as for instance=20 > *\midaligned{Finis}* in the first example) > % or designation of the source file of an image, > % - enclosure of it in a vertical box (*\vbox{\midaligned{Finis}}*) = and > % - finally association of the boxed motive with boxregister *0*=20 > (*\setbox0=3D ...*), all of which happens > % in reverse order, from right to left, in the code. > % Here are several examples of this: > %\setbox0=3D\vbox{\midaligned{Finis}} > %\setbox0=3D\vbox{\midaligned{Finis\\coronat\\opus}} > %\setbox0=3D\vbox{\midaligned{*****} \Inter \midaligned{***} \Inter=20 > \midaligned{*}} > > % In order to get in *TeX* something remotely similar to a normal=20 > variable, > % called *Motivo*, the following machinery has to be implemented > \def\Motivo{\copy0} % get a copy of register's *0* content > > % the graphic parts of several (typographical) test motives follow: > \def\MotOne{{\midaligned{\em Finis}}} > \def\MotTwo{{\midaligned{\em Finis\\\em coronat\\\em opus}}} > \def\MotThree{{\midaligned{*****} \Inter \midaligned{***} \Inter=20 > \midaligned{*}}} > \def\MotFour{{\midaligned{___________}}} > \def\MotFive{{\bf \midaligned{\hl[1]} \Inter \midaligned{\hl[5]}=20 > \Inter \midaligned{\hl[1]}}} > > %%%%%%%%%%%%%%%%%%%%%%%%% > % > % THINGS THAT DO NOT WORK > % > %\setbox0=3D\vbox{\midaligned{\switchtobodyfont[20pt]*}} % executing= =20 > these corrupt the whole script > %\setbox0=3D\vbox{\switchtobodyfont[20pt] \midaligned{*****\\***\\*}} > %\def\Grande{\midaligned{\switchtobodyfont[50pt]*}} % in any=20 > form it is tried > %\setbox0=3D\vbox{\Grande} > % > %%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%% > % > % USING FIGURES AS MOTIVES > % > % Most *fleurons* will be based on figures (usually images of=20 > schematic line drawings) > % rather than on elements of the alphabetical character set. > % So it is important to insure that also this alternative works as it=20 > should. > % *Contextref* says that just giving the name of the figure's file is=20 > enough, > %\useexternalfigure [cow] [cow.pdf] [scale=3D300] > % but this usually does not work, so better give the whole path to the=20 > figure in your machine > \useexternalfigure [cow]=20 > [L:/ConTeXt/context/tex/texmf-context/tex/context/sample/cow.pdf]=20 > [hfactor=3D20] > %\setbox0=3D\vbox{\externalfigure [cow] } > \def\MotCow{{\externalfigure [cow] }} > % > %%%%%%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%%%%%% > % > % This is the algorithmically interesting part of the whole business.=20 > It rests upon one instruction, > % *pagespace*, which gets and handles some of *TeX*'s internal=20 > magnitudes of the page. > % Its code was devised, implemented and very well explained by D. Salom= on > % in *Output Routines: Examples and Techniques. > % Part I: Introduction and Examples.* Tugboat 11 n=BA 1: 71.), from=20 > where the following extract originates: > % > % "As an example, the two variables [*pagetotal*, *t*, and *pagegoal*,=20 > *g*] will be used > % to determine how much space is left on the current page. > % If *t* is zero, the space left on the page is the entire page=20 > (*\vsize*). > % Otherwise, it is the difference *g - t*. Macro *\pagespace*=20 > calculates that difference". > > % The interpretations and comments that follow are on the contrary mine= ; > % so be careful: they can be wrong! > % Determination of the space available in *TeX*'s *current page* > \newdimen\Spaceleft % the result will be stored under this n= ame > % computation of the datum > \def\pagespace{% > \ifdim\pagetotal=3D0pt % if the page is empty (i.e. if it is = a=20 > new page) > \Spaceleft=3D\vsize % the available space is the full=20 > design page > \else % otherwise > \Spaceleft=3D\pagegoal % the required amount is the design= =20 > maximum size > \advance\Spaceleft -\pagetotal % less the already used space > \fi} > > % We also need for our purposes certain numerical information about=20 > the ornament, > % mainly its height; so let's get it algorithmically > %\def\Talla{100pt} > \newdimen\Orn % the height of the ornament in points > \newdimen\Talla % the space requested from the page=20 > (with some *air* around) > \newdimen\Respiro % the blank space between text and *fleuro= n* > > % let us construct the selected *fleuron* > \def\Instance#1{% % we get the (typo)graphical content as=20 > argument, > \setbox0=3D\vbox{#1} % put it in a box and assign the box to=20 > register *0* > \Orn=3D\ht0 % after which we can get the required=20 > values through this register > \Talla=3D\ht0 % (getting as an aside a little sample=20 > of the daunting *texan* arithmetic) > %\advance \Talla by 0.5\Talla % compute half the height of the=20 > ornament > \advance \Talla by \Talla % twice the height of the ornament > % \Respiro=3D0.5\ht0 % half the height of the ornament > } > > % and the operative command can be finally issued > \def\Fleuron#1{% > \Instance{#1} % assemble the object > \pagespace % get from *TeX* the relevant magnitudes=20 > about the *current page* > > % (transitory debug information > % Available: \the\Spaceleft\par % this shows the information on the=20 > document itself > % Required: \the\Talla\par > % Ornament: \the\Orn\par > % Disponible: \show\Spaceleft\par % and this shows it in the termina= l > % Requerido: \show\Talla\par > % Ornamento: \show\Orn\par % ) > > \ifdim\Spaceleft>4\Orn % if there are lots of space available > % \Respiro=3D\ht0 % insert a bigger separation > \Respiro=3D\Orn % insert a bigger separation > \else > \Respiro=3D0.5\Orn % insert a smaller separation > \fi > > \ifdim\Spaceleft<\vsize % only when the page has already=20 > some previous content > \ifdim\Spaceleft>\Talla % but keeps also enough space for=20 > the ornament, > \vskip\Respiro % add a reasonable separation from=20 > the text > % \vskip 0.5\Orn % (as could be half the size of the=20 > ornament) > \midaligned{\Motivo} % and typeset the ornament centere= d > \fi > \fi > } > > > \def\Inter{\vskip 0.1pt} % small downward displacement > > %%%%%%%%%%%%%%%%%%%%% > % > %End of *Fleuron.tex* > % > %%%%%%%%%%%%%%%%%%%%% > > %%%%%%%%%%%%%%%%%%%%% > % > % *Fleuron_test.tex* > % Test script for the *Fleuron* instruction > > %\input {Fleuron} % incorporate the contents of *Fleuron.tex= * > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%% > % > % some layout provisions for the test document > > \setuplayout[lines=3D10] % size of the output page in lines > \preloadtypescripts > \usetypescript[latinmodern] > \setupbodyfont[9pt] > > %\tracingpages=3D1 % show some internal typrographical magnitude= s=20 > in the *.log* file > > > %%%%%%%%%%%%%%%%%%%%% > % > % Typesetting and display > % > > \starttext > > Test script for the \em Fleuron \em complement.\par > > %\placefigure [none] {}{\externalfigure[cow]} % testing if figure=20 > reproduction works by itself > > \dorecurse{2}{Line \recurselevel\par} % fill the page with some=20 > lines and show the *fleuron* > %\dorecurse{6}{Line \recurselevel\par} % (more lines could=20 > exclude the *fleuron*) > > % *\MotOne*, *\MotTwo*, *\MotThree*, *\MotFour*, *\MotFive* > % y *\MotCow* are available as example arguments > \Fleuron{\MotTwo} % passed argument allows selection among=20 > available motives > > \stoptext 1. To use graphics from the TeX directory add=20 \setupexternalfigures[location=3Ddefault] (or better=20 location=3D{local,global,default}) to your document, avoid abolsute paths= . 2. Add braces around the words where you want to change the font with=20 \em, e.g. {\em this text is emphasized}. 3. Use context programming stuff when you want to write a command, e.g.=20 \dowithnextboxcs. With \dimexpr you can also simplify calculations=20 because you don't have to store dimension to multiply or add them Below is a simpler version of your \Fleuron command but I haven't=20 checked if everything works as expected. \unprotect \unexpanded\def\fleuron {\par \begingroup \setupalign[\v!middle]% \dowithnextboxcs\fleuron_direct\vbox} \def\fleuron_direct {\ifzeropt\pagetotal % new page, don't place the fleuron \else \ifdim\dimexpr\pagegoal-\pagetotal-\htdp\nextbox\relax<\textheight =20 \ifdim\dimexpr\pagegoal-\pagetotal\relax<\dimexpr\htdp\nextbox*4\relax \vskip.5\htdp\nextbox \else \vskip\htdp\nextbox \fi \box\nextbox \fi \fi \endgroup} \protect \setuplayout[lines=3D10] \setupexternalfigure[location=3Ddefault] % use figures from the tex direc= tory \setupbodyfont[9pt] \showframe \starttext Test script for the {\em Fleuron} complement.\par \dorecurse{2}{Line \recurselevel\par} \fleuron{\em Finis\\\em coronat\\\em opus} \page \dorecurse{2}{Line \recurselevel\par} \fleuron{\dontleavehmode\externalfigure[cow][height=3D2cm]} \stoptext Wolfgang --------------010304070003060909030109 Content-Type: multipart/related; boundary="------------090604080003060808000902" --------------090604080003060808000902 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

10. November 2013 16:12
*Fleurons* are small decorative pieces that were often used in the past for filling big blank spaces in books. They are seldom used nowdays. As besides they will not appear more than a few times in any book (mainly at the end of chapters), the easiest thing to do if one insists in using them (for instance for simulating an old edition of some past work) is to arrange its presence manually in the source document in the way one would do for any other figure or piece of text.

I subscribe to this, which is without doubt the way to proceed if the original document will allways be typesett in the same way. But if it were an extensive work and one foresees different layouts for its appearence as different *products*, then one would have one more source of worries after every run of the work through *Context*, as you can bet that sooner than later one page will have been included somewhere whose only content will be the damned *fleuron*, something that obviously should not happen.

This is the problem that I tackled, because I did not find any previous reference or solution to it. My reasoning, my explanations and the working code are all contained in the rest of this message.

It is conceived as being composed of two parts, but it can also be saved and dealt as one piece. If one saves it as two independent files (as should be done if one intends to use it for any other thing that running the tests samples) the content of the first file will be the one delimited as *Fleuron.tex* and that of the second (*Fleuron_test.tex*) would be the rest of the message. The line of this second file

    % \input {Fleuron}

should be uncommented if one intends to run it as such. The one file version runs as it is.

The script creates the new command *\Fleuron{\<motive name>}*, which is the one to include at the place intended in the source document for the *fleuron* to appear (of course after having incorporated the contents of *Fleuron.tex* in its preamble with *\input{Fleuron}*). The argument *<motive name>* allows the selection of a specific motive among the several of them that could be available; the user can create and organize all this according to his wishes. For instance *\Fleuron{\MotiveFive}* would use the example labelled *\MotiveFive* in the group of examples provided. The comments in *Fleuron.tex* explain how to handle all this.

Enjoy and critizice

Francisco

%%%%%%%%%%%%%%%%%%%%%%%
%
% Fleuron.tex
% Script that explains and implements in *ConTeXt* Mk-IV the kind of small ornaments
% traditionally used by printers for filling big blank spaces in books and printed works.

%*Fleuron*: subst. masc. 2b) Élément décoratif de fantaisie ornant le titre ou les blancs des principales divisions d'un ouvrage [livre] (Trésor de la langue française informatisé).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Creation of the ornament as an entity (in the form of a box)

% Typesetting true *fleurons* requires the use of *TeX*'s special *box registers* as arguments;
% here box register number *0* has been arbitrarily selected for the proceedings.
% The essential steps in the construction are:
%    - (typo)graphical composition of the motive (as for instance *\midaligned{Finis}* in the first example)
%        or designation of the source file of an image,
%    - enclosure of it in a vertical box (*\vbox{\midaligned{Finis}}*) and
%     - finally association of the boxed motive with boxregister *0* (*\setbox0= ...*), all of which happens
%          in reverse order, from right to left, in the code.
% Here are several examples of this:
%\setbox0=\vbox{\midaligned{Finis}}
%\setbox0=\vbox{\midaligned{Finis\\coronat\\opus}}
%\setbox0=\vbox{\midaligned{*****} \Inter \midaligned{***} \Inter \midaligned{*}}

% In order to get in *TeX* something remotely similar to a normal variable,
% called *Motivo*, the following machinery has to be implemented 
\def\Motivo{\copy0}        % get a copy of register's *0* content

% the graphic parts of several (typographical) test motives follow:
\def\MotOne{{\midaligned{\em Finis}}}
\def\MotTwo{{\midaligned{\em Finis\\\em coronat\\\em opus}}}
\def\MotThree{{\midaligned{*****} \Inter \midaligned{***} \Inter \midaligned{*}}}
\def\MotFour{{\midaligned{___________}}}
\def\MotFive{{\bf \midaligned{\hl[1]} \Inter \midaligned{\hl[5]} \Inter \midaligned{\hl[1]}}}

%%%%%%%%%%%%%%%%%%%%%%%%%
%
% THINGS THAT DO NOT WORK
%
%\setbox0=\vbox{\midaligned{\switchtobodyfont[20pt]*}}    % executing these corrupt the whole script
%\setbox0=\vbox{\switchtobodyfont[20pt] \midaligned{*****\\***\\*}}
%\def\Grande{\midaligned{\switchtobodyfont[50pt]*}}        % in any form it is tried
%\setbox0=\vbox{\Grande}
%
%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%
%
% USING FIGURES AS MOTIVES
%
% Most *fleurons* will be based on figures (usually images of schematic line drawings)
% rather than on elements of the alphabetical character set.
% So it is important to insure that also this alternative works as it should.
% *Contextref* says that just giving the name of the figure's file is enough,
%\useexternalfigure [cow] [cow.pdf] [scale=300]
% but this usually does not work, so better give the whole path to the figure in your machine
\useexternalfigure [cow] [L:/ConTeXt/context/tex/texmf-context/tex/context/sample/cow.pdf] [hfactor=20]
%\setbox0=\vbox{\externalfigure [cow] }
\def\MotCow{{\externalfigure [cow] }}
%
%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is the algorithmically interesting part of the whole business. It rests upon one instruction,
% *pagespace*, which gets and handles some of *TeX*'s internal magnitudes of the page.
% Its code was devised, implemented and very well explained by D. Salomon
% in *Output Routines: Examples and Techniques.
% Part I: Introduction and Examples.* Tugboat 11 nº 1: 71.), from where the following extract originates:
%
% "As an example, the two variables [*pagetotal*, *t*, and *pagegoal*, *g*] will be used
% to determine how much space is left on the current page.
% If *t* is zero, the space left on the page is the entire page (*\vsize*).
% Otherwise, it is the difference *g − t*. Macro *\pagespace* calculates that difference".

% The interpretations and comments that follow are on the contrary mine;
% so be careful: they can be wrong!
% Determination of the space available in *TeX*'s *current page*
\newdimen\Spaceleft            % the result will be stored under this name
% computation of the datum
\def\pagespace{%
   \ifdim\pagetotal=0pt        % if the page is empty (i.e. if it is a new page)
      \Spaceleft=\vsize            % the available space is the full design page
   \else                    % otherwise
      \Spaceleft=\pagegoal        % the required amount is the design maximum size
      \advance\Spaceleft -\pagetotal    % less the already used space
   \fi}

% We also need for our purposes certain numerical information about the ornament,
% mainly its height; so let's get it algorithmically
%\def\Talla{100pt}
\newdimen\Orn                % the height of the ornament in points
\newdimen\Talla                % the space requested from the page (with some *air* around)
\newdimen\Respiro            % the blank space between text and *fleuron*

% let us construct the selected *fleuron*
\def\Instance#1{%            % we get the (typo)graphical content as argument,
   \setbox0=\vbox{#1}        % put it in a box and assign the box to register *0*
   \Orn=\ht0                % after which we can get the required values through this register
   \Talla=\ht0                % (getting as an aside a little sample of the daunting *texan* arithmetic)
   %\advance \Talla by 0.5\Talla    % compute half the height of the ornament
   \advance \Talla by \Talla        % twice the height of the ornament
%   \Respiro=0.5\ht0            % half the height of the ornament
}

% and the operative command can be finally issued
\def\Fleuron#1{%
   \Instance{#1}                % assemble the object
   \pagespace                % get from *TeX* the relevant magnitudes about the *current page*

% (transitory debug information
%   Available: \the\Spaceleft\par  % this shows the information on the document itself
%   Required: \the\Talla\par
%   Ornament: \the\Orn\par
%   Disponible: \show\Spaceleft\par  % and this shows it in the terminal
%   Requerido: \show\Talla\par
%   Ornamento: \show\Orn\par     % )

   \ifdim\Spaceleft>4\Orn        % if there are lots of space available
%    \Respiro=\ht0            % insert a bigger separation
      \Respiro=\Orn            % insert a bigger separation
   \else
      \Respiro=0.5\Orn        % insert a smaller separation
   \fi

   \ifdim\Spaceleft<\vsize        % only when the page has already some previous content
      \ifdim\Spaceleft>\Talla        % but keeps also enough space for the ornament,
         \vskip\Respiro            % add a reasonable separation from the text
%       \vskip 0.5\Orn             % (as could be half the size of the ornament)
         \midaligned{\Motivo}        % and typeset the ornament centered
      \fi
   \fi
}


\def\Inter{\vskip 0.1pt}        % small downward displacement

%%%%%%%%%%%%%%%%%%%%%
%
%End of *Fleuron.tex*
%
%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%
%
% *Fleuron_test.tex*
% Test script for the *Fleuron* instruction

%\input {Fleuron}            % incorporate the contents of *Fleuron.tex*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% some layout provisions for the test document

\setuplayout[lines=10]    % size of the output page in lines
\preloadtypescripts
\usetypescript[latinmodern]
\setupbodyfont[9pt]

%\tracingpages=1        % show some internal typrographical magnitudes in the *.log* file


%%%%%%%%%%%%%%%%%%%%%
%
% Typesetting and display
%

\starttext

Test script for the \em Fleuron \em complement.\par

%\placefigure [none] {}{\externalfigure[cow]}    % testing if figure reproduction works by itself

\dorecurse{2}{Line \recurselevel\par}        % fill the page with some lines and show the *fleuron*
%\dorecurse{6}{Line \recurselevel\par}        % (more lines could exclude the *fleuron*)

% *\MotOne*, *\MotTwo*, *\MotThree*, *\MotFour*, *\MotFive*
%  y *\MotCow* are available as example arguments
\Fleuron{\MotTwo}            % passed argument allows selection among available motives

\stoptext

1. To use graphics from the TeX directory add \setupexternalfigures[location=default] (or better location={local,global,default}) to your document, avoid abolsute paths.

2. Add braces around the words where you want to change the font with \em, e.g. {\em this text is emphasized}.

3. Use context programming stuff when you want to write a command, e.g. \dowithnextboxcs. With \dimexpr you can also simplify calculations because you don’t have to store dimension to multiply or add them

Below is a simpler version of your \Fleuron command but I haven’t checked if everything works as expected.

\unprotect

\unexpanded\def\fleuron
  {\par
   \begingroup
   \setupalign[\v!middle]%
   \dowithnextboxcs\fleuron_direct\vbox}

\def\fleuron_direct
  {\ifzeropt\pagetotal
     % new page, don’t place the fleuron
   \else
     \ifdim\dimexpr\pagegoal-\pagetotal-\htdp\nextbox\relax<\textheight
       \ifdim\dimexpr\pagegoal-\pagetotal\relax<\dimexpr\htdp\nextbox*4\relax
         \vskip.5\htdp\nextbox
       \else
         \vskip\htdp\nextbox
       \fi
       \box\nextbox
     \fi
   \fi
   \endgroup}

\protect

\setuplayout[lines=10]

\setupexternalfigure[location=default] % use figures from the tex directory

\setupbodyfont[9pt]

\showframe

\starttext

Test script for the {\em Fleuron} complement.\par

\dorecurse{2}{Line \recurselevel\par}

\fleuron{\em Finis\\\em coronat\\\em opus}

\page

\dorecurse{2}{Line \recurselevel\par}

\fleuron{\dontleavehmode\externalfigure[cow][height=2cm]}

\stoptext

Wolfgang
--------------090604080003060808000902 Content-Type: image/jpeg; x-apple-mail-type=stationery; name="compose-unknown-contact.jpg" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="compose-unknown-contact.jpg" /9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEC AQEBAQEBAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/2wBDAQEBAQEBAQICAgICAgIC AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/wAAR CAAZABkDAREAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAABgcICQr/xAA0EAABAwMCAgUK BwAAAAAAAAACAQMEBQYRABITIQcUMUF2CBUXIjI2N0JRtVRWkZOV0dL/xAAYAQEAAwEAAAAA AAAAAAAAAAADAAEEAv/EACQRAAICAAQGAwAAAAAAAAAAAAABAhEDMrHREyExM0FxgfDx/9oA DAMBAAIRAxEAPwDuEt+gW/ULet6oVC3rfqNQqFv0OfPn1GhUqfOmzZtKZlS5UqZMaNwzNwiJ VIl7eXLCaZIGwBl3TY8epPx2+jy2ZNPjvkwc9uhW8j7nCPhvOsQliYIeS7cvCpp8o50qwrC4 v3lsNSDbdmTEhvs2tahxpfV3WnmbbozJEw/gwdadbYExVRXKEKoSdvJcaOSqxE7/AAiX0gXx +a69/JSf9alIlste0VzaNpeFrcT9KKymotyiaZ0KRCnzacoE7Kjzn4gi2KqUh3jqDHDHv4mR UfruTWlMzlVUKIVNp9GguEJnAh0+IZjyAiisgyRDnu5azS8miKqjOTVkKqS/psG37fo1Fbab eg25b8eZPeFJBBJSjMG5HjMeyihnaauZwe4OGiju13GAcpOwBeN+U8/IkGbsiS8b7ryogmbz hbyc9REROfZhERO5ETShjPtvpGqTUyLErytS4siSwx5x2tRH4hPOI0DkjZtaJtFxuVEbIUUi yeNujlBUJGbJN6nM/Cyf2Hf60YgjvKA+NPSP4gT7axpcPtr51YWJnYn9dnAQWl722p4ot37y zqnlfp6FrqbwawG8/9k= --------------090604080003060808000902-- --------------010304070003060909030109-- --===============1429261518== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1429261518==--