ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Fabrice L <fabrice.alpha@gmail.com>
Subject: Re: MetaFun labels and xsized
Date: Fri, 25 Dec 2020 22:09:08 +0100	[thread overview]
Message-ID: <1fe2d82f-48fa-934e-1f4f-ae7214786bfe@xs4all.nl> (raw)
In-Reply-To: <6D29B3E9-819A-4D7C-8443-194FB8107A43@gmail.com>

On 12/25/2020 6:36 PM, Fabrice L wrote:
> Hi,
> 
>> Le 25 déc. 2020 à 12:30, Pablo Rodriguez <oinos@gmx.es> a écrit :
>>
>> Dear list,
>>
>> I have this minimal MetaFun sample (the only one in my real document):
>>
>>   \setupbodyfont[pagella]
>>   \starttext
>>   \startMPcode
>>   pair a ; a := (1, 1) ;
>>   pair b ; b := (1, 10) ;
>>   pair c ; c := (10, 10) ;
>>   pair d ; d := (10, 1) ;
>>   draw (a--b--c--d--a) xsized .75TextWidth;
>>
>>   draw thelabel.lft("α",a) ;
>>   draw thelabel.lft("β",b) ;
>>   draw thelabel.top("γ",c) ;
>>   draw thelabel.rt("δ",d) ;
>>   \stopMPcode
>>   \stoptext
>>
>> Is there a way to relate adapt the labels to the xsized positions used?
> 
> I’m sure somebody could find a more elegant solution, but here is a simple one:
> 
>   \setupbodyfont[pagella]
>   \starttext
>   \startMPcode
>   pair a ; a := (1, 1) ;
>   pair b ; b := (1, 10) ;
>   pair c ; c := (10, 10) ;
>   pair d ; d := (10, 1) ;
>   path square ;
>   square := (a--b--c--d--cycle) xsized .75TextWidth ;
>   
>   draw square xsized .75TextWidth;
> 
>   draw thelabel.lft("α",point 0 of square) ;
>   draw thelabel.lft("β",point 1 of square) ;
>   draw thelabel.top("γ",point 2 of square) ;
>   draw thelabel.rt("δ",point 3 of square) ;
>   \stopMPcode
>   \stoptext
> 
> Fabrice.
>
\startMPcode
     path p ; p := (
         ( 1,  1) --
         ( 1,  5) --
         (10, 10) --
         (14,  4) --
     cycle) xsized .75TextWidth;

     draw p ;

     freelabel("\strut α",point 0 of p,center p) ;
     freelabel("\strut β",point 1 of p,center p) ;
     freelabel("\strut γ",point 2 of p,center p) ;
     freelabel("\strut δ",point 3 of p,center p) ;
\stopMPcode


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2020-12-25 21:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 17:30 Pablo Rodriguez
2020-12-25 17:36 ` Fabrice L
2020-12-25 18:38   ` Pablo Rodriguez
2020-12-25 21:09   ` Hans Hagen [this message]
2020-12-25 23:54     ` Pablo Rodriguez

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=1fe2d82f-48fa-934e-1f4f-ae7214786bfe@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=fabrice.alpha@gmail.com \
    --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).