canbedone-style.tex /size: 3250 b    last modification: 2025-02-21 11:03
1% language=us runpath=texruns:manuals/canbedone
2
3% I started this series in June 2023 when I found for the n\high{th} time that we
4% already had a feature that users requested in the mailing list, but that I had
5% completely forgotten about it being around for about 6 years.
6
7\startenvironment canbedone-style
8
9\usemodule[abbreviations-logos]
10\usemodule[scite]
11
12\setupexternalfigures
13  [location={local,global,default}]
14
15\setvariables
16  [document]
17  [title=No Title,
18   author=No Author,
19   color=NoColor]
20
21\setupbodyfont
22  [dejavu,11pt]
23
24\setuplayout
25  [width=middle,
26   height=middle,
27   backspace=2cm,
28   topspace=15mm]
29
30\setupwhitespace
31  [big]
32
33\setuphead
34  [chapter]
35  [style=\bfc,
36   color=darkgray]
37
38\setuphead
39  [section]
40  [style=\bfb,
41  %page=right,
42   color=darkgray]
43
44\setuphead
45  [subsection]
46  [style=\bfa,
47   color=darkgray]
48
49\setuplist
50  [chapter]
51  [style=bold]
52
53\setupfootertexts
54  [section] % [\documentvariable{title}]
55
56\setupfooter
57  [style=bold,
58   color=darkgray]
59
60\startuseMPgraphic{titlepage}
61    fill Page
62        withcolor "\documentvariable{color}" ;
63
64    numeric d ; d := 2mm ;
65
66    picture p ; p := textext.llft("!") ;
67    p := p
68        rotatedaround(llcorner p, 30) % different from lowlevel
69        xysized (.1PaperWidth-2d,.1PaperHeight-2d)
70        shifted (.1PaperWidth- d,.1PaperHeight -d)
71        shifted (d,-2d) % different from lowlevel
72    ;
73
74    draw image (
75        for i = 0 step .1 PaperWidth until PaperWidth :
76            for j = 0 step .1 PaperHeight until PaperHeight :
77                draw p shifted (i,j) ;
78            endfor ;
79        endfor ;
80    ) withcolor .4resolvedcolor("middlegray") ; % different from lowlevel
81
82    draw textext.d("\strut it can be done")
83        xsized (.8PaperWidth)
84        shifted center topboundary Page
85        shifted -(0,.2PaperHeight)
86        withcolor "white" ;
87  % draw textext.d("\strut YES")
88    draw textext.d("\strut \TeX")
89        xsized (.4PaperWidth)
90        shifted center topboundary Page
91        shifted -(0,.4PaperHeight)
92        withcolor "white" ;
93    draw textext.d("\strut\documentvariable{title}")
94        ysized 3cm
95        shifted center bottomboundary Page
96        shifted (0,.1PaperHeight)
97        withcolor "white" ;
98\stopuseMPgraphic
99
100\definesectionlevels
101  [default]
102  [%{chapter,title},
103   {section,subject},
104   {subsection,subsubject},
105   {subsubsection,subsubsubject},
106   {subsubsubsection,subsubsubject},
107   {subsubsubsubsection,subsubsubject}]
108
109\startsetups document:start
110
111    \startMPpage
112    StartPage;
113        \includeMPgraphic{titlepage} ;
114    StopPage;
115    \stopMPpage
116
117    \page
118
119    \startsubjectlevel[title=Contents]
120        \placelist[chapter,section] [criterium=previous]
121    \stopsubjectlevel
122
123\stopsetups
124
125\startsetups document:stop
126
127\testpage[6]
128
129%startsubjectlevel[title=Colofon]
130\startsectionlevel[title=Colofon,number=no,saveinlist=no]
131
132    \starttabulate
133        \NC Author      \NC Hans Hagen         \NC \NR
134        \NC \CONTEXT    \NC \contextversion    \NC \NR
135        \NC \LUAMETATEX \NC \texengineversion  \NC \NR
136        \NC Support     \NC www.pragma-ade.com \NC \NR
137        \NC             \NC contextgarden.net  \NC \NR
138    \stoptabulate
139
140\stopsectionlevel
141%stopsubjectlevel
142
143\stopsetups
144
145\stopenvironment
146