[Tex/LaTex] Titlepage with tikz

tikz-pgftitles

I need some help with a titlepage for tikz

I want to create the following… 3 red lines, a gray space a green space but I already fail with just creating a line across the whole page…

\draw (0,0) -- (\pagewidth,0) fails :-(, it only creates a line of 2 cm or so…

I hope anyone is good with tikz and can create this for me.

reference image

Update

@Tobi I now have the following:

\documentclass{report}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{
  calc,
  positioning
}
\begin{document}
\begin{titlepage}
\begin{tikzpicture}[overlay,remember picture]
  \coordinate (SW) at (current page.south west);
  \coordinate (SE) at (current page.south east);
  \coordinate (NW) at (current page.north west);
  \coordinate (NE) at (current page.north east);

  % commented out because it is not necessary to compile, 
  % but one should note that the background is here, 
  % because of overlapping parts.
  %\node at ($(current page.south west)$){
  %  \begin{tikzpicture}[overlay]
  %    %\includegraphics[width=\paperwidth]{./figures/cover_spaceshuttle.jpg}
  %  \end{tikzpicture}};  

  \fill[blue,very nearly opaque] ($(SW)!0.2!(SE)$) -| ($(SE)!1.95!(NE)$) -- cycle;
  \fill[red,very nearly opaque] ($(SW)!0.2!(SE)$) -| ($(SE)!1.95!(NE)$) -- cycle;
  \draw[white,fill] ($(SW)$) rectangle ($(SE)!0.1!(NE)$);
  \fill[blue,very nearly opaque] ($(SW)!0.2!(SE)$) -| ($(SE)!1.95!(NE)$) -- cycle;
  \draw[red] ($(SW)!0.20!(SE)$) -- ($(NW)!0.61!(NE)$);
  \draw[red] ($(SW)!0.10!(NW)$) -- ($(SE)!0.10!(NE)$);
  \node at ($(SW)!0.1!(NW)$) [
    anchor=north,
    xshift=6.40cm,
    yshift=0.13cm,
    minimum width=\paperwidth,
    align=center,
    outer sep=0pt,
    font=\sffamily]{something};
\end{tikzpicture}
\end{titlepage}
\end{document}

This code generates the following page Current situation and prefered situation

Now the blue fill fills all the way to the top, on the left side. But I only want to let it fill at about $(SW)!0.05!(NW)$, the right side. How do I achieve this? Thanks in advance

Best Answer

Use the options overlay and remember picture to make the cooridnates of the current page available as the current page node.

Try to adapt this to fit your needs …

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc,positioning}% [0]

\begin{document}
\begin{titlepage}
\begin{tikzpicture}[overlay,remember picture,line width=5pt]
    % set a new origin [1]
    \coordinate (O) at (current page.south west);
    % gray triangle
    \fill [gray] (current page.south west) -| (current page.north east) -- cycle;
    % red line
    \draw [red] (current page.south west) -- (current page.north east);
    % white framed box
    \node at (current page.south) [%
        draw=red,
        inner sep=15pt,
        fill=white,
        above=5cm,
        font=\sffamily\bfseries\Huge
    ] {The book title};
    % red box at 0.8\pageheight
    \node (Author) at ($(O)+(0,0.8\paperheight)$) [% [2] [4]
        fill=red,
        anchor=south west,
        minimum width=\paperwidth,
        align=center,
        outer sep=0pt,
        font=\sffamily\bfseries] {Jon Doe};
    % red box at 0.75\paperheight
    \node at ($(current page.south)!0.75!(current page.north)$) [% [3]
        fill=red,
        anchor=south,
        minimum width=\paperwidth,
        align=center,
        outer sep=0pt,
        font=\sffamily] {\today};
    % red box above the author
    \node [%
        fill=red,
        above=1mm of Author,% [5]
        minimum width=\paperwidth,
        align=center,
        outer sep=0pt,
        font=\sffamily] {\TeX.SX example press};
\end{tikzpicture}
\end{titlepage}
\end{document}

title page

(Compile twice to get the right result)

Update
I added three more ways to position your elements on the page

  • Set a new origin coordinate (O) to the lower left corner 1 of the page and move relatively [2] to it (needs calc library [0]).
  • Use TikZ to calculate the position using the (point)!div!(point) syntax [3] (needs calc library [0]).
  • Name a node [4] and position a second node relatively to it [5] (needs positioning library [0]).