In order to have the box aligned with the text, it is enough to use the \lower command as in the exmaple below.
Best regards: Otared K.
\startuniqueMPgraphic{MyShape}
path p ;
p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic
\setuplayout[grid=yes]
\defineoverlay[MyBackgroundLayer][\uniqueMPgraphic{MyShape}]
\define[1]\MyExoCommand{%
\lower\strutdepth\hbox{\startframed
[background=MyBackgroundLayer,
frame=off,
% width=3cm,
align=flushleft,
backgroundcolor=darkred]
{\white Exercice #1}
\stopframed}
}
\defineenumeration[ex]
[text=,
title=yes,
titleleft=,
titleright=,
width=fit,
alternative=top,
number=yes,
numbercommand=\MyExoCommand]
\showgrid
\starttext
\startex{Pour tous les candidats \hfill 5 points}
\input ward
\stopex
\stoptext
%% end
Hello Kavian,
Thank you for your answer, it's good for the parentheses. For the command, I found only this which does not exactly answer what I want to do.
Fabrice
\defineenumeration
[ex]
[text={Exercice},
headcommand=\EXFRAME,
titleleft=,
titleright=,
title=yes,
width=fit,
numberconversionset=ACCONVERSION,
alternative=top,
number=yes]
___________________________________________________________________________________
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-contextwebpage :
http://www.pragma-ade.nl /
http://context.aanhet.netarchive :
https://bitbucket.org/phg/context-mirror/commits/wiki :
http://contextgarden.net___________________________________________________________________________________