# [NTG-context] How to implement a changing navigation bar?

Hans Hagen pragma at wxs.nl
Mon Aug 16 23:33:54 CEST 2004

```Stefan Wachter wrote:

> Hi all,
>
> I use an overlay to implement a navigation bar in the left margin of a
> document. It seems to me that the processing of the overlay is done
> only once and not for every page again. In addition, the \lastpage is
> not available.

page, paper and text backgrounda are calculated each page, unless you
say \setupbackgrounds[state=repeat], in which case all are recalculated;
if you put something in a layer it happens directly (but the layer may
be flushed later)

> Does anyone know a solution? Maybe headers/footers are a solution. But
> how is absolute positioning accomplished with them?
>
you can put a layer in the background of the header area and that do
something:

\startsetups whatever

\setlayer[thatlayer][....positioning...]{\the\pageno}

\stopsetups

> PS: Here is my current implementation:
>
> \definelayer[navbar]
> \setupbackgrounds[text][leftmargin][background=navbar]
> \setlayer[navbar][x=0cm,y=10cm]{\the\pageno}

lastpage etc only make sense in the output routine (during page building) since one does not know where tex will break the page.

H

-----------------------------------------------------------------