summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/projlib/projlib-titlepage.sty
blob: dfe0f7d7e53fa1235d220ca0945940fbb99c45c3 (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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
%%
%% This is file `projlib-titlepage.sty',
%% generated with the docstrip utility.
%%
%% Copyright (C) 2021-2023 by Jinwen XU
%% 
%% This is part of the ProjLib Toolkit.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage
  {projlib-titlepage}
  {2023/01/05} {}
  {Commands for rendering the title page}

\keys_define:nn { projlib-titlepage }
  {
    , unknown           .code:n             = {}
  }
\ProcessKeyOptions [ projlib-titlepage ]

\RequirePackage { projlib-logo }
\RequirePackage { projlib-paper }

\RequirePackage { tikz }
\ExplSyntaxOff
\usetikzlibrary { calc }
\ExplSyntaxOn

\tl_new:N \l_projlib_titlepage_title_page_name_tl
\tl_new:N \l_projlib_titlepage_license_page_name_tl
\tl_set:Nn \l_projlib_titlepage_title_page_name_tl   { Cover   }
\tl_set:Nn \l_projlib_titlepage_license_page_name_tl { License }

\tl_new:N \l_projlib_titlepage_logo_tl
\tl_new:N \l_projlib_titlepage_title_tl
\tl_new:N \l_projlib_titlepage_subtitle_tl
\tl_new:N \l_projlib_titlepage_author_tl
\tl_new:N \l_projlib_titlepage_info_tl
\tl_new:N \l_projlib_titlepage_license_tl
\tl_new:N \l_projlib_titlepage_date_tl
\tl_new:N \l_projlib_titlepage_style_tl

\NewDocumentCommand \ProjLibTitlePage { O{} m }
  {
    \keys_set:nn { projlib-titlepage-config } { #1 }
    \projlib_titlepage_render:n { #2 }
  }
\ProvideDocumentCommand \TitlePage { O{} m }
  {
    \ProjLibTitlePage [ #1 ] { #2 }
  }

\cs_new_protected:Nn \projlib_titlepage_set_color:nn
  {
    \colorlet { titlepage- #1 } { #2 }
  }

\keys_define:nn { projlib-titlepage-config }
  {
    , logo              .code:n             = { \tl_set:Nn \l_projlib_titlepage_logo_tl { \tl_trim_spaces:n { #1 } } }
    , logo              .initial:n          = { * }
    , title             .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_tl { \tl_trim_spaces:n { #1 } } }
    , subtitle          .code:n             = { \tl_set:Nn \l_projlib_titlepage_subtitle_tl { \tl_trim_spaces:n { #1 } } }
    , author            .code:n             = { \tl_set:Nn \l_projlib_titlepage_author_tl { \tl_trim_spaces:n { #1 } } }
    , date              .code:n             = { \tl_set:Nn \l_projlib_titlepage_date_tl { \tl_trim_spaces:n { #1 } } }
    , title-page-name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , title~page~name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , title page name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license-page-name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license~page~name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license page name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , info              .code:n             = { \tl_set:Nn \l_projlib_titlepage_info_tl { \tl_trim_spaces:n { #1 } } }
    , info              .initial:n          = { }
    , license           .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_tl { \tl_trim_spaces:n { #1 } } }
    , license           .initial:n          = { }
    , style             .tl_set:N           = \l_projlib_titlepage_style_tl
    , style             .initial:n          = { default }
    , color             .code:n             = {
                                                \keyval_parse:nnn
                                                  { \use_none:n }
                                                  { \projlib_titlepage_set_color:nn }
                                                  { #1 }
                                              }
    , unknown           .code:n             = {}
  }

\colorlet { titlepage-main } { blue!50!cyan!50!black }
\colorlet { titlepage-back } { blue!50!cyan!15!yellow!25 }

\cs_new_protected:Nn \projlib_titlepage_show_logo:n
  {
    \tl_if_eq:NnTF \l_projlib_titlepage_logo_tl { \tl_trim_spaces:n { * } }
      {
        #1
      }
      {
        \tl_use:N \l_projlib_titlepage_logo_tl
      }
  }

\cs_new_protected:Nn \projlib_titlepage_render:n
  {
    \keys_set:nn { projlib-titlepage-config } { #1 }
    \tl_set_eq:NN \thepage \l_projlib_titlepage_title_page_name_tl
    \begin { titlepage }
      \cs_if_exist_use:c { projlib_titlepage_render_with_style_ \l_projlib_titlepage_style_tl : }
    \end   { titlepage }
    \tl_set_eq:NN \thepage \l_projlib_titlepage_license_page_name_tl
    \thispagestyle{empty}
    \null\vfill
    \begin{flushleft}
      \tl_use:N \l_projlib_titlepage_info_tl
    \end{flushleft}
    \tl_use:N \l_projlib_titlepage_license_tl
    \cleardoublepage
    \setcounter{page}{0}
    \pagenumbering{roman}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_default:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill [color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \fill [color=titlepage-back] ($(current~page.south~west)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \fill [color=titlepage-main] ($(current~page.north~west)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \fill [color=titlepage-back] ($(current~page.north~east)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.32\paperwidth,-.17\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.57\paperwidth,-.28\paperheight)$)
          {
            \color{titlepage-back}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
          {
            \color{titlepage-back}
            \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            \end{flushright}
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_simple:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill[color=white] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \fill[color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.27\paperwidth,-.15\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.52\paperwidth,-.28\paperheight)$)
          {
            \color{white}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
          {
            \color{white}
            \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            \end{flushright}
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_academic:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill[color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \fill[color=white] ($(current~page.south~west)+(0,.3\paperheight)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~center]
        at ($(current~page.north)+(0pt,-.15\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \color{white} \scalebox { 2 } { \ProjLibText } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~center]
        at ($(current~page.north)+(0pt,-.25\paperheight)$)
          {
            \color{titlepage-main}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~center]
        at ($(current~page.south)+(0pt,.36\paperheight)$)
          {
            \color{white}
            \fontsize{16pt}{24pt}\selectfont
            \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
            \fontsize{12pt}{18pt}\selectfont
            \l_projlib_titlepage_date_tl
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_minimalist:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      % \fill[color=white] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.32\paperwidth,-.2\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.57\paperwidth,-.22\paperheight)$)
          {
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      % \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        % at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
      \node[text~width=.8\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south~west)+(.57\paperwidth,.45\paperheight)$)
          {
            \color{.!50}
            % \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            % \end{flushright}
          };
    \end{tikzpicture}
  }

\endinput
%%
%% End of file `projlib-titlepage.sty'.