* Overlays that vary with page number
@ 2002-05-23 4:17 Johannes Hüsing
2002-05-27 20:13 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Hüsing @ 2002-05-23 4:17 UTC (permalink / 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Overlays that vary with page number
2002-05-23 4:17 Overlays that vary with page number Johannes Hüsing
@ 2002-05-27 20:13 ` Hans Hagen
2002-05-28 5:16 ` Johannes Hüsing
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2002-05-27 20:13 UTC (permalink / raw)
Cc: ntg-context
At 06:17 AM 5/23/2002 +0200, Johannes Hüsing wrote:
>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?
right, by default (speed issue) only
page leftpage rightpage print and text
are calculated each page (as well as a couple of 'secret' ones when used by
core things. However, you can set:
\setupbackgrounds[state=repeat]
(grep on state=repeat in s-pre-*)
after which backgrounds are calculated each time (still not that slow
because it's quit eoptimized)
also, watch out : you need to specify text (column) as well as header
(column) for backgrounds
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Overlays that vary with page number
2002-05-27 20:13 ` Hans Hagen
@ 2002-05-28 5:16 ` Johannes Hüsing
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Hüsing @ 2002-05-28 5:16 UTC (permalink / raw)
On Mon, May 27, 2002 at 10:13:35PM +0200, Hans Hagen wrote:
[...]
>
> \setupbackgrounds[state=repeat]
>
[...]
This worked. Thank you!
Greetings
Johannes
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-28 5:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-23 4:17 Overlays that vary with page number Johannes Hüsing
2002-05-27 20:13 ` Hans Hagen
2002-05-28 5:16 ` Johannes Hüsing
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).