ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: referencing the customized enumeration with framed title
Date: Fri, 12 Jan 2018 15:51:17 +0100	[thread overview]
Message-ID: <8b8d947d-8d0c-6c14-e63e-7ed10c44a667@wxs.nl> (raw)
In-Reply-To: <B146BCFF-FA7E-4D89-9884-8481BB9D432A@me.com>

On 1/12/2018 3:54 AM, Jeong Dal wrote:
> Hi,
> 
> Some time ago, I am able to use following code(the framed title for Theorems and etc.)
> Thank Wolfgang and Otared again.
> 
> Since it uses the customized style of numbering, there is a problem to reference them.
> As in the following code, \in{Definition}[] shows no number and \in{Theorem}[] shows ?? instead of numbers while \in{Exam}[] shows correctly.
> 
> Is there a way to show the numbers correctly?
% in cont-new.mkiv:

\unprotect

\defineconstructionalternative
   [\v!empty]
   [\c!renderingsetup=\??constructionrenderings:\v!empty]

\startsetups[\??constructionrenderings:\v!empty]
     \noindent
     \useconstructionstyleandcolor\c!style\c!color
     \ignorespaces
\stopsetups

\protect

% till here

\defineenumeration[Theorem]
   [alternative=empty,
    before=\startMyText,
    after=\stopMyText]

\defineframed
   [MyFramed]
   [frame=off,
    loffset=1ex,
    roffset=1ex,
    foregroundstyle=\ssbf]

\startuseMPgraphic{MyFrame}
     picture p ; numeric o ; path a, b ; pair c ;
     p := textext.rt("\MyFramed{\currentconstructiontext}") ;
  %  p := 
textext.rt("\wrappedconstruction{\MyFramed{\currentconstructiontext}}") ;
  %  p := 
textext.rt("\MyFramed{\wrappedconstruction{\currentconstructiontext}}") ;
  %  p := textext.rt("\MyFramed{\wrappedcurrentconstruction}") ;
     o := BodyFontSize ;
     a := OverlayBox ;
     p := p shifted (2o,OverlayHeight-ypart center p) ;
     drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
     b := a superellipsed .95 ;
     draw b ;
     b := (boundingbox p) superellipsed .95 ;
     fill b withcolor .85white ;
     draw b ;
     draw p withcolor black ;
     setbounds currentpicture to a ;
\stopuseMPgraphic

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
   [MyText]
   [frame=off,
    background=MyFrame,
    offset=\bodyfontsize,
    width=\textwidth]

\starttext

\startTheorem[lem]
     bla bla
\stopTheorem

Bla bla \in {Lemma} [lem] bla bla.

\stoptext



-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

      parent reply	other threads:[~2018-01-12 14:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1.1515668401.1779.ntg-context@ntg.nl>
2018-01-12  2:54 ` Jeong Dal
2018-01-12 14:31   ` Hans Hagen
2018-01-12 16:22     ` Jeong Dal
2018-01-12 18:19       ` Hans Hagen
2018-07-24 23:40         ` unable to define 'texgyrepagella-regula' error etc Jeong Dal
2018-07-25  8:19           ` Otared Kavian
2018-07-26  0:49         ` Jeong Dal
2018-07-26  8:24           ` Hans Hagen
2018-07-26 14:53             ` Jeong Dal
2018-07-26 15:24               ` Hans Hagen
2018-01-12 14:51   ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b8d947d-8d0c-6c14-e63e-7ed10c44a667@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).