* MetaFun labels and xsized
@ 2020-12-25 17:30 Pablo Rodriguez
2020-12-25 17:36 ` Fabrice L
0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2020-12-25 17:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
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?
Many thanks for your help,
Pablo
--
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MetaFun labels and xsized
2020-12-25 17:30 MetaFun labels and xsized Pablo Rodriguez
@ 2020-12-25 17:36 ` Fabrice L
2020-12-25 18:38 ` Pablo Rodriguez
2020-12-25 21:09 ` Hans Hagen
0 siblings, 2 replies; 5+ messages in thread
From: Fabrice L @ 2020-12-25 17:36 UTC (permalink / raw)
To: mailing list for ConTeXt users
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.
>
> Many thanks for your help,
>
> Pablo
> --
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 5+ messages in thread
* Re: MetaFun labels and xsized
2020-12-25 17:36 ` Fabrice L
@ 2020-12-25 18:38 ` Pablo Rodriguez
2020-12-25 21:09 ` Hans Hagen
1 sibling, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2020-12-25 18:38 UTC (permalink / raw)
To: ntg-context
On 12/25/20 6:36 PM, Fabrice L wrote:
>> I have this minimal MetaFun sample (the only one in my real document):
>> [...]
>> 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
Many thanks for your ultra-fast reply, Fabrice.
I didn’t know that paths could be also defined (MP is all Greek to me).
I realized that drawing doesn’t require resizing again (once the path
definition contains resizing).
Many thanks for your help,
Pablo
--
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MetaFun labels and xsized
2020-12-25 17:36 ` Fabrice L
2020-12-25 18:38 ` Pablo Rodriguez
@ 2020-12-25 21:09 ` Hans Hagen
2020-12-25 23:54 ` Pablo Rodriguez
1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2020-12-25 21:09 UTC (permalink / raw)
To: mailing list for ConTeXt users, Fabrice L
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MetaFun labels and xsized
2020-12-25 21:09 ` Hans Hagen
@ 2020-12-25 23:54 ` Pablo Rodriguez
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2020-12-25 23:54 UTC (permalink / raw)
To: ntg-context
On 12/25/20 10:09 PM, Hans Hagen wrote:
>> [...]
> \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
Many thanks for your code, Hans.
This is exactly what I need.
Pablo
--
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-25 23:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25 17:30 MetaFun labels and xsized Pablo Rodriguez
2020-12-25 17:36 ` Fabrice L
2020-12-25 18:38 ` Pablo Rodriguez
2020-12-25 21:09 ` Hans Hagen
2020-12-25 23:54 ` Pablo Rodriguez
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).