%D \module %D [ file=strc-lnt, %D version=2002.05.10, %D title=\CONTEXT\ Structure Macros, %D subtitle=Line Notes, %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. \writestatus{loading}{ConTeXt Structure Macros / Line Notes} %D This module loads on top of the footnote and line numbering macros. \unprotect \installcorenamespace{linenote} \let\setuplinenote\setupnote \newcount\c_strc_linenotes \unexpanded\def\definelinenote {\dotripleempty\strc_linenotes_define} \def\strc_linenotes_define[#1][#2][#3]% {\definenote[#1][#2][#3]% \expandafter\let\csname\??linenote#1\expandafter\endcsname\csname#1\endcsname % use copy command \setuevalue {#1}{\strc_linenotes_direct{#1}}% \setuevalue{\e!start#1}{\strc_linenotes_start {#1}}% \setuevalue{\e!stop #1}{\strc_linenotes_stop }} \unexpanded\def\strc_linenotes_direct#1#2% {\global\advance\c_strc_linenotes\plusone \strc_linenotes_indeed{#1}{\the\c_strc_linenotes}{#2}% \strc_linenotes_traced\empty \normalexpanded{\someline[\the\c_strc_linenotes]}} \unexpanded\def\strc_linenotes_start#1[#2]#3% {\global\advance\c_strc_linenotes\plusone \strc_linenotes_indeed{#1}{#2}{#3}% \strc_linenotes_traced{#2}% \startline[#2]} \unexpanded\def\strc_linenotes_stop[#1]% {\stopline[#1]} \unexpanded\def\strc_linenotes_indeed#1#2#3% will be redone {\begingroup % we keep things local so we can use it as regular note too \unexpanded\def\linenotelinenumber##1{\inlinerange[#2]}% ##1 == order % \setupnotation[#1][\c!numbercommand=\linenotelinenumber]% todo: deep hook % \setupnote[#1][\c!textcommand=\gobbleoneargument]% todo: deep hook \edef\currentnotation{#1}% \let\currentnote\currentnotation \letnotationparameter\c!numbercommand\linenotelinenumber% todo: deep hook \letnoteparameter \c!textcommand \gobbleoneargument % todo: deep hook \relax\getvalue{\??linenote#1}{#3}% \endgroup} \let\strc_linenotes_traced\gobbleoneargument \def\strc_linenotes_traced_indeed#1% {\iftracelinenotes \hbox to \zeropoint {\forgetall \hsize\zeropoint \hss \vbox to \strutheight{\llap{\red\infofont\setstrut\the\c_strc_linenotes}\vss}% {\color[blue]{\vl}}% \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% \hss}% \prewordbreak \fi} \unexpanded\def\tracelinenotes {\let\strc_linenotes_traced\strc_linenotes_traced_indeed} % We predefine one, namely \type {\linenote} cum suis. % \definelinenote[\v!linenote] % beware: line numbers are added later on so grouping setups is a bad idea % % \startbuffer[test] % \startlinenumbering[100] % test \linenote {oeps 1} test test test test test test % test \startlinenote [well] {oeps X} test test test test test test % test \linenote {oeps 2} test test test test test test % test \linenote {oeps 3} test test test test test test % test \linenote {oeps 4} test test test test test test % test \linenote {oeps 5} test test test test test test % test \stoplinenote [well] test test test test test test % \stoplinenumbering % \stopbuffer % % \typebuffer[test] \getbuffer[test] \page % % \startbuffer[setup] % \setuplinenumbering % [align=flushleft] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering % [width=4em, % distance=1em, % align=flushright] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering % [width=4em, % align=flushleft] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering % [width=2em, % distance=.5em, % align=middle] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup] % \setuplinenumbering % [conversion=romannumerals, % start=1, % step=1, % location=text, % style=slanted, % color=blue, % width=1.5em] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup] \startnarrower\getbuffer[test]\stopnarrower \page % % \startbuffer[setup] % \setuplinenumbering % [width=4em, % left=--, % right=--, % align=middle] % \stopbuffer % % \typebuffer[setup] \getbuffer[setup,test] \page % % \startbuffer[setup-1] % \setuplinenumbering % [style=\bfxx, % command=\WatchThis] % \stopbuffer % % \startbuffer[setup-2] % \def\WatchThis#1% % {\ifodd\linenumber % \definecolor[linecolor][red]% % \else % \definecolor[linecolor][green]% % \fi % \inframed % [offset=1pt,frame=off,background=color,backgroundcolor=linecolor] % {#1}} % \stopbuffer % % \typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test] \page % % \startbuffer[setup-1] % \setuplinenumbering % [location=inright, % style=\bfxx, % command=\WatchThis] % \stopbuffer % % \typebuffer[setup-1] \getbuffer[setup-1,setup-2,test] \page \protect \endinput