ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marcel Takac <marcel@type.sk>
Subject: enumeration, framedtext and funny...
Date: Thu, 23 Nov 2006 00:15:05 +0100	[thread overview]
Message-ID: <4564D9F9.4040800@type.sk> (raw)

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Hi,
I'm trying to make my document in ConTeXt and in I have some problem.
Problem is in my environment for theorems. Every theorem has name and
number.

I had defined "enumeration" for them. Theorem-text is typed in framedtext,
with backround. Theorem's title is defined by \setMPtext, and is typed
in MPgraphic (\MPstring).

I want to type also theorem's number (Theorem 1, ...) instead of "Here",
but there is a problem: \MPstring{TheoremCaption} is empty.

Where I'm making mistake?

Zrejme robim niekde nejaku elementarnu chybu. Vychadzal som z prikladu v MetaFun 
Manuale, ktory som si upravoval. Mozem poprosit o nakopnutie? Je dost mozne, ze 
sa uberam uplne zlym smerom?

Thanks for your help,
Marcel

[-- Attachment #2: teor.tex --]
[-- Type: text/plain, Size: 2293 bytes --]

\setupoutput[pdf]
\setupcolors[state=start]
\setupinteraction[state=start]


\defineoverlay[TheoremFrame][\useMPgraphic{TheoremFrame}]
\defineframedtext[TheoremText][frame=off,background=TheoremFrame,width=\hsize]
\def\StartTeoFrame{\startTheoremText}
\def\StopTeoFrame {\stopTheoremText}

\def\FrameTheoremTitle#1{\setMPtext{TheoremFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{TheoremFrame}{}

\def\FrameTheoremCaption#1{\setMPtext{TheoremCaptionFrame}{\hbox spread 1em{\hss\strut#1\hss}}\useMPgraphic{TheoremCaption}}
\setMPtext{TheoremCaptionFrame}{}

\startuseMPgraphic{TheoremFrame}
 picture p, s; path a, b; pair c;
 p := textext.rt(\MPstring{TheoremFrame});
 a := unitsquare xyscaled(OverlayWidth, OverlayHeight);
 o := BodyFontSize ;
 p := p shifted (2o,OverlayHeight-ypart center p) ;
 drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
 b := a randomized (o/2) ;
 fill b withcolor .95white ; draw b ;
 c := center p;
 c := b intersectionpoint (c shifted (0,-o)--c shifted(0,o)) ;
 p := p shifted (c-center p) ;
 b := (boundingbox p) randomized (o/8) ;
 fill b withcolor .85white ; draw b ;
 draw p withcolor black;
 setbounds currentpicture to a ;
\stopuseMPgraphic


\startuseMPgraphic{TheoremCaption}
 picture p;
 p := textext.rt("Here");
% p := textext.rt(\MPstring{TheoremCaption});
 draw p rotated 90 withcolor blue;
 draw (5mm, 0)..(-2mm, 0mm) withcolor red;
\stopuseMPgraphic

\defineenumeration
 [Theorem]
 [location=right,
  headstyle=bold,
  text=Theorem ,
  command=\FrameTheoremCaption,
  location=inleft,
  before={\StartTeoFrame},
  after={\StopTeoFrame}]

\starttext

\FrameTheoremTitle{Immerman}
\startTheorem[3t9.4.00]
Theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
\stopTheorem


\stoptext

[-- Attachment #3: teor.pdf --]
[-- Type: application/pdf, Size: 25878 bytes --]

[-- Attachment #4: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

                 reply	other threads:[~2006-11-22 23:15 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=4564D9F9.4040800@type.sk \
    --to=marcel@type.sk \
    --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).