![](https://secure.gravatar.com/avatar/6af06dcf5f958fe4ec149408292d6acd.jpg?s=120&d=mm&r=g)
Hi everybody, Studying the details manual I thought to have found a way to print the chapter number on the margin. Each increase of the chapternumber would move the figure a predefined distance downwards. Now when using a \def{\dimexpr(\realpageno\rightmarginwidth)} my chapternumber moves down. Replacing the \realpageno with \currentheadnumber the chapternumber is not moving or only after a couple of pages ... Is there someone who could hint me how to approach this? Please refer to the attached sample file "bleedingchapternumber.tex" Thanks and regards Willi % pagenumbers in the margin at half makeupheight % % Context file % filename: bleedingchapternumber.tex % W. Egger % 12.04.2004 \setupoutput[pdftex] \usetypescript[palatino][texnansi] \setupbodyfont[palatino,rm,12pt] \setuppapersize[A4][A3,portrait] \setuplayout[location=middle] \setupcolors[state=start] \def\shifted{% \dimexpr(\realpageno\rightmarginwidth)} % \def\shifted{% % \dimexpr(\currentheadnumber\rightmarginwidth)} \setuppagenumbering[state=start,location={footer,marginedge}] \startreusableMPgraphic{Pagenumberbackground} path p; p := fullcircle scaled 50pt ; fill p withcolor blue; p := unitsquare xyscaled 50pt shifted (0,-25pt); fill p withcolor blue; setbounds currentpicture to boundingbox currentpicture leftenlarged 50pt ; % draw bbox currentpicture withcolor red ; \stopreusableMPgraphic \defineoverlay[Pagenumberbackground] [\useMPgraphic{Pagenumberbackground}] \definelayer [Pagenumber] [width=\rightmarginwidth, height=\makeupheight] \startsetups Pagenumber \setups[Pagenumber:Number] \setups[Pagenumber:Finish] \stopsetups \startsetups Pagenumber:Number \setlayerframed [Pagenumber] [x=1mm, y=\shifted, location={right,top}] [width=\dimexpr(\cutspace-\rightmargindistance), height=\dimexpr(\cutspace-\rightmargindistance), foregroundcolor=yellow, background=Pagenumberbackground, frame=on, offset=none] {\framed[frame=on, width=.8\rightmarginwidth, align={left,lohi}, offset=8pt] {\placeheadnumber[chapter]}}% \stopsetups \startsetups Pagenumber:Finish \framed [width=\rightmarginwidth, height=\makeupheight, background=Pagenumber, frame=off] {} \stopsetups \setuptexttexts[margin] [] [\setups{Pagenumber}] \starttext \showframe \chapter{This is chapter no \headnumber[chapter]} \chapter{This is chapter no \headnumber[chapter]} \chapter{This is chapter no \headnumber[chapter]} \chapter{This is chapter no \headnumber[chapter]} \chapter{This is chapter no \headnumber[chapter]} \stoptext