Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
    
The reason for it not compiling is because of the incomplete second \fill command. 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 \fill to modify it accordingly. Finally, it compiles fine when you comment \pagestyle{scrheadings} because the \pageframe macro (containing the problematic \fill) is only executed once you set the page style to scrheadings. If you don't set these headings, the incomplete code is never executed. –  Werner Feb 25 '12 at 15:23
add comment

1 Answer 1

Remove the percent sign % in the second fill line. Here's a compilable version:

\documentclass{scrbook}
\usepackage{scrpage2}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{calc}
\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)$);
   \end{tikzpicture}
}
% set page style
\cehead[\pageframe]{\pageframe}
\cohead[\pageframe]{\pageframe}
\pagestyle{scrheadings}

\begin{document}
\tableofcontents
\addchap{Introduction}
\newpage
\chapter{First chapter}
\chapter{Second chapter}
\end{document}

page with frame

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.