# Title Page with TikZ that fits on A4 Paper Size

Using the following TikZ code or background image, I would like to add some information to it and use as my title page such that it fits perfectly on an A4 paper size.

\begin{tikzpicture}
\shadedraw [left color=red,right color=blue] (0,0) rectangle (10,13);
\end{tikzpicture}


1. My book's title centered around the top: "This is my Book's Title" in white text.
2. Then below that the author, also centered and in white: "Author XY". I am using the standard book class.
3. And finally down below the date also in white and centered.

How can I achieve this?

-
I would suggest looking into tikzpagenodes... –  Werner Feb 5 '14 at 20:33
Thanks for the suggestion Werner. I succeeded in getting the background image fill the whole page a with the code below: \thispagestyle{empty} \begin{tikzpicture}[remember picture,overlay] {% %\draw [blue,line width=2mm](current page.south west)rectangle (current page.north east); \shadedraw [top color=red,bottom color=blue] (current page.south west) rectangle (current page.north east); }% \end{tikzpicture}. But how can I add my information as mentioned above? –  Daves Broadley Feb 5 '14 at 21:52
But when I add the following lines in the above code: \draw [green] (current page text area.south west) rectangle (current page text area.north east); I get an error saying No shape named current page text area is known? Did I miss something? –  Daves Broadley Feb 5 '14 at 22:00
@DavesBroadley dis you load the package, \usepackage{tikzpagenodes}? –  Gonzalo Medina Feb 5 '14 at 23:43
@GonzaloMedina thanks. That's exactly what I was missing. I thought the nodes are provided in the tikz package when I use 'remember picture' and 'overlay' as options. I did not know I also have to include the tikzpagenodes package. Thanks –  Daves Broadley Feb 6 '14 at 6:26

You don't have to do everything with tikz. In fact, it is not advisable. Draw the shaded region with tikz and type every thing else using titlepage environment. This way you get more control.

\documentclass{book}
\usepackage{tikz}
\usepackage[a4paper,margin=1in]{geometry}
\begin{document}
\begin{titlepage}
\centering  \sffamily
\begin{tikzpicture}[remember picture,overlay]
\shade [top color=red,bottom color=blue] (current page.south west) rectangle (current page.north east);
\end{tikzpicture}
{\Huge\textcolor{white}{This is my book'stitle}}
\par\vspace{0.5in}
{\large \textcolor{white}{This is my subtitle}}
\par\vspace{\stretch{1}}
{\Large \textcolor{white}{Author XY}}
\par
\vfill
\textcolor{white}{\today}
\end{titlepage}
\end{document}


-
Thank you very much Harish Kumar for the solution and advice. It fits perfectly like magic. @jesse thank you also. Harish Kumar's worked well for me. Thanks guys! –  Daves Broadley Feb 6 '14 at 6:22

Would this be what you seek? Here a solution defines node A and B at current page.south west and current page.north east, respectively. Write those three lines respectivley at current page.north, current page.center and current page.south. Actually, current page node notion is an absolute position, one can add option [xshift=<dim>,yshift=<dim>] to place a node anywhere in the page and write text. For example,

\node [yshift=-3cm,text=white] at (current page.north){\large \sf This is a subtitle};


will add a subtitle right below the book title.

Code

\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\pagetyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\node (A) at (current page.south west){};
\node (B) at (current page.north east){};
\shade [top color=red,bottom color=blue] (A) rectangle (B);

\node  [yshift=-2cm,text=white] at (current page.north){\Huge \sf This is my book'stitle};
\node [yshift=-3cm,text=white] at (current page.north){\large \sf This is a subtitle};

\node [text=white] at (current page.center){\Large \sf Author XY};

\node [yshift=2cm,text=white] at (current page.south){\today};
\end{tikzpicture}
\end{document}

-
Why use four tikzpicture? One is enough... –  Paul Gaborit Feb 6 '14 at 0:18
To remove the page number, you may use the titlepage environment. –  Paul Gaborit Feb 6 '14 at 0:19
To remove the black border around the background, use \shade (or \fill) instead of \shadedraw. –  Paul Gaborit Feb 6 '14 at 0:24
@PaulGaborit -- Thanks for the comments, I did observe those to improve my post, working on it and my internet is giving me trouble now. Yes. one tikzpicture is enough, but I was considering 3 areas to write text, trying to code in 3 sections for easy of debugging. –  Jesse Feb 6 '14 at 0:39