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

share|improve this question
    
beamer also has those sidebars, how is beamer doing it, and is there a way of doing it the same way as beamer? –  white_gecko Nov 17 at 20:56

1 Answer 1

up vote 4 down vote accepted

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}
share|improve this answer
    
Brilliant ! many thanks and very much appreciated :) –  manwyddan Mar 10 '11 at 8:10

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.