我正在尝试这样做
\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}
但编译失败:
! Argument of \tikz@cc@parse@factor has an extra }.
我不明白;如果我注释掉最后一行,\pagestyle{scrheadings}
它会编译,但输出保持不变......
答案1
%
删除第二行填充中的百分号。以下是可编译版本:
\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}