ai2472206...@yeah.net schrieb am 10.09.2024 um 06:05:
1. The usage of the command  "\definepagestate " is what I searched for in 
previous posts and source files.
I don't know exactly how he used it. (╥﹏╥)

2. I've devised a command that needs to get the current page number to 
determine if it's an odd or even page.
This is then used to get a certain width to determine the width of the command 
on that line.
Below I designed the command. The code related to this issue is mainly

You have to differentiate between odd and even and right hand and left hand pages.

When you want to check whether you have an right hand or left hand page you can use the following method. To get the correct result ensure you start a paragraph before you set the flag with \signalrightpage.

%%%% begin example
%\setuppagenumbering[alternative=doublesided]
%\setuppagenumbering[alternative={singlesided,doublesided}]

\starttext

\dorecurse{20}
  {\dontleavehmode\signalrightpage\doifelserightpage{\bold{Right page}}{\bold{Left page}}
   \samplefile{lorem}}

\stoptext
%%%% end example

To have a check which works for odd and even pages you have to use the pagestate mechanism. Even in this case it is important to start a paragraph before save the current state, afterwards
you can check the stored pagenumber.

%%%% begin example
\definepagestate[warichu]

\starttext

\dorecurse{20}
  {\dontleavehmode\autosetpagestate{warichu}%
   \ifodd0\autopagestaterealpage{warichu}%
     \bold{Odd page}
   \else
     \bold{Even page}
   \fi
   \samplefile{lorem}}

\stoptext
%%%% end example

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to