diff options
author | Hans Hagen <pragma@wxs.nl> | 2004-08-15 00:00:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2004-08-15 00:00:00 +0200 |
commit | 57f1545214ebba9625b9be722d4e4f9357dab87a (patch) | |
tree | 29dd99fb0b08de5fca50a557e8af043ea082478a /tex/context/base/s-pre-19.tex | |
parent | 599c5089a184d1967ec8dc66307de52378e911d4 (diff) | |
download | context-57f1545214ebba9625b9be722d4e4f9357dab87a.tar.gz |
stable 2004.08.15
Diffstat (limited to 'tex/context/base/s-pre-19.tex')
-rw-r--r-- | tex/context/base/s-pre-19.tex | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/tex/context/base/s-pre-19.tex b/tex/context/base/s-pre-19.tex index 204cb41a1..56c7c78c4 100644 --- a/tex/context/base/s-pre-19.tex +++ b/tex/context/base/s-pre-19.tex @@ -8,8 +8,8 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. %D This style is made in the process or writing the \METAFUN\ %D manual. It exploits a few tricks, like graphics calculated @@ -17,64 +17,64 @@ %D moment) new menu list placement alternative. If you forget %D about the definition of the button shapes, which is %D complicated in any system, this style is not even that hard -%D to follow. Watch how the left side of the buttons follow -%D the right side of the text graphic. -%D -%D While playing bit with this style, the random alternative -%D made me think of those organic building with non equal -%D windows (we have a few in The Netherlands), so I decided to -%D label this style as \type {pre-organic}. +%D to follow. Watch how the left side of the buttons follow +%D the right side of the text graphic. %D -%D At the end of this file, there is a small test file, so -%D when you process this file with \TEXEXEC\ and the options -%D \type {--mode=demo} and \type {--pdf}, you will get a demo -%D document. +%D While playing bit with this style, the random alternative +%D made me think of those organic building with non equal +%D windows (we have a few in The Netherlands), so I decided to +%D label this style as \type {pre-organic}. +%D +%D At the end of this file, there is a small test file, so +%D when you process this file with \TEXEXEC\ and the options +%D \type {--mode=demo} and \type {--pdf}, you will get a demo +%D document. -%D We use one of the standard screen \citeer {paper} sizes, and -%D map it onto the same size, so that we get a nicely cropped -%D page. +%D We use one of the standard screen \citeer {paper} sizes, and +%D map it onto the same size, so that we get a nicely cropped +%D page. \setuppapersize [S6][S6] -%D Like in the \METAFUN\ manual, we use the Palatino as main -%D bodyfont. This font is quite readable on even low -%D resolution screens, although I admit that this style is +%D Like in the \METAFUN\ manual, we use the Palatino as main +%D bodyfont. This font is quite readable on even low +%D resolution screens, although I admit that this style is %D developed using an $1400\times1050$ pixel LCD screen, so I -%D may be biased. +%D may be biased. %\startmode[asintended] \setupbodyfont[ppl] \stopmode %D The layout specification sets up a text area and a right %D edge area where the menus will go. Watch the rather large %D edge distance. By setting the header and footer dimensions -%D to zero, we automatically get rid of page body ornaments, -%D like the pagenumber. +%D to zero, we automatically get rid of page body ornaments, +%D like the pagenumber. \setuplayout [topspace=48pt, backspace=48pt, cutspace=12pt, width=400pt, - margin=0cm, + margin=0cm, rightedge=88pt, rightedgedistance=48pt, header=0cm, footer=0cm, height=middle] -%D We use a moderate, about a line height, interparagraph -%D white space. +%D We use a moderate, about a line height, interparagraph +%D white space. \setupwhitespace [big] -%D Of course we use colors, since on computer displays they -%D come for free. +%D Of course we use colors, since on computer displays they +%D come for free. \setupcolors [state=start] - + \definecolor [red] [r=.75] \definecolor [yellow] [r=.75,g=.75] \definecolor [gray] [s=.50] @@ -87,11 +87,11 @@ \definecolor [ContrastColor] [gray] %D This is an interactive document, so we enable interaction. -%D In this style, we disable the viewer's \citeer {highlight a -%D hyperlink when it's clicked on} feature. We will use a -%D menu, so we enable menus. Later we will see the contract -%D color |<|hyperlinks gets that color when we are already on -%D the location|>| in action. +%D In this style, we disable the viewer's \citeer {highlight a +%D hyperlink when it's clicked on} feature. We will use a +%D menu, so we enable menus. Later we will see the contract +%D color |<|hyperlinks gets that color when we are already on +%D the location|>| in action. \setupinteraction [state=start, @@ -103,7 +103,7 @@ %D The menu itself is set up as follows. Because we will %D calculate menubuttons based on their position on the page, %D we have to keep track of the positions. Therefore, we set -%D the \type {position} variable to \type {yes}. +%D the \type {position} variable to \type {yes}. \setupinteractionmenu [right] @@ -118,9 +118,9 @@ before=, after=] -%D The menu content is rather sober: a list of topics (later -%D we will define the command that generates topic entries), -%D and a close button. +%D The menu content is rather sober: a list of topics (later +%D we will define the command that generates topic entries), +%D and a close button. \startinteractionmenu[right] \placelist[Topic][alternative=right] @@ -134,7 +134,7 @@ %D \METAPOST\ graphic. Page backgrounds are recalculated each %D page, opposite to the other backgrounds that are calculated %D when a new background is defined, or when repetitive -%D calculation is turned on. +%D calculation is turned on. \setupbackgrounds [page] @@ -146,141 +146,141 @@ \setupMPvariables [page] - [alternative=3] + [alternative=3] \startuseMPgraphic{page} - \includeMPgraphic{rightsuperbutton} + \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} ; + fill Page withcolor \MPcolor{PageColor} ; + fill p withcolor \MPcolor{TextColor} ; + draw p withcolor \MPcolor{OrnamentColor} ; - p := Field[Text][Text] enlarged 48pt superellipsed .90 ; + 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 ; + 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} + \MPmenubuttons{right} - StopPage ; + StopPage ; \stopuseMPgraphic \startuseMPgraphic{page} - \includeMPgraphic{rightsuperbutton} + \includeMPgraphic{rightsuperbutton} StartPage ; - numeric alternative, seed, superness, squeezeness, randomness ; - path p, q ; transform t ; + numeric alternative, seed, superness, squeezeness, randomness ; + path p, q ; transform t ; alternative := \MPvar{alternative} ; - seed := uniformdeviate 100 ; + seed := uniformdeviate 100 ; - if alternative > 10 : - superness := .85 + ((\realfolio-1)/\lastpage) * .15 ; + if alternative > 10 : + superness := .85 + ((\realfolio-1)/\lastpage) * .15 ; squeezeness := 12pt - ((\realfolio-1)/\lastpage) * 10pt ; - else : + else : superness := .90 ; squeezeness := 12pt ; fi ; - randomness := squeezeness ; + randomness := squeezeness ; - alternative := alternative mod 10 ; + alternative := alternative mod 10 ; - t := identity if alternative=3: shifted (9pt,-9pt) fi ; - - % first we draw the shape that surrounds the text + t := identity if alternative=3: shifted (9pt,-9pt) fi ; - randomseed := seed ; + % first we draw the shape that surrounds the text - p := Field[Text][Text] enlarged if - alternative = 1 : 36pt superellipsed superness elseif - alternative = 2 : 36pt squeezed squeezeness elseif + 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 ; + : 36pt fi ; pickup pencircle scaled 3pt ; - fill Page withcolor \MPcolor{PageColor} ; - fill p withcolor \MPcolor{TextColor} ; - draw p withcolor \MPcolor{OrnamentColor} ; + fill Page withcolor \MPcolor{PageColor} ; + fill p withcolor \MPcolor{TextColor} ; + draw p withcolor \MPcolor{OrnamentColor} ; - % we set p to the wider shape from which we will chip off pieces + % we set p to the wider shape from which we will chip off pieces - randomseed := seed ; + randomseed := seed ; - p := ( Field[Text][Text] enlarged if - alternative = 1 : 48pt superellipsed superness elseif - alternative = 2 : 48pt squeezed squeezeness elseif + 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 ; % calls to *_menu_button are generated automatically ... - 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) ; % \MPw{menu:right:\realfolio} - fill q withcolor \MPcolor{TextColor} ; - draw q withcolor if rr=2 : \MPcolor{ContrastColor} - else : \MPcolor{InteractionColor} fi ; - fi ; - enddef ; + 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) ; % \MPw{menu:right:\realfolio} + fill q withcolor \MPcolor{TextColor} ; + draw q withcolor if rr=2 : \MPcolor{ContrastColor} + else : \MPcolor{InteractionColor} fi ; + fi ; + enddef ; - % ... and inserted when the graphic data is flushed here ... + % ... and inserted when the graphic data is flushed here ... - \MPmenubuttons{right} + \MPmenubuttons{right} - StopPage ; + 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 ; + 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 ; + edge := xpos + wid ; shift := ypos + hei ; - p := rightpath pat ; + p := rightpath pat ; ptop := ((-infinity,shift)--(edge,shift)) ; - pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ; + pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ; - t := p intersectionpoint ptop ; - b := p intersectionpoint pbot ; + 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) + (p -- t -- point 1 of ptop & + point 1 of ptop -- point 1 of pbot & + point 1 of pbot -- b + -- cycle) -enddef ; +enddef ; \stopuseMPgraphic %D Topics are identified with \type {\Topic}, which is an %D instance of chapter headings. The number is made invisible. %D Since it still is a numbered section header, \CONTEXT\ will -%D write the header to the table of contents. +%D write the header to the table of contents. \definehead [Topic] @@ -290,19 +290,19 @@ enddef ; [Topic] [number=no] -%D We will use a bold font in the table of contents. We also -%D force a complete list. +%D We will use a bold font in the table of contents. We also +%D force a complete list. \setuplist [Topic] [criterium=all, style=bold, before=, - after=] + after=] -%D The \type {\TitlePage} macro looks horrible, because we -%D want to keep the interface simple: a list of small -%D sentences, separated by \type {\\}. +%D The \type {\TitlePage} macro looks horrible, because we +%D want to keep the interface simple: a list of small +%D sentences, separated by \type {\\}. \def\StartTitlePage {\startstandardmakeup @@ -318,17 +318,17 @@ enddef ; \def\TitlePage#1% {\StartTitlePage#1\StopTitlePage} -%D A couple of goodies: +%D A couple of goodies: \def\Subject {\Topic} \def\Topics #1{} \def\Subjects {} -%D For those who want to test: +%D For those who want to test: \doifnotmode{demo}{\endinput} -\starttext +\starttext \setupMPvariables[page][alternative=3] @@ -337,10 +337,10 @@ enddef ; 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 -%Topic {David F. Stork} \input stork \page +\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 +%Topic {David F. Stork} \input stork \page -\stoptext +\stoptext |