Difference between revisions of "Thumb index"

From Wiki
Jump to navigation Jump to search
m (spam)
Line 52: Line 52:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 
Bertrand Russell was giving a lesson on solipsism to a lay audience, and a woman got up and said she was delighted to hear Bertrand Russell say he was a solipsist; she was one too, and she wished there were more of us.
 
[http://online-poker-online-poker.net/ online poker]
 

Revision as of 14:02, 17 May 2005

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

% 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