13

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

  • 1
    Slightly off topic: This is great! May I use it for my own documents? – Henri Menke Jan 26 '14 at 20:09
  • @HenriMenke Sure, you are welcome to use it but hope to optimize the code with a help of some of the guys here. – azetina Jan 26 '14 at 20:10
  • If neither of @HenriMenke's suggestions are what you had in mind, perhaps you could post a mock up. It wouldn't need to be precisely what you want but just showing where the addition should go and roughly the size you have in mind would help people understand the purpose. (Your question is otherwise excellent - just you are asking something quite precise, I think, and it is difficult to explain it in words, probably.) I like the design a lot, too... – cfr Jan 26 '14 at 23:28
  • @cfr See edited version. – azetina Jan 27 '14 at 15:26
  • @HenriMenke and azetina have a look at transparency groups in the manual. – percusse Jan 27 '14 at 15:36
14

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

|improve this answer|||||
  • See updated question. – azetina Jan 27 '14 at 15:29
  • Thanks for the improved code. I will look into it as soon as I can. – azetina Apr 26 '14 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.