\setuppapersize
[S6][S6]
\setuplayout
[topspace=48pt,
backspace=48pt,
cutspace=12pt,
width=400pt,
margin=0cm,
rightedge=88pt,
rightedgedistance=48pt,
header=0cm,
footer=0cm,
height=middle]
\setupwhitespace
[big]
\setupcolors
[state=start]
\definecolor [red] [r=.75]
\definecolor [yellow] [r=.75,g=.75]
\definecolor [gray] [s=.50]
\definecolor [white] [s=.85]
\definecolor [PageColor] [yellow]
\definecolor [TextColor] [white]
\definecolor [OrnamentColor] [red]
\definecolor [InteractionColor] [red]
\definecolor [ContrastColor] [gray]
\setupinteraction
[state=start,
click=off,
color=InteractionColor,
contrastcolor=ContrastColor,
menu=on]
\setupinteractionmenu
[right]
[frame=off,
position=yes,
align=middle,
topoffset=-.75cm,
bottomoffset=-.75cm,
color=gray,
contrastcolor=gray,
style=bold,
before=,
after=]
\startinteractionmenu[right]
\placelist[Topic][alternative=right]
\vfill
\but [CloseDocument] close \\
\stopinteractionmenu
\setupbackgrounds
[page]
[background=page]
\defineoverlay
[page]
[\useMPgraphic{page}]
\setupMPvariables
[page]
[alternative=3]
\startuseMPgraphic{page}
\includeMPgraphic{rightsuperbutton}
StartPage ;
path p, q ; pickup pencircle scaled 3pt ;
p := Field[Text][Text] enlarged 36pt superellipsed .90 ;
fill Page withcolor \MPcolor{PageColor} ;
fill p withcolor \MPcolor{TextColor} ;
draw p withcolor \MPcolor{OrnamentColor} ;
p := Field[Text][Text] enlarged 48pt superellipsed .90 ;
def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
if (pp>0) and (rr>0) :
q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
fill q withcolor \MPcolor{TextColor} ;
draw q withcolor if rr=2 : \MPcolor{ContrastColor}
else : \MPcolor{InteractionColor} fi ;
fi ;
enddef ;
\MPmenubuttons{right}
StopPage ;
\stopuseMPgraphic
\startuseMPgraphic{page}
\includeMPgraphic{rightsuperbutton}
StartPage ;
numeric alternative, seed, superness, squeezeness, randomness ;
path p, q ; transform t ;
alternative := \MPvar{alternative} ;
seed := uniformdeviate 100 ;
if alternative > 10 :
superness := .85 + ((\realfolio-1)/\lastpage) * .15 ;
squeezeness := 12pt - ((\realfolio-1)/\lastpage) * 10pt ;
else :
superness := .90 ;
squeezeness := 12pt ;
fi ;
randomness := squeezeness ;
alternative := alternative mod 10 ;
t := identity if alternative=3: shifted (9pt,-9pt) fi ;
randomseed := seed ;
p := Field[Text][Text] enlarged if
alternative = 1 : 36pt superellipsed superness elseif
alternative = 2 : 36pt squeezed squeezeness elseif
alternative = 3 : 36pt randomized randomness else
: 36pt fi ;
pickup pencircle scaled 3pt ;
fill Page withcolor \MPcolor{PageColor} ;
fill p withcolor \MPcolor{TextColor} ;
draw p withcolor \MPcolor{OrnamentColor} ;
randomseed := seed ;
p := ( Field[Text][Text] enlarged if
alternative = 1 : 48pt superellipsed superness elseif
alternative = 2 : 48pt squeezed squeezeness elseif
alternative = 3 : 36pt randomized randomness else
: 48pt fi ) transformed t ;
def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
if (pp>0) and (rr>0) :
q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
fill q withcolor \MPcolor{TextColor} ;
draw q withcolor if rr=2 : \MPcolor{ContrastColor}
else : \MPcolor{InteractionColor} fi ;
fi ;
enddef ;
\MPmenubuttons{right}
StopPage ;
\stopuseMPgraphic
\startuseMPgraphic{rightsuperbutton}
vardef rightsuperbutton (expr pat, xpos, ypos, wid, hei) =
save p, ptop, pbot, t, b, edge, shift, width, height ;
path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;
edge := xpos + wid ; shift := ypos + hei ;
p := rightpath pat ;
ptop := ((-infinity,shift)--(edge,shift)) ;
pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;
t := p intersection_point ptop ;
b := p intersection_point pbot ;
p := subpath(0,xpart (p intersectiontimes ptop)) of p ;
p := subpath(xpart (p intersectiontimes pbot),length(p)) of p ;
(p -- t -- point 1 of ptop &
point 1 of ptop -- point 1 of pbot &
point 1 of pbot -- b
-- cycle)
enddef ;
\stopuseMPgraphic
\definehead
[Topic]
[chapter]
\setuphead
[Topic]
[number=no]
\setuplist
[Topic]
[criterium=all,
style=bold,
before=,
after=]
\def\StartTitlePage
{\startstandardmakeup
\switchtobodyfont[big]
\def\\{\vfill\bfb\let\\=\par}
\bfd\setupinterlinespace\gray
\vskip.5cm}
\def\StopTitlePage
{\\\vskip.5cm
\stopstandardmakeup}
\def\TitlePage#1
{\StartTitlePage#1\StopTitlePage}
\def\Subject {\Topic}
\def\Topics #1{}
\def\Subjects {}
\doifnotmode{demo}{\endinput}
\starttext
\setupMPvariables[page][alternative=3]
\TitlePage
{A Few Nice Quotes\\
A Simple Style Demo\\
Hans Hagen, August 2000}
\Topic {Douglas R. Hofstadter} \input douglas \page
\Topic {Donald E. Knuth} \input knuth \page
\Topic {Edward R. Tufte} \input tufte \page
\Topic {Hermann Zapf} \input zapf \page
\stoptext