ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: Some questions about an environment (Metafun)
Date: Tue, 4 Aug 2015 20:08:41 +0200	[thread overview]
Message-ID: <55C0FFA9.4070908@wxs.nl> (raw)
In-Reply-To: <CACyK-ercG--pvSAJLWEgt4EnpxEpq404GZ3ym6k8Q9_J1qKgNw@mail.gmail.com>

On 8/4/2015 5:04 PM, Fabrice Couvreur wrote:
> Hi,
> How to have Definition 1, Definition 2, Definition 3 ...?
>
> Is it possible to translate the image p until the left edge of the text
> area ?


\startuseMPgraphic{MyFrame}
     picture p ;
     p := textext.rt(\MPstring{MyFrame}) ;
     p := p shifted (0,OverlayHeight-ypart center p) ;
     fill OverlayBox leftenlarged .1TextWidth withcolor \MPcolor{MyColor} ;
     fill boundingbox p withcolor \MPcolor{myColor} ;
     draw p withcolor white ;
     setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic



> Thank you,
> Fabrice
>
> \showframe
>
> \setupcolors[state=start,cmyk=yes]
>
> \definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
> \definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]
>
> \setupbodyfont[11pt]
> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>
> \defineframedtext
>     [MyText]
>     [frame=off,
>      background=MyFrame,
>      width=0.9\textwidth,
>      location=right]
>
> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>
> \def\StartFrame{\startMyText}
> \def\StopFrame{\startMyText}
>
> \setMPtext{MyFrame}{\hbox spread 1em {\hss\strut
> {\bf\feature[+][f:smallcaps]  Définition 1 }\hss}}}
>
> \startuseMPgraphic{MyFrame}
>
> path a ;
> path b ;
> picture p ;
> o := BodyFontSize ;
> p :=textext.rt(\MPstring{MyFrame}) ;
> p := p shifted (0,OverlayHeight-ypart center p) ;
> a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
> fill a withcolor \MPcolor{MyColor} ;
> b := boundingbox p ;
> fill b withcolor \MPcolor{myColor} ;
> draw p withcolor white ;
>
> \stopuseMPgraphic
>
> \starttext
> \startlinecorrection[blank]
> \startMyText
> \input knuth
> \stopMyText
> \stoplinecorrection
>
> \startlinecorrection[blank]
> \startMyText
> \input knuth
> \stopMyText
> \stoplinecorrection
>
> \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
> ___________________________________________________________________________________
>


-- 

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

  parent reply	other threads:[~2015-08-04 18:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 15:04 Fabrice Couvreur
2015-08-04 16:02 ` Aditya Mahajan
2015-08-04 19:30   ` Fabrice Couvreur
2015-08-06 21:38     ` Fabrice Couvreur
2015-08-07 12:26       ` Hans Hagen
2015-08-07 15:11         ` Fabrice Couvreur
2015-08-04 18:08 ` Hans Hagen [this message]
2015-08-04 19:26   ` Fabrice Couvreur

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=55C0FFA9.4070908@wxs.nl \
    --to=pragma@wxs.nl \
    --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).