[Tex/LaTex] Page border coloured

colormargins

How to create a coloured page border for a document using KOMA-Script scrbook class?

Something like this:

enter image description here

(image taken from the memoir tutorial)

Best Answer

You could use TikZ

This example can give an idea how to use it:

\documentclass[english]{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel,blindtext}

\usepackage{scrpage2}
\usepackage{tikz}
\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)$);
        \node [fill=green, text width=1.5cm, align=center] 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}

\begin{document}
\Blinddocument
\end{document}

When using different definitions of \cehead and \lefoot (or other heading-commads) you can define different borders for left and right pages. You can even “draw” the pagemark with the TikZ way.

Note that TikZ needs two latex-runs to get the right positions.

See PGF Manual, section 16.13.2 Referencing the Current Page Node – Absolute Positioning and the KOMA-Script Manual about using scrpage2.

Related Question