Define a new type section with metafun
![](https://secure.gravatar.com/avatar/8faab67a537fa9daa935dbb87b5b7076.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/23fd5fd7c9582675882a5336e1927a44.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/23fd5fd7c9582675882a5336e1927a44.jpg?s=120&d=mm&r=g)
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}
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 12/28/2014 1:00 PM, Fabrice wrote:
align={right},
align={flushright,lohi} ----------------------------------------------------------------- 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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/23fd5fd7c9582675882a5336e1927a44.jpg?s=120&d=mm&r=g)
Hi Hans, Thank you for your answer, text placement is correct as long as the policy is not too great. For cons, I'll remove the red line separation because its placement is random. Best regards, Fabrice
participants (3)
-
Akira Kakuto
-
Fabrice
-
Hans Hagen