How can i do a matrix like this one?

I’m able to do a matrix with brackets, but i need to place a row on top of the matrix, and outside the brackets.

best i can do so far is this:

size 15 P ~ ~ ~ = ~ ~ ~ ~ ~size 12 stack{ ~ #i ~# j ~ # k ~  # l ~  # m ~} 
left (
stack{ ~ i#  .06  # .1 # .16# .26 # .42 } 
~~ 
stack{~ j#.42  #.06 # .1# .16 # .26} 
~~
stack{ ~ k #.26 # .42 # .06 # .1 # .16} 
~~
stack{~ l #.16  # .26 # .42# .06 # .1} 
~~
stack{~ m #.1  # .16 # .26# .42 # .06} 
right  ) 

thank you!

(formatting editing by ajlittoz – hoping not having changed the meaning)

Attach the brackets “outside” the matrix. Use some phantoms for sizing of brackets and positioning the matrix within brackets:

 P^2 = left none stack {rain # nice # snow } right ( 
 matrix 
 {rain # nice # snow ##
 .438 # .188 # .375 ## 
 .375 # .250 # .375 ## 
 .375 # .188 # .438 ##
 phantom 1 #phantom 1 # phantom 1 } 
 left ) stack {phantom rain # phantom nice # phantom snow } right none 

The phantom line below may give unwanted spacing below your formula. Adjustment should be possible.

Elegant and readable. Wow!

agree, thank you!

@DJauri if the answer solves your problem then please click on the tick beside keme’s answer to show others it has been solved. Cheers, Al

Missed the fact that target data is a bit different from the sample display (which I suspect that @DJauri manages nicely) and also that phantom can be used on blocks, not only on single items, which improves the suggested solution a bit:

 size 15 

 P ~ ~ ~ = ~ ~ ~ ~ ~

 size 12 

 left none 
 stack{ i ~ # j ~ # k ~ # l ~ # m ~} 
 right ( 

 matrix { 
 i #j #k #l #m ##
 .06 # .42 #.23 #.16 #.1 ##
 .1 #.06 #.42 #.23 #.16 ##
 .16 #.1 #.06 #.42 #.26 ##
 .26 #.16 #.1 #.06 #.42 ##
 .42 #.26 #.16 #.1 #.06 ##
 ""  #"" # ""# "" # phantom X
  }

 left ) 
 phantom stack{ i ~ # j ~ # k ~ # l ~ # m ~} 
 right none

I don’t know a systematic way to align the headers with columns of an independent structure below.
A very crude tinkerer’s approach, that may be acceptable for a single case or two:

left none matrix{"                       "i # "     "j # "     "k # "     "l # "    "m}  right none
newline
size 15P ~ ~ ~ = ~ ~  ~ ~size 12 stack{ i ~# j ~ # k ~ # l ~ # m ~}
left ( stack{   .06 # .1 # .16# .26 # .42 } ~~ stack{~ .42 #.06 # .1# .16 # .26} ~~ 
stack{ ~ .26 # .42 # .06 # .1 # .16} ~~ stack{~ .16 # .26 # .42# .06 # .1} ~~ 
stack{~ .1 # .16 # .26# .42 # .06} "  " right )

it ceretainly does the job! thank you!

Another aproximation:

size 15P ~  = ~ ~size 12 stack { ~ # i ~# j ~ # k ~ # l ~ # m ~}
binom { alignc ~ i ~~~ j ~~~  k ~~~ l ~~~  m } 
{ alignc left (  {  stack {.06 # .1 # .16# .26 # .42 } }
~ { stack {.42 # .06 # .1# .16 # .26 }} 
~ { stack {.26 # .42 # .06 # .1 # .16} }
~ { stack {.16 # .26 # .42# .06 # .1} }
~ { stack { .1 # .16 # .26# .42 # .06 } }right ) }

p is not vertically well aligned.

Made with LibreOffice 6.4.7.2 (x86); OS: Windows 6.1.


Add Answer is reserved for solutions. Click edit below your question if you want to add more information; also can comment an answer.

está genial así, gracias!

@LeroyG was nearly at it.

You should consider that the right-hand side is made of a “comment” line and the matrix. This is what is meant by the stack function. To have the left-hand side correctly aligned, i.e. P =vertically centered relative to the matrix, we must also have two elements stacked over each other.

My formula is then:

stack { size 12 ~ # size 15 P ~  "="}             -- left-hand side
                                                  -- and below, right-hand side unchanged
~ ~size 12 stack { ~ # i ~# j ~ # k ~ # l ~ # m ~}
binom { alignc ~ i ~~~ j ~~~  k ~~~ l ~~~  m } 
{ alignc left (  {  stack {.06 # .1 # .16# .26 # .42 } }
~ { stack {.42 # .06 # .1# .16 # .26 }} 
~ { stack {.26 # .42 # .06 # .1 # .16} }
~ { stack {.16 # .26 # .42# .06 # .1} }
~ { stack { .1 # .16 # .26# .42 # .06 } }right ) }

with result:

aligned matrix

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

very nice, thx!

also thanks for the format change, as you may guess, i’m quite new here!