ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Fabrice <fabrice.alpha@gmail.com>
To: ntg-context@ntg.nl
Subject: FunnyFrame in an enumeration.
Date: Tue, 23 Dec 2008 23:51:45 -0500	[thread overview]
Message-ID: <97369C02-1053-43C2-993E-0A1F65FEFB3F@gmail.com> (raw)

Hi,

	Playing with metafun, I saw the FunnyFrame example (page 239 MetaFun  
screen manual), where a framed is put around some paragraph and this  
frame has a small framed title inserted at the top of the framed  
paragraph. I would like to do a similar  output but in the context of  
an enumeration. I am able to obtain the main frame by a proper  
definition of  the \definenumeration, but not the title !

	For clarity, a sample test file is provided below.

	I have tried to look in the mailing list for some examples  that can  
help me, but no luck ! Do you think this is something feasible ? I  
wouldl take any hint  !

	Thanks,
	Fabrice.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%[ The main code of this example came actullay from a thread in 2000  
by Hans.]
% http://archive.contextgarden.net/message/20000929.130642.dc591d10.en.html

\setupcolors[state=start]

\def\FrameText#1%
{\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := btex \strut#1 etex ;
w := \overlaywidth ;
h := \overlayheight ;
o := \the\bodyfontsize/2 ;
p := p shifted (4o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled 1pt withcolor red) ;
draw (3o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p+o,h) ;
draw boundingbox p enlarged(o,0) withcolor red ;
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic}

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

\defineframedtext[FunnyText][frame=off,background=FunnyFrame,width= 
\hsize]

\def\StartFrame#1{\FrameText{#1}\startFunnyText}
\def\StopFrame {\stopFunnyText }

\starttext

\StartFrame{A nice place for a title}
The value of variables inside this fence are isolated
from the values outside.
\StopFrame

\defineenumeration[Definition]
[width=fit,
before=\StartFrame{},
after=\StopFrame,
text={Definition}
]

\startDefinition
The text of the definition.  The sentence "{\bf Definition 1}" should  
be in the above small box.
\stopDefinition


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


                 reply	other threads:[~2008-12-24  4:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=97369C02-1053-43C2-993E-0A1F65FEFB3F@gmail.com \
    --to=fabrice.alpha@gmail.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).