# Vertical sidebars

I'm trying to layout a text book where each page in a given chapter has a thin coloured sidebar that starts at the top of the page and is some fixed length long. Each chapter will have a differently coloured sidebar of differing lengths. For example, chapter 1 might have a green sidebar of length 5cm, chapter 2, red of length 3cm and so on. The sidebars will in an ideal world be in addition to any margin notes. Would appreciate any help anyone could give with this. The best option I can see at the moment is to use tikz, but maybe there's a simpler solution.

-

One option would be to use the background package (http://www.ctan.org/pkg/background); in the following example, all you have to do for each chapter is to set the color and length of the vertical bar (through the \VerBar command) and then redefine \SetBgContents:

\documentclass[a4paper,openany]{book}
\usepackage{background}
\usepackage{lipsum}

\newcommand*\VerBar[2]{%
{\color{#1}\rule{#2}{3pt}}
}

\SetBgPosition{-1,0}
\SetBgAngle{90}
\SetBgScale{1}
\SetBgOpacity{1}
\SetBgContents{\VerBar{red}{5cm}}

\begin{document}
\chapter{Test chapter one}
\lipsum[1-30]\clearpage

\SetBgContents{\VerBar{blue}{7cm}}
\chapter{Test chapter one}
\lipsum[1-30]

\end{document}

-
 Brilliant ! many thanks and very much appreciated :) – manwyddan Mar 10 '11 at 8:10