1

I know how to write a block matrix. It's done like

\[
Q=
\left[
\begin{array}{c|c}
{\{A\}}_{l\times l} & 0} \\
\hline
0} & B }
\end{array}
\right]
\]

But I want to add a row and column to my matrix .That is I want to write it like this:

Row: 1 1 1 1 1 1 1 1 1 1 1
Column:
1
1
1
1
1
1
1
1
1

And then in the gap I want to add my block matrix.

I am adding an image for that how I want it. Can someone please help?

enter image description here

  • 2
    please show us (the code in form of small complete document, which we can compile) what you try so far! – Zarko Sep 1 '18 at 17:47
3

One can simply use array and a small trick for getting a bigger letter for the blocks.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Block}[2]{%
  \makebox[0pt]{\smash{$\mbox{\LARGE$#1$}_{#2}$}}%
}

\begin{document}

\[
Q=\left[
\begin{array}{@{}cccc|ccc@{}}
1      & 1 & \dots                & \multicolumn{1}{c}{1} & 1 & \dots       & 1 \\
1      &   &                      &                       &   &             &   \\
\vdots &   & \Block{A}{l\times l} &                       &   & \Block{0}{} &   \\
1      &   &                      &                       &   &             &   \\
\cline{2-7}
1      &   &                      &                       &   &             &   \\
\vdots &   & \Block{0}{}          &                       &   & \Block{B}{} &   \\
1      &   &                      &                       &   &             &
\end{array}
\right]
\]

\end{document}

enter image description here

  • Excellent all your answers. +1 for all. – Sebastiano Sep 1 '18 at 21:16
1

You can always put an array inside another array, or use \multicols or \multirows (multirow package, goes back to text mode). Now, expanding the cells to fit the space is more problematic.

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{multirow}
\begin{document}
$\begin{bmatrix}
1 & 1 & 1 & 1 & \cdots & 1 \\
1 & \multicolumn{5}{c}{\multirow{5}{*}{$\begin{array}{c|c}
 {A}_{l\times l} & 0 \\
 \hline
 0 & B
 \end{array}$}}\\
1 \\
1 \\
\vdots \\
1 
\end{bmatrix}$
\end{document}

demo


This solution aligns to the outer matrix. It uses \raisebox instead of \multirow (shift distance is fudged).

\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
$\left[ \begin{array}{cccccc}
1 & 1 & 1 & 1 & \cdots & 1 \\
1 & \multicolumn{3}{c|}{} \\
1 & \multicolumn{3}{c|}{A_{l\times l}} & \multicolumn{2}{c}{0} \\
1 & \multicolumn{3}{c|}{} \\
\cline{2-6}
\vdots & \multicolumn{3}{c|}{\raisebox{-1ex}[0pt][0pt]{$0$}} & \multicolumn{2}{c}{\raisebox{-1ex}[0pt][0pt]{$B$}} \\
1 & \multicolumn{3}{c|}{} 
\end{array}\right]$
\end{document}

second demo

1

A solution using  pstricks for the vertical line and \booktabs for the horizontal line:

\documentclass{article}
\usepackage{mathtools}
\usepackage{multirow, blkarray, delarray}
\usepackage{booktabs}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\begin{postscript}
\[ \begin{bmatrix}
1 & 1 & 1 & 1 \pnode{A} & 1 & \cdots & 1 \\
1 & & & \\
1 & & \mathclap{A} \\[-1ex]
\vdots & & & & & & \\[-1.5ex]
\vdots \\[-2.5ex]
 \cmidrule(r){2-7}
 \vdots \\[-1.5ex]
 \vdots & & & & \multicolumn{3}{c}{\raisebox{1.5ex}{$ B $}}\\
1 & & & \phantom{1}\pnode{B}
\end{bmatrix} \]
\pcline[offset=\arraycolsep, linewidth=0.4pt]{-}(A)(B)
\end{postscript}

\end{document} 

enter image description here

Your Answer

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