ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Left border of a rectangle (Metafun)
@ 2015-08-29  8:56 Fabrice Couvreur
  2015-08-29 11:11 ` Otared Kavian
  2015-08-29 11:18 ` Otared Kavian
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Couvreur @ 2015-08-29  8:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
I want to draw the left border of the rectangle, but it is drawn in the
middle.
Why ?
Thank you,
Fabrice

\setupcolors[state=start]


\definecolor[MyColorA][c=0.3, m=0.00, y=0.00, k=0.05]



\defineoverlay
  [Funny]
  [\useMPgraphic{Funny}]

\startuseMPgraphic{Funny}
    interim linecap := butt ;
    path p ;
    p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
    drawoptions (withpen pencircle scaled 6.5pt withcolor
\MPcolor{MyColorA}) ;
    draw ulcorner p--llcorner p ;
\stopuseMPgraphic

\defineframedtext
  [Methode]
  [before={\blank},
   after={\blank},
   frame=off,
   background=Funny,
   width=\textwidth,
   height=fit]

\starttext

\startMethode
\input knuth
\stopMethode

\stoptext

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Left border of a rectangle (Metafun)
  2015-08-29  8:56 Left border of a rectangle (Metafun) Fabrice Couvreur
@ 2015-08-29 11:11 ` Otared Kavian
  2015-08-29 11:35   ` Hans Hagen
  2015-08-29 11:18 ` Otared Kavian
  1 sibling, 1 reply; 6+ messages in thread
From: Otared Kavian @ 2015-08-29 11:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi fabrice,

I dont’t know whether this the best solution, but you can use the following definition of the MPgraphic Funny:

\startuseMPgraphic{Funny}
    interim linecap := butt ;
    path p ;
    p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
    drawoptions (withpen pencircle scaled 6.5pt withcolor \MPcolor{MyColorA}) ;
    draw lrcorner p --urcorner p --ulcorner p withcolor white;
    draw ulcorner p --llcorner p ;

\stopuseMPgraphic

If necessary, you can use a backgroundcolor instead of white for the part of the path p which is to be invisible.

Best regards: OK

> On 29 Aug 2015, at 10:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
> 
> Hi,
> I want to draw the left border of the rectangle, but it is drawn in the middle.
> Why ?
> Thank you,
> Fabrice
> 
> \setupcolors[state=start]
> 
> 
> \definecolor[MyColorA][c=0.3, m=0.00, y=0.00, k=0.05]
> 
> 
> 
> \defineoverlay
>   [Funny]
>   [\useMPgraphic{Funny}]
> 
> \startuseMPgraphic{Funny}
>     interim linecap := butt ;
>     path p ;
>     p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>     drawoptions (withpen pencircle scaled 6.5pt withcolor \MPcolor{MyColorA}) ;
>     draw ulcorner p--llcorner p ;
> \stopuseMPgraphic
> 
> \defineframedtext
>   [Methode]
>   [before={\blank},
>    after={\blank},
>    frame=off,
>    background=Funny,
>    width=\textwidth,
>    height=fit]
> 
> \starttext
> 
> \startMethode
> \input knuth
> \stopMethode
> 
> \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
> ___________________________________________________________________________________

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

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

* Re: Left border of a rectangle (Metafun)
  2015-08-29  8:56 Left border of a rectangle (Metafun) Fabrice Couvreur
  2015-08-29 11:11 ` Otared Kavian
@ 2015-08-29 11:18 ` Otared Kavian
  1 sibling, 0 replies; 6+ messages in thread
From: Otared Kavian @ 2015-08-29 11:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Fabrice,

You can also use the following simpler method:

%%%%% begin leftframe.tex
\definecolor[MyColorA][c=0.3, m=0.00, y=0.00, k=0.05]

\defineframedtext
  [MethodeB]
  [before={\blank},
   after={\blank},
   frame=off,
   leftframe=on,
   framecolor=MyColorA,
   rulethickness=6.5pt,
   width=\textwidth,
   height=fit]

\starttext

\startMethodeB
\input knuth
\stopMethodeB

\stoptext
%%%%% end leftframe.tex

Best regards: OK

> On 29 Aug 2015, at 10:56, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
> 
> Hi,
> I want to draw the left border of the rectangle, but it is drawn in the middle.
> Why ?
> Thank you,
> Fabrice
> 
> \setupcolors[state=start]
> 
> 
> \definecolor[MyColorA][c=0.3, m=0.00, y=0.00, k=0.05]
> 
> 
> 
> \defineoverlay
>   [Funny]
>   [\useMPgraphic{Funny}]
> 
> \startuseMPgraphic{Funny}
>     interim linecap := butt ;
>     path p ;
>     p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>     drawoptions (withpen pencircle scaled 6.5pt withcolor \MPcolor{MyColorA}) ;
>     draw ulcorner p--llcorner p ;
> \stopuseMPgraphic
> 
> \defineframedtext
>   [Methode]
>   [before={\blank},
>    after={\blank},
>    frame=off,
>    background=Funny,
>    width=\textwidth,
>    height=fit]
> 
> \starttext
> 
> \startMethode
> \input knuth
> \stopMethode
> 
> \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
> ___________________________________________________________________________________

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

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

* Re: Left border of a rectangle (Metafun)
  2015-08-29 11:11 ` Otared Kavian
