* FunnyFrame in an enumeration.
@ 2008-12-24 4:51 Fabrice
0 siblings, 0 replies; only message in thread
From: Fabrice @ 2008-12-24 4:51 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-12-24 4:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-24 4:51 FunnyFrame in an enumeration Fabrice
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).