%% %% This is file `projlib-titlepage.sty', %% generated with the docstrip utility. %% %% Copyright (C) 2021-2024 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} {2024/03/01} {} {Interface for title page rendering} \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 } } , author-info-on-the-right .bool_set:N = \l__projlib_titlepage_show_author_info_on_the_right_bool , author-info-on-the-right .initial:n = { false } , author~info~on~the~right .bool_set:N = \l__projlib_titlepage_show_author_info_on_the_right_bool , author info on the right .bool_set:N = \l__projlib_titlepage_show_author_info_on_the_right_bool , 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} \group_begin: \noindent \tl_use:N \l__projlib_titlepage_info_tl \group_end: % \end{flushleft} \group_begin: \tl_use:N \l__projlib_titlepage_license_tl \group_end: \cleardoublepage \setcounter{page}{0} \pagenumbering{roman} } \cs_new_protected:Nn \projlib_titlepage_render_with_style_default: { \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,-.1\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,-.15\paperheight)$) { \sffamily \fontsize{28pt}{42pt}\selectfont \textsc{ \textbf{ \l__projlib_titlepage_title_tl } }\\[1.5em] \fontsize{20pt}{30pt}\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} } \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)+(.28\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)+(.53\paperwidth,-.28\paperheight)$) { \color{white} \sffamily \fontsize{28pt}{42pt}\selectfont \textsc{ \l__projlib_titlepage_title_tl }\\[1.5em] \fontsize{20pt}{30pt}\selectfont \l__projlib_titlepage_subtitle_tl }; \bool_if:NTF \l__projlib_titlepage_show_author_info_on_the_right_bool { \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left] at ($(current~page.south)+(.135\paperwidth,.4\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} }; } { \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left] at ($(current~page.south~west)+(.38\paperwidth,.4\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_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{28pt}{42pt}\selectfont \textsc{ \l__projlib_titlepage_title_tl }\\[1.5em] \fontsize{20pt}{30pt}\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_fancy: { \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)+(.333\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)+(.583\paperwidth,-.28\paperheight)$) { \color{titlepage-back} \sffamily \fontsize{28pt}{42pt}\selectfont \textsc{ \l__projlib_titlepage_title_tl }\\[1.5em] \fontsize{20pt}{30pt}\selectfont \l__projlib_titlepage_subtitle_tl }; \bool_if:NTF \l__projlib_titlepage_show_author_info_on_the_right_bool { \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left] at ($(current~page.south)+(.135\paperwidth,.4\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} }; } { \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left] at ($(current~page.south~west)+(.433\paperwidth,.4\paperheight)$) { \color{titlepage-back} \fontsize{16pt}{24pt}\selectfont \textsc{ \l__projlib_titlepage_author_tl }\\[1em] \fontsize{12pt}{18pt}\selectfont \l__projlib_titlepage_date_tl }; } \end{tikzpicture} } \endinput %% %% End of file `projlib-titlepage.sty'.