From 8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Sun, 23 Aug 2009 11:11:32 +0000 Subject: this is context 2009.08.19 17:10 git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/strc-lnt.mkii | 197 +++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 Master/texmf-dist/tex/context/base/strc-lnt.mkii (limited to 'Master/texmf-dist/tex/context/base/strc-lnt.mkii') diff --git a/Master/texmf-dist/tex/context/base/strc-lnt.mkii b/Master/texmf-dist/tex/context/base/strc-lnt.mkii new file mode 100644 index 00000000000..ef09842cd7a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/strc-lnt.mkii @@ -0,0 +1,197 @@ +%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 / 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 Structure 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\dohandlelinenote#1#2#3% + {\bgroup + \expanded{\beforesplitstring#2}\at--\to\linenotelinenumber + \ifnum\linenotelinenumber=\linenumber\relax + % todo: \onlyfootnote{#2}{#3}% == configurable + % \setupnote[#1][\c!numbercommand=\gobbleoneargument]% + % \setnotetext[#1]{\rawreference\s!fnt{\s!fnt:f:\number\internalnotereference}{}#2: #3}% + \def\linenotelinenumber##1{#2}% + \setupnote[#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]% + \setnote[#1]{#3}% + \fi + \egroup} + +\def\dotracedlinenote#1% + {\iftracelinenotes + \hbox to \zeropoint + {\forgetall + \localcolortrue + \hsize\zeropoint + \hss + \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% + {\color[blue]{\vl}}% + \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% + \hss}% + \prewordbreak + \fi} + +\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{\someline[\??rr:\linenotecounter]}} + +\def\dostartlinenote#1[#2]#3% + {\doifreferencefoundelse{\??rr:#2}% + {\expanded{\doglobal\noexpand\appendtoks\noexpand\dohandlelinenote + {#1}{\currenttextreference}}{#3}\to\collectedlinenotes} + \donothing + \dotracedlinenote{#2}% + \startline[\??rr:#2]} + +\def\dostoplinenote#1[#2]% + {\stopline[\??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 +% +% \setupnotedefinition[linenote] [location=serried,distance=.5em] +% +% {\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 -- cgit v1.2.3