* Define a new type section with metafun
@ 2014-12-27 23:01 Akira Kakuto
2014-12-27 23:49 ` Hans Hagen
0 siblings, 1 reply; 7+ messages in thread
From: Akira Kakuto @ 2014-12-27 23:01 UTC (permalink / raw)
To: ntg-context
Dear Fabrice,
A try and error method which you may not want:
% macros=mkvi
\setuppapersize[A4][A4]
\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]
\starttext
\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw (20,1)--(20,h-1) withcolor red ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=0.5\textwidth,
align={right},
framecolor=mycolor,
rulethickness=1.5pt,
backgroundcolor=white,
offset=4pt]
{\tfb #1\space\colortext#2}}
\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]
\section{A}{PLAN DE L'ESPACE}
\stoptext
Best,
Akira
___________________________________________________________________________________
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] 7+ messages in thread
* Re: Define a new type section with metafun
2014-12-27 23:01 Define a new type section with metafun Akira Kakuto
@ 2014-12-27 23:49 ` Hans Hagen
2014-12-28 11:25 ` Fabrice
0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2014-12-27 23:49 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 12/28/2014 12:01 AM, Akira Kakuto wrote:
> Dear Fabrice,
>
> A try and error method which you may not want:
>
> % macros=mkvi
> \setuppapersize[A4][A4]
>
> \setupcolors[state=start,cmyk=yes,mpcmyk=yes]
> \definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
> \definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]
>
> \starttext
>
> \startuniqueMPgraphic{funny}
> path p ;
> numeric h ;
> h := OverlayHeight ;
> p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
> 0.9 ;
> pickup pencircle scaled \overlaylinewidth ;
> fill p withcolor \MPcolor{\overlaycolor} ;
> draw (20,1)--(20,h-1) withcolor red ;
> draw p withcolor \MPcolor{\overlaylinecolor} ;
> \stopuniqueMPgraphic
>
> \defineoverlay[funny][\uniqueMPgraphic{funny}]
>
> \define[2]\MySectionCommand
> {\framed
> [background=funny,
> frame=off,
> width=0.5\textwidth,
> align={right},
> framecolor=mycolor,
> rulethickness=1.5pt,
> backgroundcolor=white,
> offset=4pt]
> {\tfb #1\space\colortext#2}}
>
> \setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]
>
>
> \section{A}{PLAN DE L'ESPACE}
> \stoptext
or reshuffle the drawing a bit and clip
\startuniqueMPgraphic{funny}
numeric h ; h := OverlayHeight ;
path p ; p := unitsquare xscaled \overlaywidth yscaled
\overlayheight superellipsed 0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw (20,-1)--(20,h+1) withcolor red ;
clip currentpicture to p ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
-----------------------------------------------------------------
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] 7+ messages in thread
* Re: Define a new type section with metafun
2014-12-27 23:49 ` Hans Hagen
@ 2014-12-28 11:25 ` Fabrice
2014-12-28 12:00 ` Fabrice
0 siblings, 1 reply; 7+ messages in thread
From: Fabrice @ 2014-12-28 11:25 UTC (permalink / raw)
To: ntg-context
Thank you to Akira and Hans for these solutions.
How do now to the numbering and the title text are equidistant from the
red line separation ?
Fabrice
___________________________________________________________________________________
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] 7+ messages in thread
* Re: Define a new type section with metafun
2014-12-28 11:25 ` Fabrice
@ 2014-12-28 12:00 ` Fabrice
2014-12-28 17:27 ` Hans Hagen
0 siblings, 1 reply; 7+ messages in thread
From: Fabrice @ 2014-12-28 12:00 UTC (permalink / raw)
To: ntg-context
Another worry: when the title is too long, there is a line break, which
is normal, but what follows is under the dial.
Thanks,
Fabrice
% macros=mkvi
\setuppapersize[A4][A4]
\setuphead
[section]
[sectionstopper={},
conversion=Characters,
sectionsegments=section:section]
\setuphead
[subsection]
[sectionstopper={},
sectionsegments=subsection:subsection,
conversion=number,]
\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]
\starttext
\startuniqueMPgraphic{funny}
numeric h ; h := OverlayHeight ;
path p ; p := unitsquare xscaled \overlaywidth yscaled
\overlayheight superellipsed 0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw (20,-1)--(20,h+1) withcolor red ;
clip currentpicture to p ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=fit,
align={right},
framecolor=mycolor,
rulethickness=1.5pt,
backgroundcolor=white,
offset=6pt]
{#1\space\colortext#2}}
\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]
\section{A}{REPRÉSENTATION EN PERSPECTIVE CAVALIÈRE ET RÈGLES DE BASE}
\subsection{Représentation en perspective cavalière de solides}
___________________________________________________________________________________
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] 7+ messages in thread
* Define a new type section with metafun
@ 2014-12-26 22:26 Fabrice Couvreur
0 siblings, 0 replies; 7+ messages in thread
From: Fabrice Couvreur @ 2014-12-26 22:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1217 bytes --]
Hi,
I wish red separation is exactly in the middle of the dial and the title of the
section. Then, the line is too long, it should not exceed the boundary of
the ellipse.
Best regards,
Fabrice
% macros=mkvi
\setuppapersize[A4][A4]
\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]
\starttext
\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
draw (20,0)--(20,h) withcolor red ;
\stopuniqueMPgraphic
\defineoverlay[funny][\uniqueMPgraphic{funny}]
\define[2]\MySectionCommand
{\framed
[background=funny,
frame=off,
width=0.5\textwidth,
align={right},
framecolor=mycolor,
rulethickness=1.5pt,
backgroundcolor=white,
offset=4pt]
{\tfb #1\space\colortext#2}}
\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]
\section{A}{PLAN DE L'ESPACE}
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 2191 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] 7+ messages in thread
end of thread, other threads:[~2014-12-29 10:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 23:01 Define a new type section with metafun Akira Kakuto
2014-12-27 23:49 ` Hans Hagen
2014-12-28 11:25 ` Fabrice
2014-12-28 12:00 ` Fabrice
2014-12-28 17:27 ` Hans Hagen
2014-12-29 10:25 ` Fabrice
-- strict thread matches above, loose matches on Subject: below --
2014-12-26 22: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).