summaryrefslogtreecommitdiffstats
path: root/s-present-split.mkiv
blob: b787b4bbbde8163142298da60f4b961e29a21f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
%D \module
%D   [      file=s-present-split, % s-pre-14,
%D        version=1999.08.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Split,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D In the process of making a couple of simple styles for \EUROTEX\ 99, I came to
%D this one. The joke is in the pagenumber. This style can be used for short
%D presentations with much text.

\startmodule[present-split]


\setupbodyfont[ymhgd,12pt]

%D Since we expect text, we can best be very tolerant.

\setuptolerance
  [verytolerant,stretch]

%D As most styles we choose a large screen page size.

\setuppapersize[SW][SW]

\setuplayout
  [width=fit,
   rightedge=4cm,
   margin=0pt,
   rightedgedistance=1cm,
   height=middle,
   header=0pt,
   footer=0pt,
   topspace=1cm,
   backspace=1cm,
   grid=yes,]

%\showframe
%\showgrid

\setupbackgrounds
  [page]
  [background={numberb}]

%D We only use two colors, named \type {ColorOne} and \type {ColorTwo}:

\definecolor [ColorOne] [x=F0EFEB]
\definecolor [ColorTwo] [x=DBE7E4]

\definecolor[ChapOneColOne] [x=D6E2E9]
\definecolor[ChapOneColTwo] [x=BCD4E6]

\definecolor[ChapTwoColOne] [x=FFF1E6]
\definecolor[ChapTwoColTwo] [x=EDDCD2]

\definecolor[ChapThreeColOne] [x=FDE2E4]
\definecolor[ChapThreeColTwo] [x=FAD2E1]

\definecolor[ChapFourColOne] [x=F5EFFF]
\definecolor[ChapFourColTwo] [x=E5D9F2]

\definecolor[ChapFiveColOne] [x=FAEDCB]
\definecolor[ChapFiveColTwo] [x=F7D9C4]

\defineoverlay[numberb][\useMPgraphic{numberb}]

\startuseMPgraphic{numberb}
    CurrentTitleNum := \somenamedheadnumber{Title}{current} ;
    color FirstCol ; color SecondCol ;
    FirstCol := \MPcolor{ColorOne} ;
    SecondCol := \MPcolor{ColorTwo} ;
    StartPage ;
        if CurrentTitleNum = 1 :
            FirstCol := \MPcolor{ChapOneColOne} ;
            SecondCol := \MPcolor{ChapOneColTwo} ;
        elseif CurrentTitleNum = 2 :
            FirstCol := \MPcolor{ChapTwoColOne} ;
            SecondCol := \MPcolor{ChapTwoColTwo} ;
        elseif CurrentTitleNum = 3 :
            FirstCol := \MPcolor{ChapThreeColOne} ;
            SecondCol := \MPcolor{ChapThreeColTwo} ;
        elseif CurrentTitleNum = 4 :
            FirstCol := \MPcolor{ChapFourColOne} ;
            SecondCol := \MPcolor{ChapFourColTwo} ;
        elseif CurrentTitleNum = 4 :
            FirstCol := \MPcolor{ChapFiveColOne} ;
            SecondCol := \MPcolor{ChapFiveColTwo} ;
        fi ;
        picture Left, Right ;
        numeric Shift ; Shift := -TextWidth - BackSpace - RightEdgeDistance/2 ;
        fill Page withcolor FirstCol ;
        fill Page leftenlarged Shift withcolor SecondCol ;
        if RealPageNumber > 1 :
            Left := Right := textext("\bf\pagenumber") ysized 3cm ;
            clip Right to boundingbox Right shifted ( bbwidth(Right)/2,0) ;
            clip Left  to boundingbox Left  shifted (-bbwidth(Left) /2,0) ;
            draw Left  shifted (-Shift,2.25cm) withcolor SecondCol ;
            draw Right shifted (-Shift,2.25cm) withcolor FirstCol ;
        fi ;
    StopPage ;
\stopuseMPgraphic

%D We use the simple label typesetting present in \METAPOST\ because digits are
%D seldom kerned so real \TEX ing is not needed. As in the previous method, we let
%D the graphics overlap so that we don't get white lines due to rounding problems in
%D viewers.
%D
%D We put a button behind the text (this overlay is calculated each page).

\defineoverlay
  [nextpage]
  [\overlaybutton{nextpage}]

\setupbackgrounds
  [text]
  [backgroundoffset=.5cm,
   background=nextpage]

%D We still have to turn on interaction mode.

\setupinteraction
  [state=start,
   display=new,
   menu=on]

\setupinteraction
  [color=,
   contrastcolor=]

%D Next we define structuring commands.

\definehead[Title]  [chapter]
\definehead[Topic]  [section]
\definehead[Subject][subsection]

\setuphead[Title]
  [style={\ttd\bf},
   align=middle,
   grid=middle,
   before={\blank[5*big,force]},
   page={yes},after=\page,]

\setuphead[Topic][style={\ttc\bf},page={yes},]
\setuphead[Subject][style={\tta\bf}]
\setuphead
  [Topic,Subject]
  [number=no,
   after={\blank[big]}]

%D Because we will provide a menu, we don't offer lists.

\let\Titles  \gobbleoneargument
\let\Topics  \gobbleoneargument
\let\Subjects\relax

%D The table of contents goes to the right edge.

\startinteractionmenu[right]
  \setupinteraction
    [color=black,
     contrastcolor=Two]
  \placelist
    [Title]
    [alternative=paragraph,
     pagenumber=no,
     headnumber=no,
     frame=off,
     criterium=all,]
  \vfill
\stopinteractionmenu

\setuplist
  [Title]
  [width=\rightedgewidth,
   maxwidth=\rightedgewidth,
   style=\ttxx\bf,
   width=fit]

%D We safe some space:

\setupwhitespace
  [medium]

\setupblank
  [medium]

%D In the titlepage, we still use the \TEX\ overlays, so that we don't have to
%D define a second graphic.

\unexpanded\def\TitlePage#1%
  {\StartTitlePage#1\StopTitlePage}

\unexpanded\def\StartTitlePage
  {\startstandardmakeup
   \setupalign[middle]
   \enforced\protected\def\\{\vfil\tta\setupinterlinespace}
   \ttc\bf\setupinterlinespace
   \vfil}

\unexpanded\def\StopTitlePage
  {\vfil\vfil\vfil
   \stopstandardmakeup}

\startsetups document:start
    \StartTitlePage
        \documentvariable{title}
        \doifsomething {\documentvariable{subtitle}} {
            \\
            \documentvariable{subtitle}
        }
        \doifsomething {\documentvariable{location}} {
            \\
            \documentvariable{location}
        }
    \StopTitlePage
\stopsetups

\startsetups document:stop
    %
\stopsetups

\stopmodule

%D This is it.

\continueifinputfile{s-present-split.mkiv}

\usemodule[present-common]

\inputpresentationfile{examples/present-split-001.tex}