TransWikia.com

how to make a certain type of matrix

TeX - LaTeX Asked by Đạt Lê Thành on December 23, 2020

How can I make a matrix with some texts around it as bellow?

enter image description here

2 Answers

I once used the kbordermatrix package (http://www.its.caltech.edu/~kcborder/TeX/kbordermatrix.pdf) for a similar problem if that helps.

documentclass{article}
usepackage{amsmath}
usepackage{kbordermatrix}
begin{document}

    [
    H = kbordermatrix{
          & A  & B  & C  & D  
        A & Ha &    &    &    
        B &    & Hb &    &   
        C &    &    & Hc &   
        D &    &    &    & Hd 
        }
    ]
end{document}

or like that ?

documentclass{article}
usepackage{blkarray}
newcommand{mLabel}[1]{mbox{$scriptstyle{#1}$}}
begin{document}
   
        [
        H=
    begin{blockarray}{c@{}ccc@{hspace{5pt}}cl}
        & mLabel{A} & mLabel{B} & mLabel{C} &mLabel{D} & 
        begin{block}{[c@{hspace{10pt}}ccc@{hspace{10pt}}c]l}
            & Ha &    &    &    & mLabel{A} 
            &  ´ & Hb &    &    & mLabel{B} 
            &    &    & Hc &    & mLabel{C} 
            &    &    &    & Hd & mLabel{D} 
        end{block}
    end{blockarray}
    ]
    
end{document}

Correct answer by Roland on December 23, 2020

With nicematrix:

documentclass{article}
usepackage{nicematrix}
begin{document}

[
H = 
begin{bNiceMatrix}[first-row,last-col]
A  & B  & C  & D  & 
Ha &    &    &    & A  
   & Hb &    &    & B 
   &    & Hc &    & C 
   &    &    & Hd & D
end{bNiceMatrix}
]
end{document}

Output of the above code

Answered by F. Pantigny on December 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP