From: Marco Patzer <homerow@lavabit.com>
To: ntg-context@ntg.nl
Subject: Re: text overlayed
Date: Mon, 4 Mar 2013 12:37:58 +0100 [thread overview]
Message-ID: <20130304113758.GN29684@homerow> (raw)
In-Reply-To: <loom.20130304T114454-503@post.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1491 bytes --]
On 2013–03–04 Roland Thiers wrote:
> I'm learning a little bit of metapost language, using metafun manual.
> I made some background for a title (surely the code is awful, thanks
> for suggestions of improvement) but it's static, i'd like to adapt it to
> the widthof the text. I don't know if it is possible from my code
> and if it is i don't know how to do !
You can use the variable OverlayWidth to obtain the width of the
overlay, which is determined by the provided text. You can use it as
follows:
\setuplayout
[backspace=6cm]
\startuniqueMPgraphic{essai}
path p,p',q,q';
w:=2OverlayWidth;
p := (0,0.1cm) -- (w,0.3cm);
q := (11cm,-0.7cm) -- (w,2.2cm);
p':= (w,1.3cm) -- (-0.4cm,1.4cm);
q':= (0.3cm,2.4cm) -- (0.2cm,-0.3cm);
pickup pencircle scaled 1mm;
drawoptions(withcolor 0.3white);
draw p; draw p';
draw q; draw q';
pair A; A:=q'intersectionpoint p';
pair B; B:=q intersectionpoint p';
pair C; C:=p intersectionpoint q;
pair D; D:=q'intersectionpoint p;
path s; s:= A--B--C--D--cycle;
fill s withcolor .8white;
\stopuniqueMPgraphic
\defineoverlay
[encadrement]
[\uniqueMPgraphic{essai}]
\defineframed
[boxframed]
[frame=off,
foregroundstyle=bolditalic,
foregroundcolor=darkred,
background=encadrement]
\starttext
\boxframed{Devoir de mathématiques}
\blank [2cm]
\boxframed{Devoir de mathématiques and some more text}
\stoptext
Marco
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2013-03-04 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 11:02 Roland Thiers
2013-03-04 11:37 ` Marco Patzer [this message]
2013-03-04 13:30 ` Roland Thiers
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=20130304113758.GN29684@homerow \
--to=homerow@lavabit.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).