There were many cases of how to write block diagonal matrix. However, how to write a pmatrix such that the line and column could be labeled?

enter image description here

  • Welcome to TSE. Did you try to do a searcho for matrix and label? Aug 8 '21 at 18:14
  • You can see the blkarray package.
    – Bernard
    Aug 8 '21 at 18:26
  • @Bernard is there a way to just use amsmath etc.? there's been to many packages and some of them were not quite compatible with each other. Aug 8 '21 at 18:30
  • 1
    It has no incompatibility I know of. It's a small package which loads array, and it works fine within amsmath.
    – Bernard
    Aug 8 '21 at 18:41
  • @Bernard blkarray isn't based on array package at all it is a completely separate tabular implementation (and 2227 lines long, although a lot comments of course) Aug 8 '21 at 20:40

This is very easy with nicematrix:



a_{1} & a_{2} & l_{1} \\
a_{3} & a_{4} & l_{2} \\
c_{1} & c_2


This requires several LaTeX runs at the beginning, but the typesetting will soon stabilize.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.