From: "Johannes Hüsing" <hannes@ruhrau.de>
Subject: Overlays that vary with page number
Date: Thu, 23 May 2002 06:17:32 +0200 [thread overview]
Message-ID: <20020523061732.B544@ruhrau.de> (raw)
In the accompanying lines I have attempted to insert a graphic in the
footer that changes with every new page. While the graphic in the text
adapts itself to roughly the page it sits on, the overlay in the footer
always stays the same. Why is that so, and how can this be remedied?
Greetings
Johannes
\setupoutput[pdftex]
\runMPgraphicstrue
\protectbufferstrue
\defineoverlay
[test]
[{\setupMPvariables[band][seite=\pagenumber,
anzahlseiten=\totalnumberofpages]
\useMPgraphic{band}}]
\setupbackgrounds
[footer]
[background=test]
\startuseMPgraphic{band}
def norm(expr a) =
xpart(a)++ypart(a)
enddef;
def cctangent(expr rs, rr, zs, zr, d) =
pair ts, tr;
alpha := angle((norm(zs-zr), rs-rr));
beta := angle(zs-zr);
ts := zs + (0, d*rs) rotated (beta+(d*alpha));
tr := zr + (0, d*rr) rotated (beta+(d*alpha));
draw ts--tr;
enddef ;
pair z_rspule, z_rrolle, t_rspule, t_rrolle,
z_lspule, z_lrolle, t_lspule, t_lrolle;
numeric a_lwick, a_rwick, r_lwick, r_rwick;
LoadPageState;
zeit := 45*PageNumber/(NOfPages+1); % Zeit in Minuten (0-45) auf einer C90
% zeit := \MPvar{seite}/\MPvar{anzahlseiten}*45; % Zeit in Minuten (0-45) auf einer C90
u := 2pt; % Maßeinheit
r_lspule := 2u; % Radius der linken Spule
r_rspule := r_lspule; % Radius der rechten Spule
r_lrolle := 1u; % Radius der linken Rolle
r_rrolle := 1u; % Radius der rechten Rolle
z_lspule := (-10u,10u); % Mittelpunkt der linken Spule
z_rspule := ( 10u,10u); % Mittelpunkt der rechten Spule
z_lrolle := (-15u,0u); % Mittelpunkt der linken Rolle
z_rrolle := ( 15u,0u); % Mittelpunkt der rechten Rolle
% label.top(decimal zeit, z_lspule);
% Die Stärke der Wicklung wird folgendermaßen berechnet:
% Die Zeit ist proportional zur Fläche, die Fläche ist
% das Quadrat des Durchmessers minus dem Quadrat des
% Durchmessers der Spule.
geswick := 450; % Gesamtfläche der Wicklung auf den Spulen
geszeit := 45; % Gesamtspieldauer
a_lwick + a_rwick = geswick;
a_lwick = geswick*zeit/geszeit;
r_lwick = sqrt(a_lwick+(r_lspule*r_lspule));
r_rwick = sqrt(a_rwick+(r_rspule*r_rspule));
% Zeichne gewickeltes Band auf beiden Spulen, nimm
% Spulen wieder aus. Zeichne Umlenkrollen.
fill fullcircle scaled (2*r_lwick) shifted z_lspule ;
unfill fullcircle scaled (2*r_lspule) shifted z_lspule ;
draw fullcircle scaled (2*r_lrolle) shifted z_lrolle ;
fill fullcircle scaled (2*r_rwick) shifted z_rspule ;
unfill fullcircle scaled (2*r_rspule) shifted z_rspule ;
draw fullcircle scaled (2*r_rrolle) shifted z_rrolle ;
% Zeichne Band zwischen Spulen und Rollen.
cctangent(r_lwick, r_lrolle, z_lspule, z_lrolle, 1);
cctangent(r_rwick, r_rrolle, z_rspule, z_rrolle, -1);
% Zeichne Band zwischen den beiden Rollen.
cctangent(r_rrolle, r_lrolle, z_rrolle, z_lrolle, -1);
% cstangent(r_rrolle, r_lrolle, z_rrolle, z_lrolle);
\stopuseMPgraphic
\starttext
\dorecurse{20}{%
\input tufte \par
\setupMPvariables[band][seite=\pagenumber,
anzahlseiten=\totalnumberofpages]
\inmargin{\useMPgraphic{band}}}
\stoptext
--
Johannes Hüsing There is something fascinating about science. One gets
hannes@ruhrau.de such wholesale returns of conjecture from such a
trifling investment of fact. Mark Twain
next reply other threads:[~2002-05-23 4:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-23 4:17 Johannes Hüsing [this message]
2002-05-27 20:13 ` Hans Hagen
2002-05-28 5:16 ` Johannes Hüsing
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=20020523061732.B544@ruhrau.de \
--to=hannes@ruhrau.de \
--cc=johannes.huesing@ruhrau.de \
/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).