@ 2015-08-29 11:35   ` Hans Hagen
  2015-08-30  7:50     ` Fabrice Couvreur
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2015-08-29 11:35 UTC (permalink / raw)
  To: ntg-context

On 8/29/2015 1:11 PM, Otared Kavian wrote:
> Hi fabrice,
>
> I dont’t know whether this the best solution, but you can use the following definition of the MPgraphic Funny:
>
> \startuseMPgraphic{Funny}
>      interim linecap := butt ;
>      path p ;
>      p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>      drawoptions (withpen pencircle scaled 6.5pt withcolor \MPcolor{MyColorA}) ;
>      draw lrcorner p --urcorner p --ulcorner p withcolor white;
>      draw ulcorner p --llcorner p ;
>
> \stopuseMPgraphic

\startuseMPgraphic{Funny}
     interim linecap := butt ;
     draw leftboundary OverlayBox ;
     setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

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

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

* Re: Left border of a rectangle (Metafun)
  2015-08-29 11:35   ` Hans Hagen
@ 2015-08-30  7:50     ` Fabrice Couvreur
  2015-08-30  8:36       ` Otared Kavian
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2015-08-30  7:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
Hans Otared and thank you for your suggestions.
A question for Hans : why my code does not give the expected result ?
Fabrice

2015-08-29 13:35 GMT+02:00 Hans Hagen <pragma@wxs.nl>:

> On 8/29/2015 1:11 PM, Otared Kavian wrote:
>
>> Hi fabrice,
>>
>> I dont’t know whether this the best solution, but you can use the
>> following definition of the MPgraphic Funny:
>>
>> \startuseMPgraphic{Funny}
>>      interim linecap := butt ;
>>      path p ;
>>      p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>>      drawoptions (withpen pencircle scaled 6.5pt withcolor
>> \MPcolor{MyColorA}) ;
>>      draw lrcorner p --urcorner p --ulcorner p withcolor white;
>>      draw ulcorner p --llcorner p ;
>>
>> \stopuseMPgraphic
>>
>
> \startuseMPgraphic{Funny}
>     interim linecap := butt ;
>     draw leftboundary OverlayBox ;
>     setbounds currentpicture to OverlayBox ;
> \stopuseMPgraphic
>
> -----------------------------------------------------------------
>                                           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
>
> ___________________________________________________________________________________
>

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Left border of a rectangle (Metafun)
  2015-08-30  7:50     ` Fabrice Couvreur
@ 2015-08-30  8:36       ` Otared Kavian
  0 siblings, 0 replies; 6+ messages in thread
From: Otared Kavian @ 2015-08-30  8:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi Fabrice,

Your code works if you add 

	 setbounds currentpicture to OverlayBox ;

Indeed with this Metapost determines the boundaries of the rectangle of which you draw the left side.

Best regards: OK

> On 30 Aug 2015, at 09:50, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
> 
> Hi,
> Hans Otared and thank you for your suggestions.
> A question for Hans : why my code does not give the expected result ?
> Fabrice
> 
> 2015-08-29 13:35 GMT+02:00 Hans Hagen <pragma@wxs.nl <mailto:pragma@wxs.nl>>:
> On 8/29/2015 1:11 PM, Otared Kavian wrote:
> Hi fabrice,
> 
> I dont’t know whether this the best solution, but you can use the following definition of the MPgraphic Funny:
> 
> \startuseMPgraphic{Funny}
>      interim linecap := butt ;
>      path p ;
>      p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
>      drawoptions (withpen pencircle scaled 6.5pt withcolor \MPcolor{MyColorA}) ;
>      draw lrcorner p --urcorner p --ulcorner p withcolor white;
>      draw ulcorner p --llcorner p ;
> 
> \stopuseMPgraphic
> 
> \startuseMPgraphic{Funny}
>     interim linecap := butt ;
>     draw leftboundary OverlayBox ;
>     setbounds currentpicture to OverlayBox ;
> \stopuseMPgraphic
> 
> -----------------------------------------------------------------
>                                           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 <http://www.pragma-ade.com/>
>                                              | www.pragma-pod.nl <http://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 <mailto:ntg-context@ntg.nl> / http://www.ntg.nl/mailman/listinfo/ntg-context <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / http://tex.aanhet.net <http://tex.aanhet.net/>
> archive  : http://foundry.supelec.fr/projects/contextrev/ <http://foundry.supelec.fr/projects/contextrev/>
> wiki     : http://contextgarden.net <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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2015-08-30  8:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-29  8:56 Left border of a rectangle (Metafun) Fabrice Couvreur
2015-08-29 11:11 ` Otared Kavian
2015-08-29 11:35   ` Hans Hagen
2015-08-30  7:50     ` Fabrice Couvreur
2015-08-30  8:36       ` Otared Kavian
2015-08-29 11:18 ` Otared Kavian

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