ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Framedtext in a float
@ 2016-10-31 23:12 Fabrice Couvreur
  2016-11-01  7:51 ` Marco Patzer
  2016-11-01  8:23 ` Piotr Kopszak
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2016-10-31 23:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hello,
How to make the width of framedtext automatically adapts to its contents.
Fabrice

\definefloat
   [recipe]
   [figure]

\setupfloat
   [recipe]
   [default={right,none}]

\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]
\definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]


\defineframedtext
  [MyFrame]
  [before={\blank},
   after={\blank},
   frame=off,
   background=MyFrame,
   width=6cm,
   height=fit]

\startuseMPgraphic{MyFrame}
 path b;
 picture p;
 p := textext.rt("\tfx\white\framedtextparameter{Title}");
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
 b := boundingbox p enlarged .3EmWidth ;
 fill OverlayBox withcolor \MPcolor{MyColorA};
 fill b withcolor \MPcolor{MyColorB} ;
 draw p ;
 setbounds currentpicture to boundingbox currentpicture enlarged 2mm ;
\stopuseMPgraphic

\defineoverlay
  [MyFrame]
  [\useMPgraphic{MyFrame}]

  \starttext

  \placerecipe{}{
  \startMyFrame[Title=Info]
  L'histogramme est constitué de rectangles dont les bases correspondent
aux classes et dont les aires sont proportionnelles aux effectifs ou
fréquences des classes.
  \stopMyFrame}

  \input Knuth

  \stoptext

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

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2016-11-05 14:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 23:12 Framedtext in a float Fabrice Couvreur
2016-11-01  7:51 ` Marco Patzer
2016-11-01  8:23 ` Piotr Kopszak
2016-11-01  9:47   ` Fabrice Couvreur
2016-11-01 10:17     ` Piotr Kopszak
2016-11-01 11:09       ` Fabrice Couvreur
2016-11-05 14:55         ` Wolfgang Schuster
2016-11-05 14:48       ` Alan Braslau

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