I guess I asked this a while ago, but I can’t find an answer: Is it possible to replace the lines of a TABLE with my own MetaPost graphics? ATM I’m trying to place my MP lines behind a frame-less TABLE; it will probably work, but it’s a crutch… Hraban
Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:
I guess I asked this a while ago, but I can’t find an answer: Is it possible to replace the lines of a TABLE with my own MetaPost graphics?
ATM I’m trying to place my MP lines behind a frame-less TABLE; it will probably work, but it’s a crutch…
The example below draws a custom border for the whole cell but you're free to draw only certain sides (leftboundary etc. helps) but don't forget to set the boundary box for the graphic (OverlayBox is the size of the cell). %%%% begin example \startuseMPgraphic{dottedborder} draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; \stopuseMPgraphic \defineoverlay[dottedborder][\useMPgraphic{dottedborder}] \starttext \bTABLE[frame=off,background=dottedborder] \bTR \bTD Hello Table! \eTD \eTR \eTABLE \stoptext %%%% end example Wolfgang
Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:
Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:
I guess I asked this a while ago, but I can’t find an answer: Is it possible to replace the lines of a TABLE with my own MetaPost graphics?
ATM I’m trying to place my MP lines behind a frame-less TABLE; it will probably work, but it’s a crutch…
The example below draws a custom border for the whole cell but you're free to draw only certain sides (leftboundary etc. helps) but don't forget to set the boundary box for the graphic (OverlayBox is the size of the cell).
%%%% begin example \startuseMPgraphic{dottedborder} draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; \stopuseMPgraphic
\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]
\starttext
\bTABLE[frame=off,background=dottedborder]
Thank you! Since I needed only horizontal lines, I forced the height with an “invisible“ line: \startuseMPgraphic{dottedborder} draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 withcolor white; draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed withdots withcolor "red"; \stopuseMPgraphic … but it would be visible on a colored background. I’m sure you can show me a better way… My real life example (p.2 in https://yemaya.fiee.net/s/DEEHs5m49yftiqW) involves sketchy lines, and there it’s a bit annoying that the row is not its own frame that could get a continuous background… Well, it’s good enough, I’ll settle for it. Hraban
Henning Hraban Ramm schrieb am 21.02.2024 um 19:04:
Am 19.02.24 um 23:15 schrieb Wolfgang Schuster:
Henning Hraban Ramm schrieb am 19.02.2024 um 22:39:
I guess I asked this a while ago, but I can’t find an answer: Is it possible to replace the lines of a TABLE with my own MetaPost graphics?
ATM I’m trying to place my MP lines behind a frame-less TABLE; it will probably work, but it’s a crutch…
The example below draws a custom border for the whole cell but you're free to draw only certain sides (leftboundary etc. helps) but don't forget to set the boundary box for the graphic (OverlayBox is the size of the cell).
%%%% begin example \startuseMPgraphic{dottedborder} draw OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; \stopuseMPgraphic
\defineoverlay[dottedborder][\useMPgraphic{dottedborder}]
\starttext
\bTABLE[frame=off,background=dottedborder]
Thank you!
Since I needed only horizontal lines, I forced the height with an “invisible“ line:
\startuseMPgraphic{dottedborder} draw (0,0)--(0,OverlayHeight) withpen pencircle scaled 0.001 withcolor white; draw (0,0)--(OverlayWidth,0) withpen pencircle scaled 2 dashed withdots withcolor "red"; \stopuseMPgraphic
… but it would be visible on a colored background. I’m sure you can show me a better way…
\startuseMPgraphic{dottedborder} draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; setbounds currentpicture to OverlayBox; \stopuseMPgraphic Wolfgang
Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can show me a better way…
\startuseMPgraphic{dottedborder} draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; setbounds currentpicture to OverlayBox; \stopuseMPgraphic
Thank you! (I’m sure I already used that somewhere… Must document…) Hraban
On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:
Am 21.02.24 um 19:43 schrieb Wolfgang Schuster:
… but it would be visible on a colored background. I’m sure you can show me a better way…
\startuseMPgraphic{dottedborder} draw bottomboundary OverlayBox withpen pencircle scaled 2 dashed withdots withcolor "red"; setbounds currentpicture to OverlayBox; \stopuseMPgraphic
Thank you!
(I’m sure I already used that somewhere… Must document…) ok, new feature dedicated to Hraban ... who then of courese has to document it.
\starttext \starttabulate \FL[1,2] % linefactor (old) dashfactor (new) \NC test \NC test and test and test and done \NC \NR \ML[1,1] \NC test \NC test and test and test and done \NC \NR \NC test \NC test and test and test and done \NC \NR \NC test \NC test and test and test and done \NC \NR \LL[1,10] \stoptabulate \framed [align=middle,topframe=dash,frame=off] {\samplefile{tufte}} \framed [align=middle, frame=dash, dashstep=.01hs, rulethickness=1pt] {\samplefile{tufte}} \framed [align=middle, frame=dash, dashstep=10pt, rulethickness=2pt, background=color, backgroundcolor=gray] {\samplefile{tufte}} \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 -----------------------------------------------------------------
Am 22.02.24 um 18:35 schrieb Hans Hagen via ntg-context:
On 2/21/2024 7:47 PM, Henning Hraban Ramm wrote:
(I’m sure I already used that somewhere… Must document…) ok, new feature dedicated to Hraban ... who then of course has to document it.
This is nice. Thank you, will do. (Actually I’m not much interested in dashed borders but to have lines affected by my sketchy style - courtesy of Aditya et al., see below) Taco, will the syntax pages in the wiki update automatically to a newer version? """ \startuseMPgraphic{mp:sketchy} input mp-sketch.mp; sketchypaths; sketch_amount := 1 + (uniformdeviate 2); sketch_passes := 3; sketch_segments := 2 + (uniformdeviate 3); sketch_length := OverlayWidth / 3; draw topboundary withpen pensquare withcolor lightgray; naturalizepaths; \stopuseMPgraphic \defineoverlay[sketchylines][\useMPgraphic{mp:sketchy}] \setupTABLE[r][first][style=bold] \setupTABLE[r][each][ topoffset=1em,bottomoffset=0.5em, background=sketchylines, % would be nice if the background wouldn’t start at each column ] \setupTABLE[c][each][frame=off] \bTABLE[] \bTR \bTD{Stadt}\eTD \bTD{Land}\eTD \bTD{Fluss}\eTD \eTR \dorecurse{10}{ \bTR \bTD\strut \eTD\bTD \eTD\bTD \eTD \eTR } \eTABLE """ Hraban
participants (3)
-
Hans Hagen
-
Henning Hraban Ramm
-
Wolfgang Schuster