On Sun, 19 Apr 2020, Jairo A. del Rio wrote:

I've seen the following solution in Stack Exchange to add referenceable
enumeration labels to a framed enumeration environment:

https://tex.stackexchange.com/questions/438588/context-and-metafun-framed-enumeration-with-counter-as-part-of-overlay

It uses \wrappedcurrentconstruction. However, it only prints the counter
label and the counter name. What if I need the text enclosed by braces in
the frame header too? E. g. \starttheorem[thm1]{Residue theorem} so the
framed title includes "Residue theorem" also. Thank you in advance.

It works out of the box but you have to enable enumeration titles using `title=yes` key while defining the enumeration...

\startuseMPgraphic{FunnyFrame}
    picture p ; numeric w, h, o ;
    p := textext.rt("\wrappedcurrentconstruction");

    w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
    p := p shifted (2o,h-ypart center p);
    draw p ;

    path b;
    b := boundingbox p enlarged (o/10);

    drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
    draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner b,h) ;
    draw b;

    setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]

\defineframedtext
  [FunnyFramedText]
  [
    frame=off,
    background=FunnyFrame,
    offset=\bodyfontsize,
    width=\textwidth,
  ]

\defineenumeration[Counter]
  [
    title=yes,
    alternative=empty,
    before=\startFunnyFramedText,
    after=\stopFunnyFramedText,
  ]

\starttext
\startCounter[title={Residue Theorem}]
  Coming back to the use of typefaces in electronic
  publishing: many of the new typographers receive their
  knowledge and information about the rules of typography from
  books, from computer magazines or the instruction manuals
  which they get with the purchase of a PC or software.
\stopCounter

\startCounter
  Coming back to the use of typefaces in electronic
  publishing: many of the new typographers receive their
  knowledge and information about the rules of typography from
  books, from computer magazines or the instruction manuals
  which they get with the purchase of a PC or software.
\stopCounter
\stoptext

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to