ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez <oinos@gmx.es>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: space before/after colored framed text
Date: Wed, 17 Aug 2016 19:02:15 +0200	[thread overview]
Message-ID: <838cac1d-9d18-0681-48a6-a637a6408b36@gmx.es> (raw)
In-Reply-To: <884e8737-a5e7-9cec-612c-8f8e9a652aa3@free.fr>

Hi Jean-Pierre,

sorry, for top-posting, but I think this way the reply will be clearer.

In your previous sample you had two questions.

This sample shows the answer:

    \defineframedtext
        [MyFrame]
        [before={\blank[6*big]},
         after={\blank[6*big]},
         style={\setupbodyfont[5pt]}]

    \starttext
    \dorecurse{3}{\input zapf \startMyFrame\input knuth\stopMyFrame}
    \stoptext

1. before and after control distance in elements.

2. \setupbodyfont[dimension] or \switchtobodyfont[dimension] as values
for the "style" key modify the size (as shown above). Other ways of
doing it are \tfx, \itx and so on.

Your sample isn’t minimal and it doesn’t compile.

\dorecurse needs two arguments (two pair of braces: {}). The second is
missing.

BTW, serif for mainface is defined twice. GFS Didot is selected after
Garamond.

Please compile the following:

8<--------------------------------------------------------------------
\showframe\showgrid
\setuplanguage[fr][patterns={fr,agr}]
\mainlanguage[fr]
\setcharacterspacing[frenchpunctuation]
\setuplayout [backspace=40mm]
\setuppagenumbering[alternative=doublesided, location={header, inmargin}]
\setupmargindata[inmargin][location=inner,
style={\ssx\setupinterlinespace[line=2.8ex]}]
\setupmarginframed[inmargin][align=right]
\setupbodyfontenvironment[default][em=italic]
\definefontfamily[mainface] [serif] [GFS Didot]
\setupbodyfont[mainface]
\setupindenting[1.5em]
\setupindenting[yes]
\setupwhitespace[medium]
\setupinterlinespace[line=3.2ex]
\setuphead[title][header=empty]

\setupheader[style={\sc}]
\setupfooter[style={\itxx}]
\setupheadertexts[Cours de Philosophie][][][{\getmarking[section]}]
\setupfootertexts[][][][© Jean-Pierre Delange, 2016 — La reproduction de
ce texte est soumise à autorisation.]
%~ \setupsymbolset[text]

% Début de la définition d'un texte encadré en rouge
\defineframedtext
[MyFrame]
[before={\blank},
after={\blank},
frame=off,
background=MyFrame,
%width=\textwidth,
width=max,
height=fit]

\definelabel
[Definition]
[headstyle=\bf\smallcaps]

