[Tex/LaTex] TikZ full page with absolute node positioning

fullpagepositioningtikz-pgf

I am new to tikz and trying to learn how to use it to draw a full page cover page for a report I am writing. I have successfully changed the margins and can render to the full page, but I am struggling to understand how I can draw rectangles at fixed absolute locations from the bottom on the page. I want to put tabulars into the rectangle nodes to display name blocks over the water mark image.

So my question is how can I draw the blue and red nodes on my page at absolute locations? Also can I specify the height ( say 4cm) of the node (rectangle) and center the tabluar vertically in that rectangle?

In my code all I can see in the blue rectangle at the top.

        \documentclass[a4paper,12pt]{article}
        \usepackage{tikz}
        \usepackage[left=5.2cm,top=2cm,right=1.5cm,bottom=2cm,verbose,nohead,nofoot]{geometry}
        \usepackage{etoolbox}

        % Set up full page to draw in 

        \AfterEndEnvironment{myfullpage}{\restoregeometry}
        \newenvironment{myfullpage}{%
            \newgeometry{left=0cm,top=0cm,right=0cm,bottom=0cm,nohead,nofoot}%
        }{%
            \newpage%
        }

        \begin{document}
        \begin{myfullpage}
            \begin{tikzpicture}[remember picture,overlay,shift={(current page.south west)}]
                %\node [inner sep=0pt,above right] {\includegraphics[width=\paperwidth]{matrix.eps}};

                % Draw a full page width filled rectangle with tabular over at bottom of page 

                \begin{tikzpicture}[remember picture,overlay, anchor = west]
                    \node (names) [shape=rectangle,fill=blue,minimum width =\paperwidth] {
                        \begin{tabular}{r l}
                            A & B
                        \end{tabular}
                    };
                \end{tikzpicture}

                % Draw a full page width filled rectangle with tabular over 8 cm from page current page.south west

                \begin{tikzpicture}[remember picture,overlay, shift={(0 cm, 8cm)}, anchor=west]
                    \node (names) [shape=rectangle,fill=red,minimum width =\paperwidth] {
                    \begin{tabular}{r l}
                            one & two
                    \end{tabular}
                    };
                \end{tikzpicture}

            \end{tikzpicture}
        \end{myfullpage}
        \end{document} 

Best Answer

Something like this?

full width rectangles

Note that nesting tikzpictures should be avoided if at all possible as it is known to cause problems.

There is no need to change the geometry here: we can just use absolute coordinates relative to the page itself e.g. (current page.center) for positioning:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage[left=5.2cm,top=2cm,right=1.5cm,bottom=2cm,verbose,nohead,nofoot]{geometry}
\usepackage{etoolbox}

\begin{document}
  \thispagestyle{empty}
  \begin{tikzpicture}[remember picture,overlay]
      \node (back names) [shape=rectangle, fill=blue, minimum height=40mm, minimum width=\paperwidth, anchor=south west] at (current page.south west) {};
      \node at (back names.center) {
        \begin{tabular}{r l}
          A & B
        \end{tabular}
      };
      \node (names) [shape=rectangle, fill=red, minimum width=\paperwidth, anchor=west] at ([yshift=8cm]current page.south west) {
        \begin{tabular}{r l}
          one & two
        \end{tabular}
      };
  \end{tikzpicture}
\end{document}

The tabular is most easily centred by drawing it after the blue rectangle with a center anchor.

Note that there is not much point in naming two nodes names. If you need to refer to the nodes, they need unique names. If not, they don't need names at all.