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 %%% code related to this issue \rest@linewidth=\dimexpr% \ifdoublesided% if singlesided restlinewidth = oddpos - xpos \ifodd\pageno% if doublesided \oddpos@warichu% and if odd restlinewidth = oddpos - xpos \else\evenpos@warichu\fi% and if even restlinewidth = evenpos - xpos \else\oddpos@warichu \fi% -\MPx\xpos@warichu\relax% %%% %%%% main code \unprotect \installnamespace {warichu} \installsimplecommandhandler \????warichu {warichu} \????warichu \setupwarichu[style=\ssxx, voffset=-1.5pt, distance=\hskip1pt\relax, left={},right={}, reference=,] \newcount\cnt@warichu \newdimen\rest@linewidth \newdimen\oddpos@warichu \newdimen\evenpos@warichu \oddpos@warichu =\dimexpr\backspace+\textwidth\relax \evenpos@warichu=\dimexpr\paperwidth-\cutspace\relax \def\get@split@box#1{% \setbox\scratchboxone\hbox{% \hsplit\scratchbox % to #1% shrinkcriterium 10000% \par\allowbreak}% \box\scratchboxone} \def\warichu{\dosingleempty\warichu@indeed} \def\warichu@indeed[#1]#2{\begingroup% \global\advance\cnt@warichu by 1\relax% \iffirstargument\setupwarichu[#1]\fi% \warichuparameter{distance}% \warichuparameter{left}% \pagereference[warichu:\number\cnt@warichu]% may be useful \textreference[\warichuparameter{reference}]{\warichuparameter{reference}}% \xypos{warichu:\number\cnt@warichu}% \edef\xpos@warichu{warichu:\number\cnt@warichu}% \rest@linewidth=\dimexpr% \ifdoublesided% if singlesided restlinewidth = oddpos - xpos \ifodd\pageno% if doublesided \oddpos@warichu% and if odd restlinewidth = oddpos - xpos \else\evenpos@warichu\fi% and if even restlinewidth = evenpos - xpos \else\oddpos@warichu \fi% -\MPx\xpos@warichu\relax% \setbox\scratchbox\hbox{\usewarichustyleandcolor\c!style\c!color #2\relax}% \raise\warichuparameter{voffset}\relax% \vbox{\offinterlineskip% \get@split@box{\the\rest@linewidth}% \get@split@box{\the\rest@linewidth}}\allowbreak% \doloop{% \ifdim\wd\scratchbox>\dimexpr\textwidth*2\relax% \raise\warichuparameter{voffset}% \vbox{\offinterlineskip% \get@split@box{\the\textwidth}% \get@split@box{\the\textwidth}}\allowbreak% \else% \raise\warichuparameter{voffset}% \vbox{\offinterlineskip% \get@split@box{\dimexpr\wd\scratchbox/2+1pt\relax}% \get@split@box{\dimexpr\wd\scratchbox+1pt\relax}}\allowbreak% \exitloop% \fi}% \warichuparameter{right}% \warichuparameter{distance}\endgroup} \protect \starttext \section{} \input darwin \warichu[reference=warichu:44]{\input darwin \input knuth } \input knuthmath \warichu{\input knuth } \input knuth \stoptext %%%%