3

I created this block matrix:

$\left[
\begin{array}{c c c c}
\multicolumn{1}{c|}{A(1)}   \\
\multicolumn{1}{c|}{}\\
\cline{1-2}
\multicolumn{1}{c|}{\begin{array}{c|c}
      & \Gamma_{2,1} \\  
     &  
\end{array}}   & \multicolumn{1}{c|}{A(2) } & \\ \cline{1-2}  
\vdots           & \ddots     &       \ddots  & \\ \hline
\multicolumn{1}{c|}{\begin{array}{c|c}
       & \Gamma_{s,1} \\
       &
\end{array}}& \cdots    & \multicolumn{1}{c|}{\begin{array}{c|c}
       & \Gamma_{s,s-1}    \\
       &
\end{array}} & \multicolumn{1}{c|}{A(s) }\\ \hline
\end{array}
\right]$

And it has the form as the picture enter image description here

But I want to get rid of the line below (the left hand side) next to the block matrix $\Gamma_{2,1}$ and similarly with the line above and below (both the right and left hand side) next to the block matrix $\Gamma_{s,1}$.

Could you help me in this case? I really appreciate your support.

Additionally, can you help me to create the block matrix A(2) and A(s) has the same size with A(1)?

Sorry for the confusion, actually I want to create the matrix is the same in the picture below. enter image description here

A(s) is the block matrix $n \times n$ and $\Gamma(s,1)$ is the column vector $n \times 1$.

6
  • 2
    Welcome. // Please try to compile the code you posted ... and add what's missing ;-) Thank you Commented May 14 at 5:58
  • It would be helfpul if you explained the underlying structure of the \begin{array}{c|c} & \Gamma_{2,1} \\ & \end{array} chunks. E.g., what's the purpose of setting up a 2x2 array if there's nothing in the first column? Moreover, what is supposed to be in the implied second rows -- a null matrix? an identity matrix? nothing at all? Commented May 14 at 7:10
  • @MS-SPO Thank you for your comments, I added the details. Commented May 14 at 7:16
  • @Mico Thank you for your comments. Yeah, there is nothing in the first column, actually the empty blocks would be all zeros. I added the details of my question. Commented May 14 at 7:18
  • @Lilili123 - So, are the A matrices supposed to be twice as wide (or even wider) than the \Gamma matrices? Incidentally, is it crucial to draw frames around the blocks? Or are the frame lines optional? Please advise. Commented May 14 at 7:31

3 Answers 3

3

With {pNiceMatrix} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\[
\renewcommand{\arraystretch}{4}
\setlength{\extrarowheight}{-1mm}
\setlength{\arraycolsep}{1pt}
\everymath{\scriptstyle}
\newcommand{\B}{\Block[draw,C]}
\begin{pNiceMatrix}[columns-width=auto,margin=5pt]
\B{1-2}{A(1)} \\
& \B{}{\Gamma(2,1)} & \B{1-2}{A(2)} \\
& \B{}{\Gamma(3,1)} & & \B{}{\Gamma(3,2)} & \B{1-2}{A(3)} \\
& \vdots &&&&& \ddots \\
& \B{}{\Gamma(s,1)} & \cdots &  \B{}{\Gamma(3,2)} & \cdots &  \cdots &
  \B{}{\Gamma(s,s{-}1)} & \B{1-2}{A(s)} & \\
\end{pNiceMatrix}\]

\end{document}

Output of the above code

4

(I revised my answer after the OP provided additional information about the desired structure of the block matrix.)

The OP has expressed a preference for making the A block matrices three times as wide as the \Gamma block matrices. That makes the overall matrix rather wide, necessitating its rendering in landscape mode. The following solution therefore uses "just" a 2:1 width ratio.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage[margin=2cm]{geometry} % set page parameters as needed
\usepackage{array} % for 'w' column type
\newlength\mylen % scratch length

% 3 handy shortcut macros:
\newcommand\Amat[1]{ \multicolumn{2}{ c|}{A(#1)}}
\newcommand\Amatx[1]{\multicolumn{2}{|c|}{A(#1)}}
\newcommand\Gmat[1]{ \multicolumn{1}{|c|}{\Gamma(#1)}}

\begin{document}

\[
\settowidth\mylen{$\Gamma(s,s-1)$} % find desired column width
\setlength\arraycolsep{1pt} % default: 5pt
\renewcommand\arraystretch{2}
\left[\,
\begin{array}{ *{10}{w{c}{\mylen}} } % define 10 columns of type 'w'
\cline{1-2}
\Amatx{1} & & & & & & & & \\
\cline{1-4}
& \Gmat{2,1} & \Amat{2} \\  
\cline{2-6}
& \Gmat{3,1} & & \Gmat{3,2} & \Amat{3} \\
\cline{2-2} \cline{4-6}
& \vdots & & \vdots & & & \ddots \\
\cline{2-2} \cline{4-4} \cline{8-10}
& \Gmat{s,1} & & \Gmat{s,2} & \multicolumn{2}{c}{\dots} & \dots & \Gmat{s,s+1} & \Amat{s} \\
\cline{2-2} \cline{4-4} \cline{8-10}
\end{array}
\,\right]
\]

\end{document}
3

With array and \hhline.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array,hhline}

\newcommand{\block}[3]{%
  \multicolumn{#1}{#2}{\vphantom{\begin{matrix} 0\\0\\0 \end{matrix}}#3}%
}

\begin{document}

\[
\newcolumntype{C}{w{c}{2em}}
\left[\,\,
\begin{array}{*{10}{C}}
\hhline{--}
\block{2}{|C|}{A(1)} &&&&&&&& \\
\hhline{--|--}
\block{1}{C|}{} & \block{1}{C|}{\Gamma_{2,1}} & \block{2}{C|}{A(2)} \\
\hhline{~|--|-|--|}
\block{1}{C|}{} & \block{1}{C|}{\Gamma_{3,1}} & \block{1}{C|}{}
  & \block{1}{C|}{\Gamma_{3,2}} & \block{2}{C|}{A(3)} \\
\hhline{~|-|~|-|--|}
& \vdots && \vdots &&& \ddots \\
\hhline{~|-|~|-|~~~|-|--|}
\block{1}{C|}{} & \block{1}{C|}{\Gamma_{s,1}} & \block{1}{C|}{\dots}
  & \block{1}{C|}{\Gamma_{s,2}}
& \block{3}{C|}{\dots} & \block{1}{C|}{\Gamma_{s,s-1}} & \block{2}{C|}{A(s)} \\
\hhline{~|-|~|-|~~~|-|--|}
\end{array}
\,\,\right]
\]

\end{document}

output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.