Thank to all who answered my questions before. As the title suggests, how do I get the correct page numbers? For example, in the example below, the first line on the 2nd page, but the page number showed is 1, In the meantime, I tried using \definepagestate, but it didn't seem to work either. What I can think of is to use citations to get the correct page number. But it seems that what is obtained is not a pure number, and it cannot do the calculations. so ,how do I get the correct page numbers and do the calculations with it? thanks. %%%%%% start example \starttext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% try page state \definepagestate[test][delay=yes] \newcount\test \let\testfloatrealpage\realpageno \def\testsavedata {\setpagestate[test][\number\test]} \def\testloaddata % precedes save ! {\global\advance\test\plusone \xdef\testfloatrealpage{\pagestaterealpage{test}{\number\test}} \ifx\testfloatrealpage\empty \glet\testfloatrealpage\realpageno \fi} \testsavedata% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \dorecurse{10}{% \testloaddata% \input knuth \pagereference[XX:#1] {\ssd\color[red]{\the\pageno}}% on page 2 and show page 1 {\ssd\color[red]{\the\testfloatrealpage}}%on page 2 and show page 1 {\ssd\color[red]{\ref[page][XX:#1]}}% on page 2 and show page 2 } \stoptext % stop example Muyik