# How can I avoid a persistent warning concerning possibly changed labels when using background and TikZ?

Last month, I posted the following code as an answer to a question. The code gives the right output. However, what I did not notice but Thérèse did is that it generates a warning concerning undefined labels which persists no matter how many times it is compiled.

LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.


Why does the warning persist and what ought I to do to avoid it?

\documentclass[a4paper]{article}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
\begin{tikzpicture}
\fill [red] (current page.north west) rectangle ($(current page.north east)!.2!(current page.south east)$) coordinate (a);
\fill [yellow] (current page.south west) rectangle (a);
\end{tikzpicture}}}
\usepackage{kantlipsum}
\begin{document}
\kant[1-5]
\end{document}

• kantlipsum :D Now that's interesting. – Alenanno Jan 3 '16 at 20:34

If I were to guess, it would be that tikz thinks the current page changes when the rectangles are added. Adding the overlay option prevents the warning.

\documentclass[a4paper]{article}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
\begin{tikzpicture}[overlay]
\fill [red] (current page.north west) rectangle ($(current page.north east)!.2!(current page.south east)$) coordinate (a);
\fill [yellow] (current page.south west) rectangle (a);
\end{tikzpicture}}}
\usepackage{kantlipsum}
\begin{document}
\kant[1-5]
\end{document}

• Hmm. Interesting. It takes 3 compilations to resolve the references even with overlay. – cfr Jan 3 '16 at 22:34