s-pre-26.tex /size: 6310 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-pre-26,
3%D        version=2001.02.18,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment 26,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D modes: reverse
15
16%D This is a nice and simple style, written in februari
17%D 2001. It uses a square papersize, derived from \type {S4}.
18%D Because this style is meant to be used with Zapf
19%D Chancery, I dedicate this style to Volker Schaa, a fan of
20%D Zapf.
21
22\setuppapersize
23  [S44][S44]
24
25\startmode[asintended]
26  \definetypeface[zaphy][cg][calligraphy][chancery]
27  \setupbodyfont[zaphy,cg,12pt]
28\stopmode
29
30\startnotmode[asintended]
31  \setupbodyfont[13pt]
32\stopnotmode
33
34%D We use the whole page.
35
36\setuplayout
37  [backspace=0pt,
38   topspace=0pt,
39   header=0pt,
40   footer=0pt,
41   bottom=0pt,
42   width=middle,
43   height=middle]
44
45%D We will be very tolerant in alignment.
46
47\setuptolerance
48  [verytolerant,stretch]
49
50%D Of course use navigation, but we hide the in this case
51%D ugly reverse video hyper spot.
52
53\setupinteraction
54  [state=start,
55   color=white,
56   contrastcolor=white,
57   style=\underbar,
58   click=no]
59
60%D This style looks best in a dark room, full screen.
61
62\setupinteractionscreen
63  [option=max]
64
65%D We use colors and remap a couple of standard colors.
66
67\setupcolors
68  [state=start]
69
70\definecolor[white] [s=.8]
71\definecolor[red]   [r=.7]
72\definecolor[green] [g=.7]
73\definecolor[blue]  [b=.7]
74\definecolor[yellow][r=.7,g=.7]
75
76\definecolor [PageColor][black]
77
78%D These colors will cyclic be assigned to \type
79%D {TextColor}.
80
81\definecolor [TextColor 0][white]
82\definecolor [TextColor 1][red]
83\definecolor [TextColor 2][green]
84\definecolor [TextColor 3][blue]
85\definecolor [TextColor 4][yellow]
86
87\definecolor [TextColor] [TextColor 0]
88
89%D We will collect everything in a layer.
90
91\definelayer
92  [main]
93  [state=repeat]
94
95%D We have quite some overlays.
96
97\defineoverlay [page] [\reuseMPgraphic{page}]
98\defineoverlay [text] [\useMPgraphic{text}]
99\defineoverlay [next] [\overlaybutton{nextpage}]
100\defineoverlay [prev] [\overlaybutton{previouspage}]
101\defineoverlay [main] [\composedlayer{main}]
102
103%D These end up as paper, page and text backgrounds. We need
104%D to locate the foreground, otherwise hyperlinks will not
105%D work.
106
107\setupbackgrounds % otherwise in acrobat 5 rounding error
108  [paper]         % and one pixel white line
109  [backgroundcolor=Pagecolor,
110   background=page]
111
112\setupbackgrounds
113  [page]
114  [background={page,prev,foreground,main}]
115
116\setupbackgrounds
117  [text]
118  [background=next,
119   backgroundoffset=-10pt]
120
121%D This means that clicking on the center brings you to the
122%D next page, while clicking on teh page frame brings you one
123%D page back.
124
125%D As usual, the graphics are handled by \METAPOST:
126
127\startuseMPgraphic{text}
128  path p ; p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
129  color c ; c := (.7+uniformdeviate.3)*\MPcolor{TextColor} ;
130  p := p enlarged -1.25pt ;
131  filldraw p withcolor c ;
132  draw p withpen pencircle scaled 2.5pt withcolor .75c ;
133\stopuseMPgraphic
134
135\startreusableMPgraphic{page}
136  path p ; p := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
137  color c ; c := \MPcolor{PageColor} ;
138  filldraw p enlarged 5pt withcolor c ; % bleeding
139\stopreusableMPgraphic
140
141%D The text is typeset in a framed text. We cycle trough the
142%D colors by means of a counter. This counter also determines
143%D the positioning on the main layer. The width is slightly
144%D random.
145
146\newcounter\KindOfTopic  % and cycle through corners
147\newdimen  \TopicWidth   % with randomized widths
148
149\defineframedtext
150  [TopicText]
151  [frame=off,
152   offset=10pt,
153   style=bold,
154   width=\TopicWidth,
155   background=text,
156   before=,
157   after=,
158   align=normal]
159
160\def\BeforeTopic
161  {\ifcase\KindOfTopic\relax
162     \TopicWidth=.7\textwidth
163     \definecolor[CharColor][black]
164   \else
165     \getrandomdimen\TopicWidth{.55\textwidth}{.7\textwidth}
166     \definecolor[CharColor][white]
167   \fi
168   \doifmode{reverse}
169     {\setupframedtexts[TopicText][foregroundcolor=CharColor]}
170   \definecolor[TextColor][TextColor \KindOfTopic]
171   \ifcase\KindOfTopic\relax
172     \setuplayer[main][x=.5\textwidth,y=.5\textheight,location=c]  \or
173     \setuplayer[main][x=0pt,         y=0pt,          location=rb] \or
174     \setuplayer[main][x=\textwidth,  y=0pt,          location=lb] \or
175     \setuplayer[main][x=\textwidth,  y=\textheight,  location=lt] \or
176     \setuplayer[main][x=0pt,         y=\textheight,  location=rt] \fi}
177
178\def\AfterTopic
179  {\ifnum\KindOfTopic=4
180     \gdef\KindOfTopic{1}
181   \else
182     \doglobal\increment\KindOfTopic
183   \fi}
184
185\def\StartTopic
186  {\BeforeTopic
187   \startstandardmakeup
188   \setlayer[main] \bgroup \startTopicText[none]
189     }%\setupwhitespace[big]} % generates an empty line
190
191\def\StopTopic
192  {\stopTopicText \egroup
193   \stopstandardmakeup
194   \AfterTopic}
195
196%D The title and colofon page are centered on the page.
197
198\def\StartNopic
199  {\doglobal\newcounter\KindOfTopic % centered at the page
200   \StartTopic
201     \bfd\setupinterlinespace
202     \setupinteraction[color=,contrastcolor=]%
203     \def\\{\blank\bfb\setupinterlinespace\def\\{\blank}}%
204     \raggedcenter\ignorespaces}
205
206\def\StopNopic
207  {\StopTopic}
208
209\let\StartTitlePage\StartNopic \let\StartColofonPage\StartNopic
210\let\StopTitlePage \StopNopic  \let\StopColofonPage \StopNopic
211
212\def\TitlePage  #1{\StartTitlePage  #1\StopTitlePage}
213\def\ColofonPage#1{\StartColofonPage#1\StopColofonPage}
214
215%D We provide a minimum of title commands.
216
217\definehead
218  [Title]
219  [title]
220
221\definehead
222  [Subject]
223  [subject]
224
225\setuphead
226  [Title]
227  [style=\bfb,
228   page=,
229   before=,
230   after=\blank]
231
232\setuphead
233  [Subject]
234  [style=\bfa,
235   before=\blank,
236   after=\blank]
237
238\doifnotmode{demo}{\endinput}
239
240\def\Sample #1 {\input #1 \par \rightaligned{--- #1 ---}}
241
242\starttext
243
244\StartNopic The \ConTeXt\ Test Quotes \\ \currentdate \StopNopic
245
246\StartTopic \Sample tufte   \StopTopic
247\StartTopic \Sample knuth   \StopTopic
248\StartTopic \Sample zapf    \StopTopic
249\StartTopic \Sample douglas \StopTopic
250\StartTopic \Sample stork   \StopTopic
251\StartTopic \Sample materie \StopTopic
252
253\StartNopic There Will Be Some More \StopNopic
254
255\stoptext
256