# ConTeXt MarkIV: Pagenumber in layer not working

I want to put pagenumber and navigation into a layer, but the counter for pagenumber is not working. Here's a minimal example:

``````\usemodule[graph]
\usesymbols[nav]
\setupinteraction[page=yes]

\setuppapersize[letter][letter]

\startreusableMPgraphic{navegacionfondo}
path p,q ;
p := (0,0) -- (60mm,0) .. (65mm,5mm) .. (60mm,10mm) -- (0,10mm) ;
q := (0,1mm) -- (59mm,1mm) .. (64mm,5mm) .. (59mm,9mm) -- (0,9mm) ;
fill p--cycle withcolor red ;
draw q withcolor white withpen pencircle scaled .5pt dashed evenly ;
\stopreusableMPgraphic

\setupbuttons[state=start,frame=off]

\defineoverlay[fondonav][{\reuseMPgraphic{navegacionfondo}}]

\definelayer[navegacion][x=0mm,y=8mm,width=65mm,height=10mm,state=repeat]
\setlayer[navegacion][hoffset=30mm]{\framed[background=fondonav,frame=off]{\button{\color[white]{\symbol[previouspage]}}[PreviousPage]\hskip.5em\pagenumber\button{\color[white]{\hskip0.5em\symbol[nextpage]}}[NextPage]}}
\setupbackgrounds[page][background=navegacion]

\starttext
\dorecurse{10}{\input knuth \page}
\stoptext
``````

But pagenumber counter is not working: all pages are numbered as 1. Am I doing something wrong? Thank you so much!

-
Advice for further posts: You should create a minimal example. That means to remove any code that is not directly related to your problem. You could haved removed e.g. the modules, symbols, buttons, interaction and the entire MetaPost code. A simple `\pagenumber` within a `\setlayer` already demonstrates the problem. The entire example could have been compressed to six lines. –  Marco Sep 7 '12 at 7:27

The problem and the solution is described in ConTeXt wiki - Layers.

The content of layer is fixed after your set it and will appear in the same way on each page. […] To recalculate the content on each new page you have to enclose the `\setlayer` settings within `\startsetups ... \stopsetups`

Here is an example:

``````\definelayer
[navegacion]

\startsetups [navegacion]
\setlayer
[navegacion]
{\framed[offset=1cm]{\pagenumber}}
\stopsetups

\setupbackgrounds
[page]
[background=navegacion, setups=navegacion]

\starttext
\dorecurse
{10}
{\input knuth \page}
\stoptext
``````
-
Thank you so much, I don't know how I didn't saw that. –  acidrums4 Sep 7 '12 at 13:08