%D \module %D [ file=page-com, % moved from page-imp %D version=1998.01.15, %D title=\CONTEXT\ Page Macros, %D subtitle=Page Comments, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %D This will become runtime loaded code. \writestatus{loading}{ConTeXt Page Macros / Page Comments} \unprotect %D \macros %D {setuppagecomment,startpagecomment} %D %D This command is not yet documented. Usage: %D %D \starttyping %D \setuppagecomment[state=start,location=right] %D %D \startpagecomment %D \input knuth %D \stoppagecomment %D \stoptyping \unexpanded\def\setuppagecomment {\dosingleempty\dosetuppagecomment} \def\dosetuppagecomment[#1]% {\getparameters[\??pc][#1]% \doifelse\@@pcstate\v!start {\doifinsetelse\@@pclocation{\v!bottom,\v!top} {\setuppapersize[\c!left=\hskip\@@pcoffset]% \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcheight}% \edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset}% \defineoverlay[\v!pagecomment][\placepagecommentTB]} {\setuppapersize[\c!top=\vskip\@@pcoffset]% \edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset}% \edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcwidth}% \defineoverlay[\v!pagecomment][\placepagecommentLR]}% \processaction [\@@pclocation] [ \v!bottom=>{\setuplayout[\c!location=]\setuppapersize[\c!bottom=\vss,\c!top =\vskip\@@pcoffset]}, \v!top=>{\setuplayout[\c!location=]\setuppapersize[\c!top =\vss,\c!bottom=\vskip\@@pcoffset]}, \v!left=>{\setuplayout[\c!location=]\setuppapersize[\c!left =\hss,\c!right =\hskip\@@pcoffset]}, \v!right=>{\setuplayout[\c!location=]\setuppapersize[\c!right =\hss,\c!left =\hskip\@@pcoffset]}]% \definepapersize [\v!pagecomment] [\c!height=\@@pcpaperheight, \c!width=\@@pcpaperwidth]% \let\@@pcprintpapersize\printpapersize \setuppapersize[\papersize][\v!pagecomment]% \setupbackgrounds[\v!paper][\c!background=\v!pagecomment]}% todo append if already set {\doif\@@pcstate\v!stop % else initialization invokes backgrounds {% this should be tested first % \normalexpanded{\noexpand\setuppapersize[\papersize][\@@pcprintpapersize]}% \setupbackgrounds[\v!paper][\c!background=]}}} \def\@@pcprintpapersize{\printpapersize} \unexpanded\def\placepagecommentTB {\vbox to \printpaperheight {%\forgetall \hsize\printpaperwidth \vskip\@@pcoffset \doifelse\@@pclocation\v!bottom{\vskip\dimexpr\paperheight+\@@pcdistance\relax}\vss \hskip\@@pcoffset \vbox to \@@pcheight {%\forgetall \hsize\paperwidth \ifpagecomment \getbuffer[\v!pagecomment]% \global\pagecommentfalse \fi}% \hfill \doifelse\@@pclocation\v!bottom\vss{\vskip\dimexpr\paperheight+\@@pcdistance\relax}% \vskip\@@pcoffset}} \unexpanded\def\placepagecommentLR {\hbox to \printpaperwidth {\hskip\@@pcoffset \doifelse\@@pclocation\v!right{\hskip\paperwidth\hskip\@@pcdistance}\hss \vbox to \printpaperheight {%\forgetall \vskip\@@pcoffset \hsize\@@pcwidth \ifpagecomment \getbuffer[\v!pagecomment]% \global\pagecommentfalse \fi \vss}% \doifelse\@@pclocation\v!right\hss{\hskip\paperwidth\hskip\@@pcdistance}% \hskip\@@pcoffset}} \newif\ifpagecomment \setvalue{\e!start\v!pagecomment}% {\global\pagecommenttrue \grabbufferdatadirect\v!pagecomment{\e!start\v!pagecomment}{\e!stop\v!pagecomment}} \setuppagecomment [\c!state=, % \v!stop would invoke background calculation \c!location=\v!bottom, \c!offset=.5cm, \c!distance=.5cm, \c!height=5cm, \c!width=10cm] \protect \endinput