ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jeong Dal <haksan@me.com>
To: ntg-context@ntg.nl
Subject: Re: How to put title and counter of the enumeration env.	in the FrameTitle?
Date: Sat, 05 Dec 2015 09:14:30 +0900	[thread overview]
Message-ID: <A7CAD6A6-46F1-435D-8CBE-BF5044E69235@me.com> (raw)
In-Reply-To: <mailman.187.1449199309.31294.ntg-context@ntg.nl>

Dear all,

I found a partial solution for my former question which still have problems.

1. I set a new counter “ThmNumber” and use it in the FrameTitle. Its output is similar to what I want. 
2. insert “after={\doglobal\increment\ThmNumber}” in the enumeration environment.
3. But the Initial value of ThmNumber is 0 even though \setcounter\ThmNumber1.

Please enhance the sample code which works nicer way.
Also, where can I find good explanation on “counter”?

Thank you for reading.

Best regards,

Dalyoung


%%%%%
\newcounter\ThmNumber
\setcounter\ThmNumber1
\increment\ThmNumber

\startuseMPgraphic{FunnyFrame} 
picture p ; numeric o ; path a, b ; pair c ; 
p := textext.rt(\MPstring{FunnyFrame}) ; 
o := BodyFontSize ; 
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; 
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[FunnyFrame][\useMPgraphic{FunnyFrame}] 

\defineframedtext[Thm]
[frame=off,
background=FunnyFrame,
offset=\bodyfontsize, 
increment=yes,
width=\textwidth,
after={\doglobal\increment\ThmNumber}]%\overlaywidth]%

\def\FrameTitle#1% 
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut\ss\bf #1\hss}}} 

\starttext
This is a test for Framed Theorem.

I'd like to put \quote{Theorem \#1(Some Title)} in a small frame and the main text in the big frame.

\blank[big]

{\FrameTitle{Theorem \ThmNumber} 
\startThm
	First theorem\par
	\input knuth
\stopThm}

{\FrameTitle{Theorem \ThmNumber} 
\startThm
	First theorem\par
	\input knuth
\stopThm}

\stoptext
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

       reply	other threads:[~2015-12-05  0:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.187.1449199309.31294.ntg-context@ntg.nl>
2015-12-05  0:14 ` Jeong Dal [this message]
2015-12-08 13:45 Jeong Dal
  -- strict thread matches above, loose matches on Subject: below --
2015-12-03 22:44 Jeong Dal

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=A7CAD6A6-46F1-435D-8CBE-BF5044E69235@me.com \
    --to=haksan@me.com \
    --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).