#how to do matrix with lines?

59 messages · Page 1 of 1 (latest)

pearl dock
#

like this...

#

on tex you can just do ```tex
[
\begin{array}{|c|cccc|}
\hline
\oplus & a & b & c & d \ \hline
a & a & b & c & d \
b & b & a & d & c \
c & c & d & a & b \
d & d & c & b & a \
\hline
\end{array}
]

fallow solar
#

well thats basically a table

#

to reproduce such behavior I recommend trying out tablex

#

since it allows customizing the lines

fallow solar
#

just in case , here's what you'd do:

#tablex(
  auto-lines: false,
  stroke: 0.5pt,
  columns: 5,
  hlinex(),
  vlinex(), vlinex(), (), (), (), vlinex(),
  $plus.circle$, $a$, $b$, $c$, $d$,
  hlinex(),
  $a$, $a$, $b$, $c$, $d$,
  $b$, $b$, $a$, $d$, $c$,
  $c$, $c$, $d$, $a$, $b$,
  $d$, $d$, $c$, $b$, $a$,
  hlinex()
)
pearl dock
#

iiii was going to ask you... how to uh shrink it cuz i started doing myself lol

#

then i see discord

#
#tablex(
    columns: (auto, 1em, 1fr, 1fr,1fr),  // 5 columns
    rows: auto,  // at least 1 row of auto size
   // fill: red,
   auto-lines: false,
    align: center + horizon,
    stroke: black,
    vlinex(),hlinex(),vlinex(),(),(),(),vlinex(),
    [$plus.circle$], [$a$], [$b$], [$c$],[$d$],
    hlinex(),
    [$a$], [$a$], [$b$], [$c$], [$d$],
 [$b$], [$b$], [$a$], [$d$], [$c$],
  [$c$], [$c$], [$d$], [$a$], [$b$],
  [$d$], [$d$], [$c$], [$b$], [$a$],
   hlinex(),
)
#

my hilariously bad code

fallow solar
#

it's not that bad

#

lol

#

you just didnt assume that [$ ... $] is the same as $ ... $

#

and also that columns: n is the same as columns: (auto,) * n

#

which is very convenient

#

i also hand-picked stroke: 0.5pt cuz that's usually the stroke used in math stuff

pearl dock
#

why my table extends the whole document and yours doesn't?

fallow solar
#

cuz of 1fr

#

instead of auto

#

fr expands across all remaining space

pearl dock
#

now all we need is for pandoc to support tablex

#

lol

fallow solar
#

lol

#

well

#

I intend to take most of its stuff upstream eventually

#

to default tables

#

but that will take a looong while

#

lol

pearl dock
#

why not with packages

#

latex does it

#

just asken

fallow solar
#

I mean

pearl dock
#

just make package manager trivially easy to install

#

or system packages

fallow solar
#

well

#

that doesnt depend on me

#

lol

#

but

#

thing is that doing it in Rust would be better cuz faster and native support

pearl dock
#

true

fallow solar
#

if there were a plugin system then the same effect would be achieved

#

but well

#

we saw how that discussion went on github

#

lol

#

anyway i just think it'd be very convenient to have its stuff available by default

#

just like how theres typst-canvas but at some point it'll prob become default

#

but user packages will prob remain to exist for further customizability

#

though, I am planning on doing a rework of the internal tablex drawing system which might give it some pretty good improvements

#

in terms of speed

#

but yeah doing it in Rust would be ideal

#

anyway

#

lol

#

but what matters is that we got that package going at least so

#

(much) better than nothing lol

#

I wanted to port other LaTeX stuff but didnt get very far atm (other than diagbox (already released))

#

i gave a shot at bussproofs but failed miserably

#

lol