manuals-explaining-cover.tex /size: 5636 b    last modification: 2023-12-21 09:43
1% language=us
2
3% Please try to be original and don't just copy this cover page as I don't want
4% confusion and be associated with (or responsibility for the look of) similar
5% looking documents.
6
7\startenvironment manuals-explaining-cover
8
9\startsetups document:abstract
10    \framed [
11        foregroundstyle=bold,
12        foregroundcolor=white,
13        width=7.5cm,
14        align={normal,tolerant},
15        frame=off,
16        strut=no,
17    ] {
18        \getbuffer[abstract]
19    }
20\stopsetups
21
22\startMPinclusions
23
24    def DrawCoverPage (expr what) =
25
26        numeric variant ; variant := 1 ;
27
28        StartCover ;
29
30            save width, height, size, anchor, offset, colors ;
31
32            numeric width, height, size ; pair anchor, offset ; string colors[] ;
33
34            colors[1] := "\documentvariable{cover:color:1}" ;
35            colors[2] := "\documentvariable{cover:color:2}" ;
36            colors[3] := "\documentvariable{cover:color:3}" ;
37            colors[4] := "\documentvariable{cover:color:4}" ;
38            colors[5] := "\documentvariable{cover:color:5}" ;
39
40            fill CoverPage enlarged PaperBleed withcolor colors[5] ;
41
42            fill Spine bottomenlarged  -.5PaperHeight withcolor colors[3] ;
43            fill Spine topenlarged     -.5PaperHeight withcolor colors[2] ;
44
45            width  := FrontPageWidth ;
46            height := FrontPageHeight ;
47            size   := 4 * width / 3 ;
48            offset := (-1cm,1cm) ;
49            anchor := .5[lrcorner CoverPage,urcorner CoverPage] ;
50
51            fill anchored.llft(lltriangle scaled size, urcorner FrontPage) withcolor colors[1] ;
52            fill anchored.urt (urtriangle scaled size, llcorner FrontPage) withcolor colors[2] ;
53            fill anchored.lrt (lrtriangle scaled size, ulcorner FrontPage) withcolor colors[3] ;
54            fill anchored.ulft(ultriangle scaled size, lrcorner FrontPage) withcolor colors[4] ;
55
56            fill anchored.lrt (lrtriangle scaled size, ulcorner BackPage) withcolor colors[1] ;
57            fill anchored.llft(lltriangle scaled size, urcorner BackPage) withcolor colors[3] ;
58            fill anchored.ulft(ultriangle scaled size, lrcorner BackPage) withcolor colors[2] ;
59            fill anchored.urt (urtriangle scaled size, llcorner BackPage) withcolor colors[4] ;
60
61            draw thetextext.llft(
62                textext("\bf \documentvariable{title}\hskip-.1em")
63                rotated 45 ysized .350height,
64                anchor shifted (6*offset+offset)
65            ) withcolor white ;
66            draw thetextext.llft(
67                textext("\bf \documentvariable{subtitle}")
68                rotated 45 ysized .275height,
69                anchor shifted (5*offset+offset)
70            ) withcolor white ;
71            draw thetextext.llft(
72                textext("\bf \documentvariable{author}")
73                rotated 45 ysized .200height,
74                anchor shifted (2*offset+offset)
75            ) withcolor white ;
76            draw thetextext.llft(
77                textext("\bf \documentvariable{affiliation}")
78                rotated 45 ysized .200height,
79                anchor shifted (1*offset+offset)
80            ) withcolor white ;
81
82            % for the moment
83
84            if (what = "back") or (what = "cover") :
85
86                draw
87                    thetextext.top(
88                        textext("\bf \documentvariable{comment}")
89                        xsized 4cm,
90                        lrcorner Page shifted (-3cm,1cm)
91                    ) withcolor white ;
92
93            fi ;
94
95            % till here
96
97            width := BackPageWidth ;
98
99            if (what = "back") or (what = "cover") :
100
101                draw thetextext(
102                    textext("\bf\setups[document:abstract]")
103                    xsized .65width rotated 45,
104                    center BackPage
105                ) withcolor white ;
106
107            fi ;
108
109            if what = "cover" :
110
111                draw thetextext.bot(
112                    textext("\bf \documentvariable{title}\hskip-.1em")
113                    rotated 90 xsized .8SpineWidth,
114                    .5[ulcorner Spine,urcorner Spine] shifted (0,-1cm)
115                ) withcolor white ;
116
117                draw thetextext.top(
118                    textext("\bf \documentvariable{author}")
119                    rotated 90 xsized .8SpineWidth,
120                    .5[llcorner Spine,lrcorner Spine] shifted (0,1cm)
121                ) withcolor white ;
122
123            fi ;
124
125        StopCover ;
126
127        if what = "front" :
128            clip currentpicture to FrontPage ;
129        elseif what = "back" :
130            clip currentpicture to BackPage ;
131        else :
132            drawboundary CoverPage ;
133        fi ;
134
135    enddef ;
136
137\stopMPinclusions
138
139\startsetups document:start
140
141    % \startcovermatter[front]
142
143    \setupbackgrounds[page][background=]
144
145    \doifmodeelse {simple} {
146
147        \startMPpage
148            DrawCoverPage("front") ;
149        \stopMPpage
150
151    } {
152
153        \startMPpage
154            DrawCoverPage("cover") ;
155        \stopMPpage
156
157    }
158
159    \page[dummy]
160
161    \setupbackgrounds[page][background=page]
162
163    \resetuserpagenumber
164
165    % \stopcovermatter
166
167\stopsetups
168
169\startsetups document:stop
170
171    \doifmodeelse {simple} {
172
173        % \startcovermatter[back]
174
175        \page
176
177        \setuppagenumbering[page=]
178
179        \setupbackgrounds[page][background=]
180
181        \page[empty,left]
182
183        \setupmakeup[doublesided=no,page=no]
184
185        \startMPpage
186            DrawCoverPage("back") ;
187        \stopMPpage
188
189        % \stopcovermatter
190
191    } {
192
193       % not needed as it's part of the cover page
194
195    }
196
197\stopsetups
198
199\stopenvironment
200