[Tex/LaTex] Code improvement on a title page design

best practicescode-reviewtikz-pgf

I am designing a new title page to post in the topic Showcase of beautiful title page done in TeX but am having some issues with the code I wrote. I don't like and I know it can be improved. In addition I would like to add a small little feature to it. I would like to add a horizontal line (essentially a mini version of the same shape, trapezoid, I have designed) right below the epigraph statement with a different opacity say, opacity=0.5. Here is the MWE:

enter image description here

\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{lipsum}

\renewcommand\epigraphflush{flushleft}
\renewcommand\epigraphsize{\normalsize}
\setlength\epigraphwidth{0.7\textwidth}

\definecolor{titlepagecolor}{cmyk}{0.436,.865,0,.478}

\DeclareFixedFont{\titlefont}{T1}{ppl}{b}{it}{0.5in}

\makeatletter                       
\def\printauthor{%                  
    {\large \@author}}              
\makeatother
\author{%
    Author 1 name \\
    Department name \\
    \texttt{email1@example.com}\vspace{20pt} \\
    Author 2 name \\
    Department name \\
    \texttt{email2@example.com}
    }
% This is the command I wish to optimize
\newcommand\titlepagedecoration[1]{%
\begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]
\coordinate (tp1) at ([yshift=2cm]current page.west);
\coordinate (tp2) at ([yshift=2cm,xshift=9cm]current page.west);
\coordinate (tp3) at ([yshift=-15pt,xshift=7cm]current page.north);
\coordinate (tp4) at ([yshift=-15pt]current page.north west);

