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.

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)

share|improve this question
    
Have a look on Page Bordering with an image?, which seems to be similar enough. –  Martin Scharrer May 14 '11 at 13:16
    
You could have e-mailed me or left a comment to ask how I did it - I wrote that blog post and that sample page! ^_^ Anyway @Toby gave the correct answer, and it's true that I wrote about the memoir way, the book way (using fancyhdr) but not the scrbook way. –  LianTze Lim May 16 '11 at 9:28
add comment

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
As mentioned in “Tikz rectangle hiding text!” theres a problem when using the foot to define the border so I changed the example. No it uses the center head instead of left foot to draw the frame (an everything else) behind the text body. This makes it even easier to draw the frame cause we can use two overlaying rectangles instead of four arbors which gives us the opportunity to make the inner rectangle with rounded corners. –  Tobi May 16 '11 at 9:05
    
+1 for \strut! –  LianTze Lim May 16 '11 at 9:32
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.