* Some questions about an environment (Metafun)
@ 2015-08-04 15:04 Fabrice Couvreur
2015-08-04 16:02 ` Aditya Mahajan
2015-08-04 18:08 ` Hans Hagen
0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2015-08-04 15:04 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1339 bytes --]
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
?
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
[-- Attachment #1.2: Type: text/html, Size: 2043 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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-04 15:04 Some questions about an environment (Metafun) Fabrice Couvreur
@ 2015-08-04 16:02 ` Aditya Mahajan
2015-08-04 19:30 ` Fabrice Couvreur
2015-08-04 18:08 ` Hans Hagen
1 sibling, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2015-08-04 16:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, 4 Aug 2015, Fabrice Couvreur wrote:
> How to have Definition 1, Definition 2, Definition 3 ... ?
\defineenumeration[definition][text=Definition]
Aditya
___________________________________________________________________________________
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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-04 15:04 Some questions about an environment (Metafun) Fabrice Couvreur
2015-08-04 16:02 ` Aditya Mahajan
@ 2015-08-04 18:08 ` Hans Hagen
2015-08-04 19:26 ` Fabrice Couvreur
1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2015-08-04 18:08 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-04 18:08 ` Hans Hagen
@ 2015-08-04 19:26 ` Fabrice Couvreur
0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2015-08-04 19:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 3810 bytes --]
Hi Hans,
Thank you for your suggestion, but it's not what I want, but I probably
misstated my request. For me, the image p contains the text "Définition 1", and
this is what I want orange rectangle translate to the left edge of the text
area.
Am I more clearly ?
Fabrice
2015-08-04 20:08 GMT+02:00 Hans Hagen <pragma@wxs.nl>:
> 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
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 6641 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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-04 16:02 ` Aditya Mahajan
@ 2015-08-04 19:30 ` Fabrice Couvreur
2015-08-06 21:38 ` Fabrice Couvreur
0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Couvreur @ 2015-08-04 19:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 882 bytes --]
Hi Aditya,
Thank you, I have already thought of this solution, but I do not know
to use with
the environment that I created.
Fabrice
2015-08-04 18:02 GMT+02:00 Aditya Mahajan <adityam@umich.edu>:
> On Tue, 4 Aug 2015, Fabrice Couvreur wrote:
>
> How to have Definition 1, Definition 2, Definition 3 ... ?
>>
>
> \defineenumeration[definition][text=Definition]
>
> Aditya
>
> ___________________________________________________________________________________
> 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: 2116 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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-04 19:30 ` Fabrice Couvreur
@ 2015-08-06 21:38 ` Fabrice Couvreur
2015-08-07 12:26 ` Hans Hagen
0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Couvreur @ 2015-08-06 21:38 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 2568 bytes --]
Hi,
The following code (Metafun documentation, thanks again Hans !) is fully
understood and works very well. Sorry if I insist, but can we create a
counter to avoid writing \FrameTitle{Définition 1},
\FrameTitle{Définition 2}... ?
Thus, the only invocation \startMyText ... \stopMyText, \startMyText ... \
stopMyText ... this return Définition 1, Définition 2 ...
Thank you,
Fabrice
\setupbodyfont [palatino,11pt]
\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]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
\defineframedtext
[MyText]
[frame=off,
background=MyFrame,
width=\textwidth,
location=right]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}
\def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}
\setMPtext{MyFrame}{}
\startuseMPgraphic{MyFrame}
path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (2o,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
\FrameTitle{Définition 1}
\startMyText
\input knuth
\stopMyText
\FrameTitle{Définition 2}
\startMyText
\input knuth
\stopMyText
\stoptext
2015-08-04 21:30 GMT+02:00 Fabrice Couvreur <fabrice1.couvreur@gmail.com>:
> Hi Aditya,
> Thank you, I have already thought of this solution, but I do not know to
> use with the environment that I created.
> Fabrice
>
> 2015-08-04 18:02 GMT+02:00 Aditya Mahajan <adityam@umich.edu>:
>
>> On Tue, 4 Aug 2015, Fabrice Couvreur wrote:
>>
>> How to have Definition 1, Definition 2, Definition 3 ... ?
>>>
>>
>> \defineenumeration[definition][text=Definition]
>>
>> Aditya
>>
>> ___________________________________________________________________________________
>> 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: 5787 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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-06 21:38 ` Fabrice Couvreur
@ 2015-08-07 12:26 ` Hans Hagen
2015-08-07 15:11 ` Fabrice Couvreur
0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2015-08-07 12:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 8/6/2015 11:38 PM, Fabrice Couvreur wrote:
> Hi,
> The following code (Metafun documentation, thanks again Hans !) is fully
> understood and works very well. Sorry if I insist, but can we create a
> counter to avoid writing \FrameTitle{Définition 1},
> \FrameTitle{Définition 2}... ?
> Thus, the only invocation \startMyText ... \stopMyText, \startMyText ...
> \stopMyText... this return Définition 1, Définition 2 ...
> Thank you,
> Fabrice
>
>
> \setupbodyfont [palatino,11pt]
>
> \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]
>
> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>
> \defineframedtext
> [MyText]
> [frame=off,
> background=MyFrame,
> width=\textwidth,
> location=right]
>
> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>
> \def\StartFrame{\startMyText}
> \def\StopFrame{\startMyText}
>
> \def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
> 1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}
>
> \setMPtext{MyFrame}{}
>
> \startuseMPgraphic{MyFrame}
> path a ;
> path b ;
> picture p ;
> o := BodyFontSize ;
> p :=textext.rt(\MPstring{MyFrame}) ;
> p := p shifted (2o,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
> \FrameTitle{Définition 1}
> \startMyText
> \input knuth
> \stopMyText
> \FrameTitle{Définition 2}
> \startMyText
> \input knuth
> \stopMyText
> \stoptext
>
\setupbodyfont [palatino,11pt]
\definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]
\definecolor[MyColorA][.75(MyColorB,white)] %c=0.00, m=0.10, y=0.20,
k=0.00]
\defineframedtext
[MyText]
[frame=off,
background=MyFrame,
width=\textwidth,
location=right]
\defineoverlay
[MyFrame]
[\useMPgraphic{MyFrame}]
\definelabel
[Définition]
[headstyle=\bf\smallcaps]
\startuseMPgraphic{MyFrame}
path b ;
picture p ;
p := textext.rt("\white\Définition") ; % some day textext might
handle it okay
p := p shifted (2BodyFontSize,OverlayHeight-ypart center
p+.25ExHeight) ;
b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth ;
fill OverlayBox withcolor \MPcolor{MyColorA} ;
fill b withcolor \MPcolor{MyColorB} ;
draw p ;
\stopuseMPgraphic
\starttext
\startMyText
\input knuth
\stopMyText
\startMyText
\input knuth
\stopMyText
\stoptext
> 2015-08-04 21:30 GMT+02:00 Fabrice Couvreur <fabrice1.couvreur@gmail.com
> <mailto:fabrice1.couvreur@gmail.com>>:
>
> Hi Aditya,
> Thank you, I have already thought of this solution, but I do not
> know to use with the environment that I created.
> Fabrice
>
> 2015-08-04 18:02 GMT+02:00 Aditya Mahajan <adityam@umich.edu
> <mailto:adityam@umich.edu>>:
>
> On Tue, 4 Aug 2015, Fabrice Couvreur wrote:
>
> How to have Definition 1, Definition 2, Definition 3 ... ?
>
>
> \defineenumeration[definition][text=Definition]
>
> Aditya
> ___________________________________________________________________________________
> 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
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
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] 8+ messages in thread
* Re: Some questions about an environment (Metafun)
2015-08-07 12:26 ` Hans Hagen
@ 2015-08-07 15:11 ` Fabrice Couvreur
0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2015-08-07 15:11 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 5788 bytes --]
Hi Hans,
Thank you for responding to my request, it's really nice. By cons I do not
understand what you mean "
some day textext might handle it okay"
Fabrice
2015-08-07 14:26 GMT+02:00 Hans Hagen <pragma@wxs.nl>:
> On 8/6/2015 11:38 PM, Fabrice Couvreur wrote:
>
>> Hi,
>> The following code (Metafun documentation, thanks again Hans !) is fully
>> understood and works very well. Sorry if I insist, but can we create a
>> counter to avoid writing \FrameTitle{Définition 1},
>> \FrameTitle{Définition 2}... ?
>> Thus, the only invocation \startMyText ... \stopMyText, \startMyText ...
>> \stopMyText... this return Définition 1, Définition 2 ...
>>
>> Thank you,
>> Fabrice
>>
>>
>> \setupbodyfont [palatino,11pt]
>>
>> \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]
>>
>> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>>
>> \defineframedtext
>> [MyText]
>> [frame=off,
>> background=MyFrame,
>> width=\textwidth,
>> location=right]
>>
>> \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]
>>
>> \def\StartFrame{\startMyText}
>> \def\StopFrame{\startMyText}
>>
>> \def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
>> 1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}
>>
>> \setMPtext{MyFrame}{}
>>
>> \startuseMPgraphic{MyFrame}
>> path a ;
>> path b ;
>> picture p ;
>> o := BodyFontSize ;
>> p :=textext.rt(\MPstring{MyFrame}) ;
>> p := p shifted (2o,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
>> \FrameTitle{Définition 1}
>> \startMyText
>> \input knuth
>> \stopMyText
>> \FrameTitle{Définition 2}
>> \startMyText
>> \input knuth
>> \stopMyText
>> \stoptext
>>
>>
> \setupbodyfont [palatino,11pt]
>
> \definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]
> \definecolor[MyColorA][.75(MyColorB,white)] %c=0.00, m=0.10, y=0.20,
> k=0.00]
>
> \defineframedtext
> [MyText]
> [frame=off,
> background=MyFrame,
> width=\textwidth,
> location=right]
>
> \defineoverlay
> [MyFrame]
> [\useMPgraphic{MyFrame}]
>
> \definelabel
> [Définition]
> [headstyle=\bf\smallcaps]
>
> \startuseMPgraphic{MyFrame}
> path b ;
> picture p ;
> p := textext.rt("\white\Définition") ; % some day textext might handle
> it okay
> p := p shifted (2BodyFontSize,OverlayHeight-ypart center
> p+.25ExHeight) ;
> b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth ;
> fill OverlayBox withcolor \MPcolor{MyColorA} ;
> fill b withcolor \MPcolor{MyColorB} ;
> draw p ;
> \stopuseMPgraphic
>
> \starttext
>
> \startMyText
> \input knuth
> \stopMyText
>
> \startMyText
> \input knuth
> \stopMyText
>
> \stoptext
>
> 2015-08-04 21:30 GMT+02:00 Fabrice Couvreur <fabrice1.couvreur@gmail.com
>> <mailto:fabrice1.couvreur@gmail.com>>:
>>
>> Hi Aditya,
>> Thank you, I have already thought of this solution, but I do not
>> know to use with the environment that I created.
>> Fabrice
>>
>> 2015-08-04 18:02 GMT+02:00 Aditya Mahajan <adityam@umich.edu
>> <mailto:adityam@umich.edu>>:
>>
>> On Tue, 4 Aug 2015, Fabrice Couvreur wrote:
>>
>> How to have Definition 1, Definition 2, Definition 3 ... ?
>>
>>
>> \defineenumeration[definition][text=Definition]
>>
>> Aditya
>>
>> ___________________________________________________________________________________
>> 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
>> 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
>>
>> ___________________________________________________________________________________
>>
>>
>
> --
>
> -----------------------------------------------------------------
> 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: 9299 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] 8+ messages in thread
end of thread, other threads:[~2015-08-07 15:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-04 15:04 Some questions about an environment (Metafun) 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
2015-08-04 19:26 ` Fabrice Couvreur
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).