# Title page in book class using tikz

I am trying to design a title page in book class. I want the title page exactly to look like the image attached. It is easily possible to create an array of rectangles in tikz. However I am having difficulty in the following.

1. How to scale or fit tikz image to paper width and height?
2. How to embed text inside rectangles?

Though I use LaTeX a lot, I am new to tikz. There are other alternatives which I am thinking of. For example to include the image with include graphics or to include single pdf page with the package pdfpages. However it would be nice to have such a title page natively with tikz. Any help would be appreciated. Thanks.

• Welcome to TeX-SE! It is straightforward to achieve this with overlay,remember picture and using absolute page coordinates. However, it is tedious to add all the texts, the more so you were saying you already have something. Why don't you post the code that you already have? – user121799 Jun 3 at 15:20
• you may have a look at TikZ code in here tex.stackexchange.com/questions/484922/…. Also using \paperwidth and \paperheight (as in marmot's answer) is helpful – Black Mild Jun 4 at 15:00

With simple tubulars and rules:

\documentclass{book}
\usepackage{libertinus}
\usepackage[svgnames,table]{xcolor}
\usepackage{tabularx}
\usepackage{url,ragged2e}
\renewcommand\tabularxcolumn[1]{m{#1}}
\usepackage{geometry}
\def\HUGE{\fontsize{1.6cm}{1.7cm}\selectfont}
\definecolor{ColA}{cmyk}{0.00,0.67,0.70,0.39}
\definecolor{ColB}{cmyk}{0.21,0.00,0.64,0.31}
\definecolor{ColC}{cmyk}{0.00,0.45,0.85,0.12}
\definecolor{ColD}{cmyk}{0.00,0.70,0.72,0.29}
\definecolor{ColE}{cmyk}{0.75,0.16,0.00,0.25}
\begin{document}

\begin{titlepage}
\newgeometry{margin=0mm}
\parindent=0pt\arrayrulecolor{white}\arrayrulewidth=1pt\tabcolsep=5pt
\begin{tabularx}{\linewidth}{@{} X |X |X |X @{}}
\multicolumn{4}{@{} c @{}}{%
\cellcolor{ColA}\rule[-1cm]{0pt}{3cm}\bfseries\large
\shortstack{\textcolor{white}{School of Mathematics}\\[1em]
\Large\textcolor{white}{XYZ University}}}\\\hline
%
\multicolumn{3}{@{} r| @{}}{%
\cellcolor{ColB}\rule[-6cm]{0pt}{12cm}%
\bfseries\textcolor{white}{\shortstack[l]{\HUGE Book Title\\[2cm]
\Large subtitle%
}} \hspace*{1.5cm}}  & \cellcolor{ColC}\rule{\linewidth}{0pt}\\\hline
%
\rowcolor{ColA}%
\rule{0pt}{2cm}  & & & \Centering\large\bfseries\textcolor{white}{Course code}\\\hline
%
\multicolumn{3}{@{} c| @{}}{%
\cellcolor{ColD}\rule[-4.1cm]{0pt}{8.2cm}%
\bfseries\large\shortstack[l]{Email: \url{me@domain.org}\\[0.5cm]
Website: \\[0.5cm]Phone: }}  & \cellcolor{ColE}\rule{\linewidth}{0pt}\\\hline
%
\multicolumn{4}{@{} l @{}}{%
\end{tabularx}
\end{titlepage}
\restoregeometry

foo
\end{document}


• @Red-Cloud Thanks. It works. I could get most of the code and edit it. How did you decide distances? How did you identify colors? – Maths89 Jun 4 at 5:56
• Distances by trial and error (only the last rectangle is important to get the whole page) and colors with gimp and its color pencil. – user187802 Jun 4 at 6:02

This is to give you a start. I do not have to complete it but the rest is just repetition. One simple way to embed a text in a rectangle path is to use node[midway] as in

 \draw[white,fill=bookred] (current page.north west) rectangle
++(\paperwidth,-4cm) node[midway,font=\Large\bfseries,align=center]
{School of Mathematics\\[1em] XYZ University};


or to add it midway to the diagonal of the rectangle

 \path ([yshift=-18cm,xshift=0.75*\paperwidth]current page.north west)
-- ++ (0.25\paperwidth,-2)  node[midway,white,font=\bfseries,scale=1.5] {Course
code};


Another way is to draw a node with node[draw,...].

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{positioning}
\definecolor{bookred}{RGB}{129, 57, 55}
\definecolor{bookredtop}{RGB}{204,61,57}
\definecolor{greentop}{RGB}{168, 197, 83}
\definecolor{greenbottom}{RGB}{128, 150, 64}
\definecolor{orangetop}{RGB}{230, 142, 54}
\definecolor{orangebottom}{RGB}{184, 110, 43}
\definecolor{bluetop}{RGB}{54,178,212}
\definecolor{bluebottom}{RGB}{39,137,162}

\begin{document}
\begin{tikzpicture}[overlay,remember picture,nodes={inner sep=0pt,outer sep=0pt}]
\draw[white,fill=bookred] (current page.north west) rectangle
++(\paperwidth,-4cm) node[midway,font=\bfseries,align=center,scale=2]
{School of Mathematics\\[0.5em] XYZ University};
\draw[white,top color=greentop,bottom color=greenbottom] ([yshift=-4cm]current page.north west)
rectangle   ++(0.75\paperwidth,-14cm);
\draw[white,top color=orangetop,bottom color=orangebottom] ([yshift=-4cm]current
page.north east) rectangle  ++(-0.25\paperwidth,-14cm);
\draw[white,fill=bookred] ([yshift=-18cm]current page.north west)
rectangle
++(\paperwidth,-2cm);
\node[scale=4,font=\bfseries,white] (title) at ([yshift=4cm]current page.center) {Book title};
\node[scale=1.5,font=\bfseries,white,anchor=west]   at ([yshift=-2cm]title.west)
{Subtitle};
\draw[white]  foreach \X  in {0.25,0.5,0.75}
{([yshift=-18cm,xshift=\X*\paperwidth]current page.north west)
-- ++(0,-2)} coordinate(aux);
\path ([yshift=-18cm,xshift=0.75*\paperwidth]current page.north west)
-- ++ (0.25\paperwidth,-2)  node[midway,white,font=\bfseries,scale=1.5] {Course
code};
\draw[white,fill=bookred] (current page.south west) rectangle
++(\paperwidth,2cm);
\draw[white,bottom color=bookred,top color=bookredtop]
([yshift=2cm]current page.south west) rectangle (aux);
\draw[white,bottom color=bluebottom,top color=bluetop]
([yshift=2cm]current page.south east) rectangle (aux);
\path ([yshift=2cm]current page.south west) -- (aux) node[midway,above
left=-4em and -2em,align=left,scale=1.5] {Email: abc@xyz\\[1em]
Website: \\[1em] Phone: \\[1em]};
\path ([yshift=1cm,xshift=1em]current page.south