I'm trying to do this
\usepackage{scrpage2}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{calc}
%\usetikzlibrary{intersections}
%\tikzset{variable/.default=}
\newcommand{\pageframe}{%
\begin{tikzpicture}[remember picture, overlay]
% page frame
\fill[red](current page.north west) rectangle (current page.south east);
\fill[white,rounded corners=1cm]($(current page.north west)+%(1cm,-1cm)$) rectangle ($(current page.south east)+(-1cm,4cm)$);
% \node[fill=green,text width=1.5cm,text centered]
% at ($(current page.south)+(0,4cm)$){\strut\pagemark};
%% \strut gives all page mark nodes the same hight.
\end{tikzpicture}
}
% set page style
\cehead[\pageframe]{\pageframe}
\cohead[\pageframe]{\pageframe}
\pagestyle{scrheadings}
but it fails to compile:
! Argument of \tikz@cc@parse@factor has an extra }.
I don't get it; if I comment the last line, \pagestyle{scrheadings}, it compiles, though output remains unmodified...

\fillcommand. In (La)TeX,%represents a comment character, implying that everything after (to the right of) it will be disregarded. You either remove/comment the entire line or understand the command structure of\fillto modify it accordingly. Finally, it compiles fine when you comment\pagestyle{scrheadings}because the\pageframemacro (containing the problematic\fill) is only executed once you set the page style toscrheadings. If you don't set these headings, the incomplete code is never executed. – Werner Feb 25 '12 at 15:23