I was inspired by this example to try and make some advanced headers using tikz. I attempted to construct a simple example in order to understand how it all works together and managed to create this:
The problem is that the header doesn't extend across the entire page like the example, and I've tried to figure out how but to no avail, unfortunately. Here's the MWE:
\documentclass{article}
\usepackage[a4paper, hmargin=2cm, vmargin=1cm, includeheadfoot]{geometry}
\usepackage[nocheck]{fancyhdr}
\usepackage{tikz}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{20pt}
\pagestyle{fancy}
\fancyhead[R]{
\begin{tikzpicture}
\draw[left color = red!80!black, right color=red!50!black] (current page.north west) rectangle ($ (current page.north east) +(-4cm,-1cm) $);
\node[circle, very thick, draw=yellow, text = white] at ($ (current page.north east) + (-4.5cm, -0.5cm) $) {\thepage};
\end{tikzpicture}
}
\begin{document}
Here's a random introduction
\newpage
Here's some more random text
\end{document}
In the example, the original poster could just use the current page function of tikz to ensure the header stretched across horizontally without further modifications, yet I need to manually do that with the calc library if I want to achieve the same effect. How can I auto calibrate the header to extend across the page horizontally?
