diff options
Diffstat (limited to 'tex/context/base/core-lnt.tex')
-rw-r--r-- | tex/context/base/core-lnt.tex | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/tex/context/base/core-lnt.tex b/tex/context/base/core-lnt.tex new file mode 100644 index 000000000..b1082bd01 --- /dev/null +++ b/tex/context/base/core-lnt.tex @@ -0,0 +1,236 @@ +%D \module +%D [ file=core-lnt, +%D version=2002.05.10, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Line Notes, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%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 Core Macros / Line Notes} + +%D This module loads on top of the footnote and line numbering macros. + +\unprotect + +\newcounter\linenotecounter +\newtoks \collectedlinenotes +\newif \iftracelinenotes + +\appendtoks + \the\collectedlinenotes +\to \everylinenumber + +\appendtoks + \global\collectedlinenotes\emptytoks +\to \beforeeverylinenumbering + +% \def\handlelinenote#1#2% +% {\bgroup +% \expanded{\beforesplitstring#1}\at--\to\linenotelinenumber +% \ifnum\linenotelinenumber=\linenumber\relax +% % todo: \onlyfootnote{#1}{#2}% == configurable +% \setupfootnotes[\c!nummercommando=\gobbleoneargument]% +% \footnotetext{#1: #2}% +% \fi +% \egroup} + +\def\dohandlelinenote#1#2#3% + {\bgroup + \expanded{\beforesplitstring#2}\at--\to\linenotelinenumber + \ifnum\linenotelinenumber=\linenumber\relax + % todo: \onlyfootnote{#2}{#3}% == configurable + \setupnote[#1][\c!nummercommando=\gobbleoneargument]% + \setnotetext[#1]{#2: #3}% + \fi + \egroup} + +% \def\tracedlinenote#1% +% {\iftracelinenotes +% \hbox to \zeropoint +% {\forgetall +% \localcolortrue +% \hsize\zeropoint +% \hss +% \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% +% {\blue\vl}% +% \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% +% \hss}% +% \prewordbreak +% \fi} + +\def\dotracedlinenote#1% + {\iftracelinenotes + \hbox to \zeropoint + {\forgetall + \localcolortrue + \hsize\zeropoint + \hss + \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% + {\blue\vl}% + \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% + \hss}% + \prewordbreak + \fi} + +% \def\linenote#1% +% {\doglobal\increment\linenotecounter +% \doifreferencefoundelse{\??rr:\linenotecounter}% +% {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA +% {\currenttextreference}{#1}\to\collectedlinenotes} +% \donothing +% \tracedlinenote\empty +% \expanded{\eenregel[\??rr:\linenotecounter]}} + +\def\dolinenote#1#2% + {\doglobal\increment\linenotecounter + \doifreferencefoundelse{\??rr:\linenotecounter}% + {\expanded{\doglobal\noexpand\appendtoks\noexpand\dohandlelinenote + {#1}{\currenttextreference}}{#2}\to\collectedlinenotes} + \donothing + \dotracedlinenote\empty + \expanded{\eenregel[\??rr:\linenotecounter]}} + +% \def\startlinenote[#1]#2% +% {\doifreferencefoundelse{\??rr:#1}% +% {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA +% {\currenttextreference}{#2}\to\collectedlinenotes} +% \donothing +% \tracedlinenote{#1}% +% \startregel[\??rr:#1]} + +\def\dostartlinenote#1[#2]#3% + {\doifreferencefoundelse{\??rr:#2}% + {\expanded{\doglobal\noexpand\appendtoks\noexpand\dohandlelinenote + {#1}{\currenttextreference}}{#3}\to\collectedlinenotes} + \donothing + \dotracedlinenote{#2}% + \startregel[\??rr:#2]} + +% \def\stoplinenote[#1]% +% {\stopregel[\??rr:#1]} + +\def\dostoplinenote#1[#2]% + {\stopregel[\??rr:#2]} + +% defining them + +\def\definelinenote + {\dodoubleempty\dodefinelinenote} + +\def\dodefinelinenote[#1][#2]% + {\definenote[#1][#2]% + \setvalue {#1}{\dolinenote {#1}}% + \setvalue{\e!start#1}{\dostartlinenote{#1}}% + \setvalue{\e!stop #1}{\dostoplinenote {#1}}} + +\def\setuplinenote % convenient + {\setupnote} + +% We predefine one, namely \type {\linenote} cum suis. + +\definelinenote[\v!linenote] + +% \startbuffer[test] +% \startlinenumbering[100] +% test \linenote {oeps} test test test test test test +% test \startlinenote [well] {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} 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=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=1em, +% align=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=2em, +% distance=.5em, +% align=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=2em, +% 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] \startnarrower\getbuffer[setup,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
\ No newline at end of file |