diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-02-08 21:04:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-02-08 21:04:00 +0100 |
commit | c5de3b109d06dbee374f754a7c86d7aac2c4ec3f (patch) | |
tree | f931e06e45076cd7f0c8c6232ff593fa8f464d54 /tex/context/base/strc-lnt.mkvi | |
parent | 586e8f786598e3f3447e3dbe3589a54c9e6bb696 (diff) | |
download | context-c5de3b109d06dbee374f754a7c86d7aac2c4ec3f.tar.gz |
beta 2012.02.08 21:04
Diffstat (limited to 'tex/context/base/strc-lnt.mkvi')
-rw-r--r-- | tex/context/base/strc-lnt.mkvi | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/tex/context/base/strc-lnt.mkvi b/tex/context/base/strc-lnt.mkvi new file mode 100644 index 000000000..dbb1dcc8b --- /dev/null +++ b/tex/context/base/strc-lnt.mkvi @@ -0,0 +1,175 @@ +%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 + +\newcount\noflinenotes \newif\iftracelinenotes % will be tracker + +\def\dohandlelinenote#1#2#3% + {\bgroup + \def\linenotelinenumber##1{\inlinerange[#2]}% ##1 == order + \setupnote[#1][\c!numbercommand=\linenotelinenumber,\c!textcommand=\gobbleoneargument]% todo: deep hook + \getvalue{\??vn:ln:#1}{#3}% + \egroup} + +\def\dotracedlinenote#1% + {\iftracelinenotes + \hbox to \zeropoint + {\forgetall + \hsize\zeropoint + \hss + \vbox to \strutheight{\llap{\red\infofont\setstrut\the\noflinenotes}\vss}% + {\color[blue]{\vl}}% + \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% + \hss}% + \prewordbreak + \fi} + +\def\dolinenote#1#2% + {\global\advance\noflinenotes\plusone + \dohandlelinenote{#1}{\the\noflinenotes}{#2}% + \dotracedlinenote\empty + \normalexpanded{\someline[\the\noflinenotes]}} + +\def\dostartlinenote#1[#2]#3% + {\global\advance\noflinenotes\plusone + \dohandlelinenote{#1}{#2}{#3}% + \dotracedlinenote{#2}% + \startline[#2]} + +\def\dostoplinenote#1[#2]% + {\stopline[#2]} + +\unexpanded\def\definelinenote + {\dotripleempty\dodefinelinenote} + +\def\dodefinelinenote[#1][#2][#3]% +% {\dodefinenote[#1][#2][#3]% do as we need to test for arguments + {\definenote[#1][#2][#3]% + \expandafter\let\csname\??vn:ln:#1\expandafter\endcsname\csname#1\endcsname % use copy command + \setuvalue {#1}{\dolinenote {#1}}% + \setuvalue{\e!start#1}{\dostartlinenote{#1}}% + \setuvalue{\e!stop #1}{\dostoplinenote {#1}}} + +\let\setuplinenote\setupnote + +% 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 |