\filldraw[draw=titlepagecolor,fill=titlepagecolor] (tp1)--(tp2)--(tp3)--(tp4)--cycle;
\filldraw[draw=titlepagecolor!30!white,fill=titlepagecolor!30!white,opacity=0.2] ([xshift=-5cm]tp1)--([xshift=-5cm]tp2)--([xshift=-5cm]tp3)--([xshift=-5cm]tp4)--cycle;
\node[right] at ([xshift=1cm,yshift=-5cm]current page.north west) {\parbox{\textwidth}{\color{white}#1}};
\end{tikzpicture}%
}

\begin{document}
\begin{titlepage}
\titlepagedecoration{%
\titlefont Hardy's Theorem\par
\epigraph{Pure mathematics is on the whole distinctly more useful than applied. For what is useful above all is technique, and mathematical technique is taught mainly through pure mathematics.}%
{\textit{London 1941}\\ \textsc{G. H. Hardy}}
}
\null\vfill
\vspace*{1cm}
\noindent
\begin{minipage}{0.35\linewidth}
    \begin{flushleft}
        \printauthor
    \end{flushleft}
\end{minipage}
\end{titlepage}
\lipsum[1-2]
\end{document}

Note that the part I wish to optimize is the background code.

EDIT

Here is a quick mockup of what am after which is almost achieved by Henri Menke below:

enter image description here

Best Answer

I hope, I got you right.

\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{lipsum}

\renewcommand\epigraphflush{flushleft}
\renewcommand\epigraphsize{\normalsize}
\setlength\epigraphwidth{0.7\textwidth}

\definecolor{titlepagecolor}{cmyk}{0.436,.865,0,.478}

\DeclareFixedFont{\titlefont}{T1}{ppl}{b}{it}{0.5in}

\makeatletter                       
\def\printauthor{%                  
    {\large \@author}}              
\makeatother
\author{%
    Author 1 name \\
    Department name \\
    \texttt{email1@example.com}\vspace{20pt} \\
    Author 2 name \\
    Department name \\
    \texttt{email2@example.com}
    }
% This is the command I wish to optimize
\newcommand\titlepagedecoration[1]{%
\begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]
\coordinate (tp1) at ([yshift=2cm]current page.west);
\coordinate (tp2) at ([yshift=2cm,xshift=9cm]current page.west);
\coordinate (tp3) at ([yshift=-15pt,xshift=7cm]current page.north);
\coordinate (tp4) at ([yshift=-15pt]current page.north west);

\filldraw[draw=titlepagecolor,fill=titlepagecolor] (tp1)--(tp2)--(tp3)--(tp4)--cycle;
\filldraw[draw=titlepagecolor!30!white,fill=titlepagecolor!30!white,opacity=0.2] ([xshift=-5cm]tp1)--([xshift=-5cm]tp2)--([xshift=-5cm]tp3)--([xshift=-5cm]tp4)--cycle;
\node[right] at ([xshift=1cm,yshift=-5cm]current page.north west) {\parbox{\textwidth}{\color{white}#1}};
\end{tikzpicture}%
}

\begin{document}
\begin{titlepage}
    \titlepagedecoration{%
        \titlefont Hardy's Theorem\par
        \epigraph{Pure mathematics is on the whole distinctly more useful than applied. For what is useful above all is technique, and mathematical technique is taught mainly through pure mathematics.}%
        {\textit{London 1941}\\ \textsc{G. H. Hardy}}
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%% CHANGES HERE %%%%%%%%%%%%%%%%
        \tikz[remember picture,overlay]{%
            \node (X) {};
            \filldraw[opacity=0.5,draw=titlepagecolor,fill=titlepagecolor] (tp1 |- X) -- (X -| tp2) -- (tp2) -- (tp1) -- cycle;
        }
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    }
    \null\vfill
    \vspace*{1cm}
    \noindent
    \begin{minipage}{0.35\linewidth}
        \begin{flushleft}
            \printauthor
        \end{flushleft}
    \end{minipage}
\end{titlepage}
\lipsum[1-2]
\end{document}

enter image description here

Another possibility is

\documentclass[letterpaper]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{lipsum}

\renewcommand\epigraphflush{flushleft}
\renewcommand\epigraphsize{\normalsize}
\setlength\epigraphwidth{0.7\textwidth}

\definecolor{titlepagecolor}{cmyk}{0.436,.865,0,.478}

\DeclareFixedFont{\titlefont}{T1}{ppl}{b}{it}{0.5in}

\makeatletter                       
\def\printauthor{%                  
    {\large \@author}}              
\makeatother
\author{%
    Author 1 name \\
    Department name \\
    \texttt{email1@example.com}\vspace{20pt} \\
    Author 2 name \\
    Department name \\
    \texttt{email2@example.com}
    }
% This is the command I wish to optimize
\newcommand\titlepagedecoration[1]{%
\begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]
\coordinate (tp1) at ([yshift=2cm]current page.west);
\coordinate (tp2) at ([yshift=2cm,xshift=9cm]current page.west);
\coordinate (tp3) at ([yshift=-15pt,xshift=7cm]current page.north);
\coordinate (tp4) at ([yshift=-15pt]current page.north west);

\filldraw[draw=titlepagecolor,fill=titlepagecolor] (tp1)--(tp2)--(tp3)--(tp4)--cycle;
\filldraw[draw=titlepagecolor!30!white,fill=titlepagecolor!30!white,opacity=0.2] ([xshift=-5cm]tp1)--([xshift=-5cm]tp2)--([xshift=-5cm]tp3)--([xshift=-5cm]tp4)--cycle;
\node[right] at ([xshift=1cm,yshift=-5cm]current page.north west) {\parbox{\textwidth}{\color{white}#1}};
\end{tikzpicture}%
}

\begin{document}
\begin{titlepage}
    \titlepagedecoration{%
        \titlefont Hardy's Theorem\par
        \epigraph{Pure mathematics is on the whole distinctly more useful than applied. For what is useful above all is technique, and mathematical technique is taught mainly through pure mathematics.
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%%%%% CHANGES HERE %%%%%%%%%%%%%%%%
        \tikz[remember picture,overlay]{%
            \node (X) at (0,-1ex) {};
            \filldraw[opacity=0.5,draw=titlepagecolor,fill=titlepagecolor] (tp1 |- X) -- (X -| tp2) -- (tp2) -- (tp1) -- cycle;
        }
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        }%
        {\textit{London 1941}\\ \textsc{G. H. Hardy}}

    }
    \null\vfill
    \vspace*{1cm}
    \noindent
    \begin{minipage}{0.35\linewidth}
        \begin{flushleft}
            \printauthor
        \end{flushleft}
    \end{minipage}
\end{titlepage}
\lipsum[1-2]
\end{document}

enter image description here


I updated my answer according to your edit:

\documentclass[letterpaper]{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{epigraph}
\usepackage{lipsum}
\renewcommand\epigraphflush{flushleft}
\renewcommand\epigraphsize{\normalsize}
\setlength\epigraphwidth{0.7\textwidth}
\definecolor{titlepagecolor}{cmyk}{0.436,.865,0,.478}
\DeclareFixedFont{\titlefont}{T1}{ppl}{b}{it}{0.5in}
\makeatletter                       
\def\printauthor{%                  
    {\large \@author}}              
\makeatother
\author{%
    Author 1 name \\
    Department name \\
    \texttt{email1@example.com}\vspace{20pt} \\
    Author 2 name \\
    Department name \\
    \texttt{email2@example.com}
    }
% This is the command I wish to optimize
\newcommand\titlepagedecoration[1]{%
\begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]
\coordinate (tp1) at ([yshift=2cm]current page.west);
\coordinate (tp2) at ([yshift=2cm,xshift=9cm]current page.west);
\coordinate (tp3) at ([yshift=-15pt,xshift=7cm]current page.north);
\coordinate (tp4) at ([yshift=-15pt]current page.north west);
% Place text to het its coordinates
\node[right] (titletext) at ([xshift=1cm,yshift=-5cm]current page.north west) {\parbox{\textwidth}{\color{white}#1}};

\path[name path=p1] ([xshift=-5cm]tp2) -- ([xshift=-5cm]tp3);
\path[name path=p2] (tp2) -- (tp3);
\path[name path=p3] (tp1 |- titletext.south) -- (titletext.south -| tp3);

\path[name intersections={of=p1 and p3,name=first}];
\path[name intersections={of=p2 and p3,name=second}];

\filldraw[titlepagecolor!100!white] (first-1) -- (second-1) -- (tp3) -- ([xshift=-5cm]tp3) -- cycle;
\filldraw[titlepagecolor!80!white] (tp4) -- ([xshift=-5cm]tp3) -- (first-1) -- (tp1 |- titletext.south) -- cycle;
\filldraw[titlepagecolor!100!white] (tp1 |- titletext.south) -- (first-1) -- ([xshift=-5cm]tp2) -- (tp1) -- cycle;
\filldraw[titlepagecolor!80!white] (first-1) -- (second-1) -- (tp2) -- ([xshift=-5cm]tp2) -- cycle;
% Place text again, to have it on top
\node[right] (titletext) at ([xshift=1cm,yshift=-5cm]current page.north west) {\parbox{\textwidth}{\color{white}#1}};
\end{tikzpicture}%
}

\begin{document}
\begin{titlepage}
    \titlepagedecoration{%
        \titlefont Hardy's Theorem\par
        \epigraph{Pure mathematics is on the whole distinctly more useful than applied. For what is useful above all is technique, and mathematical technique is taught mainly through pure mathematics.}%
        {\textit{London 1941}\\ \textsc{G. H. Hardy}}
    }
    \null\vfill
    \vspace*{1cm}
    \noindent
    \begin{minipage}{0.35\linewidth}
        \begin{flushleft}
            \printauthor
        \end{flushleft}
    \end{minipage}
\end{titlepage}
\lipsum[1-2]
\end{document}

enter image description here