\startuseMPgraphic{MyFrame}
path b;
picture p;
%p := textext.rt("\white\Definition");
p := textext.rt("\white\framedtextparameter{Title}");
%p := textext.rt("\white\getvariable{text}{text1}");
p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;
fill OverlayBox withcolor lightgray; %\MPcolor{
fill b withcolor darkred;
draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor
darkred;
draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor
darkred;
draw p;
setbounds currentpicture to boundingbox currentpicture enlarged 2mm;
\stopuseMPgraphic

\defineoverlay
[MyFrame]
[\useMPgraphic{MyFrame}]
% Fin de la définition d'un texte encadré en rouge
\starttext
\dorecurse{4}{
\input ward

\startMyFrame[Title=Avertissement]
La plupart des termes et des expressions qui doivent attirer l'attention
du lecteur sont soulignés ici par des {\em italiques}. On trouvera {\em
dans la marge} du texte de brèves indications biographiques et
bibliographiques, tandis que les explications plus développées sont
renvoyées en {\em notes de bas de page}. On trouvera à la fin de cet
ouvrage une bibliographie des textes cités\footnote{Seuls les références
aux textes classiques sont données, à l'exception des textes spécialisés}.
\stopMyFrame}
\stoptext
-------------------------------------------------------------------->8

AfaIk, frames cannot be split, so the whole frame is moved to the next
page. It needs 8 lines and it only has 6 in the first page.

I hope it is clear now.

Pablo



On 08/17/2016 05:57 PM, Jean-Pierre Delange wrote:
> Hi Thomas,
> 
> I am very sorry. As a beginner with ConTeXt, I surely make mistakes,
> even in the way to show which issues I am confronting to. Maybe I ought
> to give the whole code where some errors occured, but I thought that the
> code was too long to be mailed to this list. That's why I have mailed a
> piece of the code concerning a colored framed but not the whole stuff.
> Thinking the issue occured with this special frame (and not with any
> other kind of frame), I have given this particular code.
> 
> BTW, in order to make understandable what kind of issue occured by this
> particular frame, I didn't want to give a sample too huge (I place this
> colored frame at the end of each section of my book). Anyway, I try to
> understand how manage the place of THIS colored frame just after a text
> (with no rejection of the frame to the following page); and I will be
> very pleased to understand how to resize the text font inside the frame.
> At last, how to manage footnotes within this framed text (the footnote
> numbering appears, but the text doesn't appear inside nor outside the
> framed text).
> 
> Thank you very much for your help.
> 
> JP
> 
> See below the whole sample code :
> 
> \setuplanguage[fr][patterns={fr,agr}]
> 
> \mainlanguage[fr]
> 
> \setcharacterspacing[frenchpunctuation]
> 
> \setuplayout [backspace=40mm]
> 
> \setuppagenumbering[alternative=doublesided, location={header, inmargin}]
> 
> \setupmargindata[inmargin][location=inner,
> style={\ssx\setupinterlinespace[line=2.8ex]}]
> 
> \setupmarginframed[inmargin][align=right]
> 
> \setupbodyfontenvironment[default][em=italic]
> 
> \definefallbackfamily[mainface][serif][Theano Didot][preset=range:greek,
> it={Old Standard Italic}, force=yes]
> 
> \definefallbackfamily [mainface] [rm] [ipaexmincho]
> [range=cjkunifiedideographs]
> 
> \definefallbackfamily[mainface] [serif] [nafeesnastaleeq] [range=arabic]
> 
> \definefontfamily [mainface] [serif] [GaramondNo8][sc=NewG8 Regular SC]
> 
> \definefontfamily [mainface] [sans] [FreeSans] [rscale=0.7]
> 
> \definefontfamily[mainface] [serif] [GFS Didot]
> 
> \setupbodyfont[mainface]
> 
> \setupcolors[state=start]
> 
> \setupindenting[1.5em]
> 
> \setupindenting[yes]
> 
> 
> \setupwhitespace[medium]
> 
> \setupinterlinespace[line=3.2ex]
> 
> 
> \setupitemize[each][margin=yes]
> 
> 
> \setuphead[title][header=empty]
> 
> 
> \setupheader[style={\sc}]
> 
> \setupfooter[style={\itxx}]
> 
> \setupheadertexts[Cours de Philosophie][][][{\getmarking[section]}]
> 
> \setupfootertexts[][][][© Jean-Pierre Delange, 2016 — La reproduction de
> ce texte est soumise à autorisation.]
> 
> \setupsymbolset[text]
> 
> 
> % Début de la définition d'un texte encadré en rouge
> 
> \defineframedtext
> 
> [MyFrame]
> 
> [before={\blank},
> 
> after={\blank},
> 
> frame=off,
> 
> background=MyFrame,
> 
> %width=\textwidth,
> 
> width=max,
> 
> height=fit,
> 
> style=regular]
> 
> 
> \definelabel
> 
> [Definition]
> 
> [headstyle=\bf\smallcaps]
> 
> 
> \startuseMPgraphic{MyFrame}
> 
> path b;
> 
> picture p;
> 
> %p := textext.rt("\white\Definition");
> 
> p := textext.rt("\white\framedtextparameter{Title}");
> 
> %p := textext.rt("\white\getvariable{text}{text1}");
> 
> p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
> 
> b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;
> 
> fill OverlayBox withcolor lightgray; %\MPcolor{
> 
> fill b withcolor darkred;
> 
> draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor
> 
> darkred;
> 
> draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor
> 
> darkred;
> 
> draw p;
> 
> setbounds currentpicture to boundingbox currentpicture enlarged 2mm;
> 
> \stopuseMPgraphic
> 
> 
> \defineoverlay
> 
> [MyFrame]
> 
> [\useMPgraphic{MyFrame}]
> 
> % Fin de la définition d'un texte encadré en rouge
> 
> \starttext
> 
> \dorecurse{4}
> 
> \input ward
> 
> 
> \startMyFrame[Title=Avertissement]
> 
> La plupart des termes et des expressions qui doivent attirer l'attention
> du lecteur sont soulignés ici par des {\em italiques}. On trouvera {\em
> dans la marge} du texte de brèves indications biographiques et
> bibliographiques, tandis que les explications plus développées sont
> renvoyées en {\em notes de bas de page}. On trouvera à la fin de cet
> ouvrage une bibliographie des textes cités\footnote{Seuls les références
> aux textes classiques sont données, à l'exception des textes spécialisés}.
> 
> \stopMyFrame
> 
> \stoptext


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

  reply	other threads:[~2016-08-17 17:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 12:20 \startalign \stopalign equation number placement seems wrong Mikael P. Sundqvist
2016-08-17 13:23 ` Otared Kavian
2016-08-17 14:36   ` space before/after colored framed text Jean-Pierre Delange
2016-08-17 15:14     ` Thomas A. Schmitz
2016-08-17 15:57       ` Jean-Pierre Delange
2016-08-17 17:02         ` Pablo Rodriguez [this message]
2016-08-17 21:59           ` Jean-Pierre Delange
2016-08-18 18:58             ` Pablo Rodriguez
2016-08-28 15:08   ` \startalign \stopalign equation number placement seems wrong Mikael P. Sundqvist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838cac1d-9d18-0681-48a6-a637a6408b36@gmx.es \
    --to=oinos@gmx.es \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).