# How to make a tikz picture appear on every page of document

I am relatively new to Latex and I am struggeling with the use of the tikzpicture package.

What I want to do is to create a coloured column on the left side of every page in my document. Curently I am using the following code for this.

    \begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=sidecolor, anchor=north, minimum width=9cm, minimum height=\paperheight+1cm] (box) at (-5cm,0.5cm){};
\end{tikzpicture}


The problem is that this code only produces a coloured bar on the first page of my document and does not extend it to multiple pages.

My question is therefore, how do i implement this tikzpicture to multiple pages in my document?. Does anyone have any insights on how to tackle this problem.

Note: I am not trying to make a header or footer.

Kind regards.

Thanks!

• Welcome! Are you aware of the eso-pic package? – user121799 Feb 15 '18 at 14:30
• Hello, No I am not aware of that package. However I will look into it now that you mention it. Thank you – Balraj Boyal Feb 15 '18 at 14:32
• Or perhaps easier, the background package or the tikzpagenodes package. See e.g. Getting a particular kind of page border using background package – Alan Munn Feb 15 '18 at 14:33
• Welcome! Please, always provide a Minimal Working Example (↗MWE). – AlexG Feb 15 '18 at 14:44

• Package atbegshi is an option for inserting material on every page at an absolute position.

• Package xsavebox helps reducing the final PDF size when repeatedly inserting the same content.

\documentclass{article}

\usepackage{tikz}
\usepackage{xsavebox} %save content for repeated use
\usepackage{atbegshi} %insert material on every page

\usepackage{kantlipsum} %bla, bla

\xsavebox{PageBGPicture}{%
\begin{tikzpicture}
\node [rectangle, fill=yellow, minimum width=9cm, minimum height=\paperheight] (box) {};
\end{tikzpicture}
}

%position background picture absolutely (w.r.t. upper left page corner) on every page
\AtBeginShipout{
\AtBeginShipoutUpperLeft{\raisebox{-\height}{\xusebox{PageBGPicture}}}
}

\begin{document}
\kant[1-10]
\end{document}

• Hello AlexG, Thanks this work with some tweaking. – Balraj Boyal Feb 19 '18 at 13:21

Just for fun, something using eso-pic. Node that I made your node names unique by adding the page number.

\documentclass{article}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{eso-pic}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=blue, anchor=west, minimum width=9cm, minimum height=\paperheight+1cm]
(box\thepage) at
(current page text area.west){};
\end{tikzpicture}}
\lipsum[1-8]
\end{document}


Use the atbegshi package.

\usepackage{atbegshi}

\AtBeginShipout
{
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=sidecolor, anchor=north, minimum width=9cm, minimum height=\paperheight+1cm] (box) at (-5cm,0.5cm){};
\end{tikzpicture}
}