Hi,
I uploaded a new version of lmtx: a next step in this matrix and such
graphic part ... (also bTABLE done).
The matrix bit has a high level MP interface, also because it's a nice
example of implementing one (not much code needed actually).
Support in bTABLE .. eTABLE is kind of interesting as it separates the
ornamental part from the text part. The sxample only shows some simple
stuff. I'll probably also add this to the other table mechanisms. (Not
hard but I don't want to impact performance when it's not used.)
The
\startoverlayMPgraphic{mp:whatever-6}
is new and automatically defines the overlay so that saves some code.
\startMPoverlaydata
is just a collector that can be flushed in-line (which wilkl also reset
it).
All this is probably mostly useful in an educational setting. We'll see.
Hans
------------------------------------------------------------
examples
------------------------------------------------------------
\starttext
\startoverlayMPgraphic{mp:whatever-6}
fill OverlayBox withcolor "darkgray" ;
draw matrixbox (1, 1) (2, 1) enlarged OverlayOffset shifted
paired(OverlayOffset) withpen pencircle scaled 1pt withcolor "blue" ;
draw matrixbox (2, 2) (4, 4) enlarged OverlayOffset shifted
paired(OverlayOffset) withpen pencircle scaled 1pt withcolor "red" ;
\stopoverlayMPgraphic
\framed
[synchronize=background,
align=normal,
frame=off,
background=mp:whatever-6,
backgroundoffset=.5ex,
foregroundcolor=white]
{\setmathmatrixanchoring[yes]% left|right|both|yes
\startmathmatrix
\NC a_1 \NC a \NC b \NC c\NR
\NC a_2 \NC a \NC b \NC c\NR
\NC a_3 \NC a^2 \NC b \NC c\NR
\NC a_4 \NC a \NC b_2 \NC c\NR
\NC a_5 \NC a \NC b \NC c\NR
\NC a_6 \NC a \NC b \NC c\NR
\stopmathmatrix}
% \blank
% This can also be done by Alans node module.
\startoverlayMPgraphic{mp:whatever-7}
fill OverlayBox withcolor "darkgray" ;
draw lmt_matrix [
from = (1, 1),
to = (5, 4),
connect = { "bottom", "left" },
color = "blue",
linewidth = 1pt,
arrowoffset = 2pt,
label = [
text = "$\white \scriptscriptstyle x =1$",
offset = ExHeight/2,
anchor = "lft",
fraction = .25
],
] ;
draw lmt_matrix [
from = (4, 1),
to = (1, 5),
connect = { "bottom", "right" }
colors = { "green", "magenta" },
arrowcolor = "white",
linewidth = 1pt,
] ;
draw lmt_matrix [
cell = (2, 2),
shape = "circle"
color = "red",
linewidth = 1pt,
] ;
draw lmt_matrix [
cell = (4, 6),
shape = "round",
radius = ExHeight/2,
color = "red",
linewidth = 1pt,
] ;
draw lmt_matrix [
cell = (2, 6),
shape = "path",
path = fulldiamond xscaled 3EmWidth yscaled 4ExHeight,
color = "red",
linewidth = 1pt,
] ;
draw lmt_matrix [
cell = (2, 6),
shape = "scaledpath",
offset = .5ExHeight,
path = fulldiamond,
color = "yellow",
linewidth = 1pt,
] ;
\stopoverlayMPgraphic
\blank
\framed
[synchronize=background,
align=normal,
frame=off,
offset=overlay,
background=mp:whatever-7,
foregroundcolor=white]
{\setmathmatrixanchoring[both]%
\startmathmatrix
\NC a \NC \NC \quad \NC b \NC \NR
\NC \NC c \NC \quad \NC \NC \NR
\NC \NC \NC \quad \NC \NC \NR
\NC \NC \NC \quad \NC \NC d \NR
\NC e \NC \NC \quad \NC \NC \NR
\NC \NC f \NC \quad \NC g \NC \NR
\stopmathmatrix}
\blank
\startoverlayMPgraphic{whatever-9}
fill anchorspan (1, 1) (1, 3) withcolor "blue" ;
fill anchorspan (2, 1) (3, 3) withcolor "yellow" ;
fill anchorspan (3, 1) (3, 3) withcolor "green" ;
path p ; p := anchorcell (2, 2) ;
fill p withcolor "red" ;
% now some weird stuff:
picture q ; q := externalfigure "t:/sources/cow.pdf" ;
q := q xysized (bbwidth(p), bbheight(p)) ;
draw q shifted - center q shifted center p ;
% and some even weirder stuff:
\includeMPoverlaydata
\stopoverlayMPgraphic
\enabletrackers[localanchor]
\bTABLE[frame=off,synchronize=background,background=whatever-9]
\bTR
\bTD[foregroundcolor=white]
\startMPoverlaydata
fill anchorcell (\xanchor,\yanchor) enlarged
-.25ExHeight withcolor "darkgray" ;
\stopMPoverlaydata
test
\eTD
\bTD
test test
\eTD
\bTD
test test test
\eTD
\eTD
\bTR
\bTD[foregroundcolor=white]
test test
\eTD
\bTD[nx=2,align=middle,foregroundstyle=bold,foregroundcolor=white]
test
\eTD
\eTD
\bTR
\bTD[foregroundcolor=white]
test test test
\eTD
\bTD
test test
\eTD
\bTD
test
\eTD
\eTD
\eTABLE
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________