![ConTeXt MarkIV:图层中的页码不起作用](https://linux22.com/image/255112/ConTeXt%20MarkIV%EF%BC%9A%E5%9B%BE%E5%B1%82%E4%B8%AD%E7%9A%84%E9%A1%B5%E7%A0%81%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我想将页码和导航放入一个层中,但页码计数器不起作用。这是一个最小示例:
\usemodule[graph]
\usesymbols[nav]
\setupsymbolset[navigation 1]
\setupinteraction[page=yes]
\setuppapersize[letter][letter]
\setuplayout[backspace=0.38\makeupwidth,leftmargin=0.3\makeupwidth,rightmargin=0pt,header=4em,footer=4em,top=0em,topspace=1em,topdistance=0em,bottom=0em,bottomspace=1em,bottomdistance=0em,width=34em,height=64em]
\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
但是页码计数器不起作用:所有页面的页码都为 1。我做错了吗?非常感谢!
答案1
问题和解决方案描述如下ConTeXt wiki - 图层。
图层内容设置后即固定,并会以相同的方式显示在每一页上。[…] 要重新计算每一页的内容,您必须将设置
\setlayer
包含在\startsetups ... \stopsetups
以下是一个例子:
\definelayer
[navegacion]
\startsetups [navegacion]
\setlayer
[navegacion]
{\framed[offset=1cm]{\pagenumber}}
\stopsetups
\setupbackgrounds
[page]
[background=navegacion, setups=navegacion]
\starttext
\dorecurse
{10}
{\input knuth \page}
\stoptext