On 5/31/2021 9:04 PM, Aditya Mahajan wrote:
On Mon, 31 May 2021, Hans Hagen wrote:
On 5/31/2021 6:50 PM, Aditya Mahajan wrote:
On Mon, 31 May 2021, Hans Hagen wrote:
Hi,
I uploaded a new lmtx version. This time a new mechanism.
This is very interesting...I haven't played around with it, but is it the
case that \markanchor does not do alignment and so can completely replace
the old \hpos{...} class of macros?
This also gives many interesting possibilities for math .... drawing "boxes"
in matrices (e.g.,
https://tex.stackexchange.com/questions/333011/draw-a-box-around-matrix-elements)
or even the nath style `\wall` macro (see pg 11 of
https://texdoc.org/serve/nathguide.pdf/0) ... Of course, I mean this in
terms of the visual effect and not the interface.
Like this ... I'll think about taking some size into account (a bit like hpos
does).
Yes! If we can take size of cell into account, it will be perfect.
We can also think of a wrapper so that an explicit \framed is not needed.
new upload with nesxt step
\starttext
\startuseMPgraphic{whatever-5}
fill OverlayBox withcolor "lightgray" ;
draw matrixbox (1, 1) (2, 1) withpen pencircle scaled 1pt withcolor
"blue" ;
draw matrixbox (2, 2) (4, 4) withpen pencircle scaled 1pt withcolor
"red" ;
% drawdot anchorxy("matrix", 3, 4) withpen pencircle scaled 4pt
withcolor "green";
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\defineoverlay[whatever-5][\useMPgraphic{whatever-5}]
\framed
[synchronize=background,
align=normal,
frame=off,
background=whatever-5]
{\setmathmatrixanchoring[both]% left|right|both|yes
% {\setmathmatrixanchoring[right]% left|right|both|yes
\startmathmatrix
\NC a1 \NC a \NC b \NC c\NR
\NC a2 \NC a \NC b \NC c\NR
\NC a3 \NC a^2 \NC b \NC c\NR
\NC a4 \NC a \NC b_2 \NC c\NR
\NC a5 \NC a \NC b \NC c\NR
\NC a6 \NC a \NC b \NC c\NR
\stopmathmatrix}
\blank
\startuseMPgraphic{whatever-5}
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" ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\framed
[synchronize=background,
align=normal,
frame=off,
background=whatever-5,
backgroundoffset=.5ex,
foregroundcolor=white]
{\setmathmatrixanchoring[yes]% left|right|both|yes
\startmathmatrix
\NC a1 \NC a \NC b \NC c\NR
\NC a2 \NC a \NC b \NC c\NR
\NC a3 \NC a^2 \NC b \NC c\NR
\NC a4 \NC a \NC b_2 \NC c\NR
\NC a5 \NC a \NC b \NC c\NR
\NC a6 \NC a \NC b \NC c\NR
\stopmathmatrix}
\stoptext
as a side track / distraction I added italic correction prevention, as
shown in:
\starttext
\startTEXpage[offset=10pt] \showglyphs
\startcombination[nx=3,ny=1]
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup
\showmakeup[math,kern]%
$a = b + c$\par
$b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
italic correction
\stopcaption
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup
\showmakeup[math,kern]%
\noitaliccorrection
$a = b + c$\par
$b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
no italic correction
\stopcaption
\startcontent \framed[strut=no,align=normal,offset=1ex]\bgroup
\showmakeup[math,kern]%
$a = b + c$\par
$\noitaliccorrection b = c + d$\par
$c = e + f$\par
\egroup \stopcontent
\startcaption
selected correction
\stopcaption
\stopcombination
\stopTEXpage
\stoptext
but of course different width are still a reason why this doesn't align
Hans
-----------------------------------------------------------------
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
___________________________________________________________________________________