On 3/6/2021 11:17 AM, Fabrice Couvreur wrote:
Hi Hans,
Some time ago, you offered this code to respond to a specific request
from me. I used this code again and wanted to know if it was possible
for the title "Algorithm" to be automatically centered based on the content.
Thank you
See Wolfgangs answer.
If your using lmtx ...
\startuseMPgraphic{MyFrame}
picture p ;
p := lmt_text [
width = OverlayWidth,
height = OverlayHeight,
text = "\bfx\framedtextparameter{Title}",
color = "white",
align = "normal",
] ;
p := anchored.ulft (p, ulcorner OverlayBox shifted (0,EmWidth)) ;
fill OverlayBox withcolor "MyBlue" ;
fill boundingbox p enlarged .5EmWidth withcolor "maincolor" ;
draw p ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
watch how also maincolor is accessed as string.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________