Changes

Jump to navigation Jump to search
1,575 bytes added ,  19:55, 18 March 2006
m
Reverted edit of !!!!!!!!!!!!FIXER!!!!!!!!!!!!!!!!!!!!!, changed back to last version by !!!!!!!!!!!!TROLL!!!!!!!!!!!!!!!!!!!!!
The following code is an example of how to draw a graphic on every page of a document. The graphic (a grey rectangle) appears in a different place for each chapter, and the chapter number appears in the rectangle as well. This is often called a thumb index - your thumb can flip the pages of a book while you watch the contents flash past...

<texcode>
% by Hans Hagen, of course :-)

\unprotected \def\rawsectionnumber#1{\countervalue{\??se#1}} % will be in kernel

\setuppagenumbering
[alternative=doublesided]

\setupcolors
[state=start]

\setupbackgrounds
[page]
[background=thumbs]

\defineoverlay
[thumbs]
[\setups{thumbs}]

\def\NOfChapters{4} % i need to make this one available

\startsetups thumbs

\definemeasure[thumbheight][\dimexpr\paperheight/\NOfChapters\relax]

\vbox to \paperheight \bgroup
\vskip \rawsectionnumber{section-2} \measure{thumbheight}
\vskip -1 \measure{thumbheight}
\doifoddpageelse\hfill\donothing
\framed
[background=color,
backgroundcolor=darkgray,
frame=off,
foregroundcolor=white,
height=\measure{thumbheight},width=1cm]
{\bfa \rawsectionnumber{section-2}}
\doifoddpageelse\donothing\hfill
\vss
\egroup

\stopsetups

\starttext

\chapter{first} \dorecurse{10}{\input tufte }
\chapter{second} \dorecurse{10}{\input davis }
\chapter{third} \dorecurse{10}{\input zapf }
\chapter{fourth} \dorecurse{10}{\input bryson }

\stoptext
</texcode>

Navigation menu