\newcommand{\headerstyled}{%
{$if(titlepage-theme.header-fontsize)$\fontsize{$titlepage-theme.header-fontsize$}{$titlepage-theme.header-spacing$}\selectfont
$endif$$for(titlepage-theme.header-fontstyle)$\$titlepage-theme.header-fontstyle${$endfor$$titlepage-header$$for(titlepage-theme.header-fontstyle)$}$endfor$}
}
\newcommand{\footerstyled}{%
{$if(titlepage-theme.footer-fontsize)$\fontsize{$titlepage-theme.footer-fontsize$}{$titlepage-theme.footer-spacing$}\selectfont
$endif$$for(titlepage-theme.footer-fontstyle)$\$titlepage-theme.footer-fontstyle${$endfor$$titlepage-footer$$for(titlepage-theme.footer-fontstyle)$}$endfor$}
}
\newcommand{\datestyled}{%
{$if(titlepage-theme.date-fontsize)$\fontsize{$titlepage-theme.date-fontsize$}{$titlepage-theme.date-spacing$}\selectfont
$endif$$for(titlepage-theme.date-fontstyle)$\$titlepage-theme.date-fontstyle${$endfor$$date$$for(titlepage-theme.date-fontstyle)$}$endfor$}
}

$if(titlepage-style-code.header.none)$
\newcommand{\titlepageheaderblock}{}
$endif$

$if(titlepage-style-code.header.plain)$
\newcommand{\titlepageheaderblock}{\headerstyled}
$endif$
$if(titlepage-style-code.header.colorbox)$
\newcommand{\titlepageheaderblock}{
{\setlength{\fboxrule}{$if(titlepage-theme.header-colorbox-borderwidth)$$titlepage-theme.header-colorbox-borderwidth$$else$0pt$endif$}
\fcolorbox{$if(titlepage-theme.header-colorbox-bordercolor)$$titlepage-theme.header-colorbox-bordercolor$$else$black$endif$}{$if(titlepage-theme.header-colorbox-fill)$$titlepage-theme.header-colorbox-fill$$else$cyan$endif$}{
\parbox[t]{0.90\minipagewidth}{ % Outer full width box
\parbox[t]{0.85\minipagewidth}{ % Inner box for inner right text margin
$if(titlepage-theme.header-align)$\titlepageheaderalign$else$$if(titlepage-theme.page-align)$\titlepagepagealign$endif$$endif$
\vspace{0.7cm}

\headerstyled

\vspace{0.7cm}
}} % end of parboxes
} % fcolorbox
} % ensure fbox set is restricted
}
$endif$
$if(titlepage-style-code.header.doublelinewide)$
\newcommand{\titlepageheaderblock}{
\rule{\textwidth}{0.4pt} % Thin horizontal rule
\vspace{0.1\textheight} % Whitespace between the top rules and title

\headerstyled

\vspace{0.025\textheight} 
\rule{0.3\textwidth}{0.4pt} % Short horizontal rule under the title
}
$endif$
$if(titlepage-style-code.header.doublelinetight)$
\newcommand{\titlepageheaderblock}{
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} 

\HRule\\[0.4cm]

\headerstyled

\HRule\\
}
$endif$

$if(titlepage-style-code.footer.none)$
\newcommand{\titlepagefooterblock}{}
$endif$
$if(titlepage-style-code.footer.plain)$
\newcommand{\titlepagefooterblock}{
\footerstyled
}
$endif$
$if(titlepage-style-code.footer.colorbox)$
\newcommand{\titlepagefooterblock}{
{\setlength{\fboxrule}{$if(titlepage-theme.footer-colorbox-borderwidth)$$titlepage-theme.footer-colorbox-borderwidth$$else$0pt$endif$}
\fcolorbox{$if(titlepage-theme.footer-colorbox-bordercolor)$$titlepage-theme.footer-colorbox-bordercolor$$else$black$endif$}{$if(titlepage-theme.footer-colorbox-fill)$$titlepage-theme.footer-colorbox-fill$$else$cyan$endif$}{
\parbox[t]{0.90\minipagewidth}{ % Outer full width box
\parbox[t]{0.85\minipagewidth}{ % Inner box for inner right text margin
$if(titlepage-theme.footer-align)$\titlepagefooteralign$else$$if(titlepage-theme.page-align)$\titlepagepagealign$endif$$endif$
\vspace{0.7cm}

\footerstyled

\vspace{0.7cm}
}} % end of parboxes
} % fcolorbox
} % ensure fbox set is restricted
}
$endif$
$if(titlepage-style-code.footer.doublelinewide)$
\newcommand{\titlepagefooterblock}{
\rule{\textwidth}{0.4pt} % Thin horizontal rule
\vspace{0.1\textheight} % Whitespace between the top rules and title

\footerstyled

\vspace{0.025\textheight} 
\rule{0.3\textwidth}{0.4pt} % Short horizontal rule under the title
}
$endif$
$if(titlepage-style-code.footer.doublelinetight)$
\newcommand{\titlepagefooterblock}{
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} 

\HRule\\[0.4cm]

\footerstyled

\HRule\\
}
$endif$

$if(titlepage-style-code.date.none)$
\newcommand{\titlepagedateblock}{}
$endif$
$if(titlepage-style-code.date.plain)$
\newcommand{\titlepagedateblock}{
\datestyled
}
$endif$
$if(titlepage-style-code.date.colorbox)$
\newcommand{\titlepagedateblock}{
{\setlength{\fboxrule}{$if(titlepage-theme.date-colorbox-borderwidth)$$titlepage-theme.date-colorbox-borderwidth$$else$0pt$endif$}
\fcolorbox{$if(titlepage-theme.date-colorbox-bordercolor)$$titlepage-theme.date-colorbox-bordercolor$$else$black$endif$}{$if(titlepage-theme.date-colorbox-fill)$$titlepage-theme.date-colorbox-fill$$else$cyan$endif$}{
\parbox[t]{0.90\minipagewidth}{ % Outer full width box
\parbox[t]{0.85\minipagewidth}{ % Inner box for inner right text margin
$if(titlepage-theme.date-align)$\titlepagedatealign$else$$if(titlepage-theme.page-align)$\titlepagepagealign$endif$$endif$
\vspace{0.7cm}

\datestyled

\vspace{0.7cm}
}} % end of parboxes
} % fcolorbox
} % ensure fbox set is restricted
}
$endif$
$if(titlepage-style-code.date.doublelinewide)$
\newcommand{\titlepagedateblock}{
\rule{\textwidth}{0.4pt} % Thin horizontal rule
\vspace{0.1\textheight} % Whitespace between the top rules and title

\datestyled

\vspace{0.025\textheight} 
\rule{0.3\textwidth}{0.4pt} % Short horizontal rule under the title
}
$endif$
$if(titlepage-style-code.date.doublelinetight)$
\newcommand{\titlepagedateblock}{
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} 

\HRule\\[0.4cm]

\datestyled

\HRule\\
}
$endif$

