summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-present-banner.mkiv
blob: d93c033f28d1681b1fef97e5fcb73e2d961dc483 (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

%D   [      file=s-present-banner,
%D        version=2016.04.30, % around
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Banner,
%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 This style was made for the Bacho\TeX\ 2016 conference. The banner below
%D the text advances through the title.

\startmodule[present-banner]

\definecolor[maincolor] [b=.65]
\definecolor[othercolor][s=.35]

\startluacode
    function mp.Banner(s,mode)
     -- local r = tex.count.realpageno
        local r = tex.count.realpageno - 1
        local n = #s
        local i = mode and 1 or 0
        local t = string.gsub(s,".",function(s)
            if s == " " or i > n then
                return s
            elseif i == r then
                i = i + 1
                if mode then
                    return "\\color[othercolor]{" .. s .. "}"
                else
                    return "\\maincolor " .. s
                end
            else
                i = i + 1
                return s
            end
        end)
        mp.quoted(t)
    end
\stopluacode

\startuseMPgraphic{page}
    StartPage ;
        fill Page withcolor \MPcolor{maincolor} ;
        draw anchored(image (
          % draw textext.top (lua.mp.Banner("\documentvariable{title}",true))
            draw textext.top (lua.mp.Banner("\documentvariable{title}",false))
                xsized (.9PaperWidth)
                withcolor white;
        ), center bottomboundary Page);
      % fill Field[Text][Text] enlarged 10pt withcolor (\MPcolor{maincolor})/1.5 ;
        fill Field[Text][Text] enlarged 10pt withcolor .1white ;
    StopPage ;
\stopuseMPgraphic

\setupbackgrounds
  [page]
  [background=page]

\defineoverlay
  [page]
  [\useMPgraphic{page}]

\setupbodyfont
  [lucidaot,10pt]

\setuppapersize
  [S6]

\setuplayout
  [backspace=30pt,
   width=middle,
   height=middle,
   topspace=30pt,
   bottomspace=100pt,
   header=0pt,
   footer=0pt,
   margin=0pt]

\setupcolors
  [textcolor=white]

\setupwhitespace
  [big]

\setuphead
  [chapter]
  [style=\bfd,
   after={\blank[big]}]

\setuphead
  [section]
  [style=\bfa,
   before=\blank,
   after={\blank[medium]}]

\definehighlight[nb][style=bold]

\setupitemgroup[itemize][before=,after=]
\setupitemgroup[itemize][packed]

\setupdocument
  [title=Title,
   subtitle=Subtitle,
   location=\currentdate]

\startsetups document:start

    \startstandardmakeup

        \raggedcenter

        \dontleavehmode\scale[width=1.00\textwidth]{\documentvariable{title}}    \vfil
        \dontleavehmode\scale[width=0.75\textwidth]{\documentvariable{subtitle}} \vfil
        \dontleavehmode\scale[width=0.45\textwidth]{\documentvariable{location}} \vfil

    \stopstandardmakeup

\stopsetups

\stopmodule

\continueifinputfile{s-present-banner.mkiv}

\usemodule[present-common]

\inputpresentationfile{bachotex/2016/bachotex-2016-opentype.tex}