summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/rules/rules-mkiv.tex
diff options
context:
space:
mode:
Diffstat (limited to 'doc/context/sources/general/manuals/rules/rules-mkiv.tex')
-rw-r--r--doc/context/sources/general/manuals/rules/rules-mkiv.tex232
1 files changed, 210 insertions, 22 deletions
diff --git a/doc/context/sources/general/manuals/rules/rules-mkiv.tex b/doc/context/sources/general/manuals/rules/rules-mkiv.tex
index 00ab49c25..e1d8acfaa 100644
--- a/doc/context/sources/general/manuals/rules/rules-mkiv.tex
+++ b/doc/context/sources/general/manuals/rules/rules-mkiv.tex
@@ -257,8 +257,10 @@ A running box is seen as text. As you (probably) expect, a nested ornamental
rule is supported as well:
\startbuffer
-\underbars{We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.}
-\underbar {We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.}
+\underbars
+ {We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.}
+\underbar
+ {We see this \high{\tfxx\underdot{®}} symbol \runninghbox to 1cm{\hss} often.}
\stopbuffer
\typebuffer
@@ -269,6 +271,30 @@ This time we get (you might need a magnifier to see it):
\getbuffer
\stoplines
+We end this section with an extreme example:
+
+\startbuffer
+\definebar
+ [xbarone]
+ [text=\lower\exheight\hbox{\darkred \infofont +},
+ repeat=yes]
+\definebar
+ [xbartwo]
+ [text=\lower\exheight\hbox{\darkblue\infofont +},
+ repeat=yes,
+ continue=yes]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+Klein : \xbarone{\samplefile {klein}\removeunwantedspaces}\par
+Sapolsky : \xbartwo{\samplefile{sapolsky}\removeunwantedspaces}\par
+\stopbuffer
+
+\typebuffer \getbuffer
+
+
\stopsubject
\startsubject[title=Shifting]
@@ -307,7 +333,7 @@ or: \inlinebuffer\ Here we just shift words but you can shift more than that
although I haven't yet seen a useful example of that:
\startbuffer
-We can \shiftup {\input{tufte}} whole paragraphs if we really want.
+We can \shiftup {\samplefile{tufte}} whole paragraphs if we really want.
\stopbuffer
\typebuffer
@@ -352,7 +378,7 @@ an educational feature.
color=darkred]
\startlinefiller[filler-1]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopbuffer
@@ -366,7 +392,7 @@ paragraph.
\startbuffer
\startalign[flushleft,broad]
\startlinefiller[filler-1]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopalign
\stopbuffer
@@ -386,7 +412,7 @@ a \type {middle} alignment:
\startbuffer
\startalign[middle]
\startlinefiller[filler-1]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopalign
\stopbuffer
@@ -397,7 +423,7 @@ a \type {middle} alignment:
\startalign[middle]
\startnarrower
\startlinefiller[filler-1]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopalign
@@ -418,7 +444,7 @@ to the margins if you like:
\startalign[middle]
\startnarrower
\startlinefiller[filler-1][scope=global]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopalign
@@ -436,7 +462,7 @@ You can also use a \type {left} or \type {right} scope, as in:
\startalign[middle]
\startnarrower
\startlinefiller[filler-1][scope=right]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopalign
@@ -452,7 +478,7 @@ Only the right rules extend into the margins.
\startalign[middle]
\startnarrower
\startlinefiller[filler-1][scope=right,location=right]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopalign
@@ -498,7 +524,7 @@ The previous example now looks like:
\startalign[middle,r2l]
\startnarrower[4*middle]
\startlinefiller[filler-1] [scope=global]
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopalign
@@ -534,7 +560,7 @@ use a latin script example for convenience.
% \startlinefiller[filler-1] [scope=global,align=middle]
% \parindent 100pt
% \parfillskip 100pt
-% \input ward
+% \samplefile{ward}
% \stoplinefiller
% \stopnarrower
% \stopbuffer
@@ -544,7 +570,7 @@ use a latin script example for convenience.
\startlinefiller[filler-1] [scope=global,align={middle,r2l}]
\parindent 100pt
\parfillskip 100pt
- \input ward
+ \samplefile{ward}
\stoplinefiller
\stopnarrower
\stopbuffer
@@ -623,9 +649,11 @@ primitive here, so we follow the \TEX\ conventions of keywords.
\startbuffer
\ruledhbox\bgroup
- \darkgray \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt type fill\relax
+ \darkgray
+ \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt type fill\relax
\hskip-100mm
- \darkred \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt\relax
+ \darkred
+ \frule width 100mm height 10mm depth 8mm radius 2mm line 2pt\relax
\hskip-100mm
\hbox to 100mm{\white \bold \hfill some handy word with frames\hfill}%
\egroup
@@ -784,11 +812,11 @@ command:
\stoptyping
\startbuffer
-\input ward \hiddenbar {\color[red]{invisible}}
-\input ward \hiddenbar {\quad\color[red]{invisible}\quad}
-\input ward \hiddenbar{\quad\quad\quad\color[red]{invisible}\quad\quad\quad}
-\input ward \hiddenbar {\color[red]{invisible}\quad\quad\quad\quad\quad\quad}
-\input ward
+\samplefile{ward}\hiddenbar {\color[red]{invisible}}
+\samplefile{ward}\hiddenbar {\quad\color[red]{invisible}\quad}
+\samplefile{ward}\hiddenbar{\quad\quad\quad\color[red]{invisible}\quad\quad\quad}
+\samplefile{ward}\hiddenbar {\color[red]{invisible}\quad\quad\quad\quad\quad\quad}
+\samplefile{ward}
\stopbuffer
\getbuffer
@@ -807,8 +835,8 @@ the spacing is kept at a linebreak:
[left={\quads[3]},
right={\quads[3]}]
-\widehiddenbar{invisible} \input weisman
-\widehiddenbar{invisible} \input weisman
+\widehiddenbar{invisible} \samplefile{weisman}
+\widehiddenbar{invisible} \samplefile{weisman}
\widehiddenbar{invisible}
\stopbuffer
@@ -818,4 +846,164 @@ the spacing is kept at a linebreak:
\stopsubject
+\startsubject[title=Tabulate]
+
+The previously discussed mechanism is also available in the tabulate mechanism.
+We start with simple backgrounds:
+
+\startbuffer
+\starttabulate
+ \NL[darkred] foo \NC bar \NC \NR
+ \NL[darkgreen] foo \NC bar \NC \NR
+ \NL[darkblue] foo \NC \samplefile{tufte} \NC \NR
+ \NL[darkgray] foo \NC bar \NC \NR
+ \NL[darkyellow] foo \NC bar \NC \NR
+ \LL
+\stoptabulate
+\stopbuffer
+
+\typebuffer
+
+This comes out as:
+
+{\startcolor[white]\getbuffer\stopcolor}
+
+There are several two character commands that deal with this:
+
+\starttabulate[|c|c|l|]
+\BC command \BC related to \BC effect \NC
+\NC \type{\NL} \NC \type{\NC} \NC Normal with Line \NC \NR
+\NC \type{\ND} \NC \type{\NC} \NC Normal with Default Line \NC \NR
+\NC \type{\LB} \NC \type{\BC} \NC Bold with Line \NC \NR
+\NC \type{\DB} \NC \type{\BC} \NC Bold with Default Line \NC \NR
+\NC \type{\NF} \NC \type{\NC} \NC Normal with Filler \NC \NR
+\NC \type{\NP} \NC \type{\NC} \NC Normal with Predefined Filler \NC \NR
+\NC \type{\FB} \NC \type{\BC} \NC Bold with Filler \NC \NR
+\NC \type{\NA} \NC \type{\NC} \NC Normal with Auto Toggled Line \NC \NR
+\NC \type{\BA} \NC \type{\BC} \NC Bold with Auto Toggled Line \NC \NR
+\stoptabulate
+
+Before we show more, we set up tabulate:
+
+\startbuffer[setup]
+\setuptabulate
+ [blank={small,samepage},
+ headstyle=bold,
+ rulecolor=darkred,
+ rulethickness=1pt,
+ background=foo,
+ backgroundcolor=darkred,
+ foregroundcolor=white]
+\stopbuffer
+
+\typebuffer[setup]
+
+This time we don't set colors in the table itself:
+
+\startbuffer
+\starttabulate[|l|l|]
+ \DB foos \BC bars \BC \NR
+ \TB
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \LL
+\stoptabulate
+\stopbuffer
+
+\typebuffer {\getbuffer[setup]\getbuffer}
+
+Instead of coming up with a separate mechanism for hooking in \METAPOST\ we
+use the linefiller mechanism. We use these graphics:
+
+\startbuffer
+\startuseMPgraphic{foo}
+ fill unitsquare
+ xyscaled (RuleWidth,RuleHeight+RuleDepth) enlarged (ExHeight/4,ExHeight/8)
+ shifted (-ExHeight/8,ExHeight/16)
+ withcolor RuleColor ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{bar}
+ fill unitsquare
+ xyscaled (RuleWidth,RuleHeight+RuleDepth) enlarged (ExHeight/4,ExHeight/8)
+ shifted (-ExHeight/8,ExHeight/16)
+ randomized ExHeight
+ withcolor RuleColor ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+With these fillers:
+
+\startbuffer
+\definelinefiller[foo][mp=foo,color=darkgreen]
+\definelinefiller[bar][mp=bar,color=darkred]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+An example of usage is:
+
+\startbuffer
+\linefillerhbox[foo] to 12cm{\hss\strut\white\bf FOO\hss} \blank
+\linefillerhbox[bar] to 10cm{\hss\strut\white\bf BAR\hss} \blank
+\linefillerhbox[foo] to 9cm{\hss\strut\white\bf FOO\hss} \blank
+\linefillerhbox[bar] to 14cm{\hss\strut\white\bf BAR\hss}
+\stopbuffer
+
+\typebuffer \blank \getbuffer \blank
+
+We can rely on the default:
+
+\startbuffer
+\starttabulate[|||]
+ \PB foo \BC bars \BC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+\stoptabulate
+\stopbuffer
+
+\typebuffer \start\getbuffer[setup]\getbuffer\stop
+
+or be explicit:
+
+\startbuffer
+\starttabulate[|||]
+ \FB[bar] foos \BC bars \BC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+ \NC foo foo foo \NC bar bar bar bar \NC \NR
+\stoptabulate
+\stopbuffer
+
+\typebuffer \start\getbuffer[setup]\getbuffer\stop
+
+The auto variants will switch between colors:
+
+\startbuffer
+\setuptabulate[backgroundcolor:1=darkred]
+\setuptabulate[backgroundcolor:2=darkgreen]
+\setuptabulate[backgroundcolor:3=darkblue]
+
+\starttabulate[|||]
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+ \BA foo foo foo \BC bar bar bar bar \NC \NR
+\stoptabulate
+\stopbuffer
+
+\typebuffer \start\getbuffer[setup]\getbuffer\stop
+
+
+\stopsubject
+
\stopdocument