# Creating a block matrix

I want to create the following block matrix

So far I have obtain the following matrix

$\renewcommand{\arraystretch}{1.3} \left[ \begin{array}{c@{}c:c:c:c:c:c} & \pmb{\Phi}_{1} & \pmb{\Psi}_{1} & \mathbf{0} & \cdots & \mathbf{0} & \mathbf{0} \\ \hdashline & \mathbf{0} & \pmb{\Phi}_{2} & \pmb{\Psi}_{2} & \cdots & \mathbf{0} & \mathbf{0} \\ \hdashline & \vdots & \vdots & \vdots & & \vdots & \vdots \\ \hdashline & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \pmb{\Phi}_{n-1} & \pmb{\Psi}_{n-1} \\ \hdashline & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \mathbf{0} & \pmb{\Phi}_{n} \\ \end{array}\right]$


It produces the following matrix

How can I achieve that the vertical line are not draw through in the third line like the matrix at the top?

• Please consider accepting an answer. Or is your question still open? Commented Dec 30, 2018 at 8:14

with

\def\MC#1{\multicolumn{1}{c}{#1}}


and then

$\renewcommand{\arraystretch}{1.3} \left[ \begin{array}{c@{}c:c:c:c:c:c} & \pmb{\Phi}_{1} & \pmb{\Psi}_{1} & \mathbf{0} & \cdots & \mathbf{0} & \mathbf{0} \\ \hdashline & \mathbf{0} & \pmb{\Phi}_{2} & \pmb{\Psi}_{2} & \cdots & \mathbf{0} & \mathbf{0} \\ \cdashline{1-4}\cdashline{6-7} & \MC{\vdots} & \MC{\vdots} & \MC{\vdots} & \MC{} & \MC{\vdots} & \vdots \\\cdashline{1-4}\cdashline{6-7} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \pmb{\Phi}_{n-1} & \pmb{\Psi}_{n-1} \\ \hdashline & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \mathbf{0} & \pmb{\Phi}_{n} \\ \end{array}\right]$


• But the second and the third horizontal line are drawn through. This is for the matrix at the top not the case. How can I handle this? Commented Dec 20, 2018 at 20:49
– user2478
Commented Dec 21, 2018 at 6:38

Like this?

\documentclass{book}
\usepackage{amsbsy}
\usepackage{arydshln}

\begin{document}

$\renewcommand{\arraystretch}{1.3} \left[ \begin{array}{c@{}c:c:c:c:c:c@{}} & \boldsymbol{\Phi}_{1} & \boldsymbol{\Psi}_{1} & \mathbf{0} & \cdots & \mathbf{0} & \mathbf{0} \\ \cdashline{1-4}\cdashline{6-7} & \mathbf{0} & \boldsymbol{\Phi}_{2} & \boldsymbol{\Psi}_{2} & \cdots & \mathbf{0} & \mathbf{0} \\\cdashline{1-4}\cdashline{6-7} & \multicolumn{1}{c}{\vdots} & \multicolumn{1}{c}{\vdots} & \multicolumn{1}{c}{\vdots} &\multicolumn{1} {c}{} & \multicolumn{1}{c}{\vdots} & \vdots \\ \cdashline{1-4}\cdashline{6-7} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots &\multicolumn{1}{@{\,}c: }{ \boldsymbol{\Phi}_{n-1}\mkern-6mu} & \mkern-6mu \boldsymbol{\Psi}_{n-1} \\ \cdashline{1-4}\cdashline{6-7} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \mathbf{0} & \boldsymbol{\Phi}_{n} \\ \end{array}\right]$

\end{document}


• The second and the third horizontal line are drawn through. This is for the matrix at the top not the case. How can I handle this? Commented Dec 20, 2018 at 20:50
• With \cdashline{...}. Please see the updated code. Commented Dec 20, 2018 at 21:01
• I can't see the command \cdashline in your code Commented Dec 20, 2018 at 21:08
• Sorry, a clipboard manager accident. 'Iis fixed now. Commented Dec 20, 2018 at 21:12

Here is a solution with {bNiceArray} of nicematrix.

\documentclass{book}
\usepackage{amsbsy}
\usepackage{nicematrix,tikz}

\NiceMatrixOptions
{
custom-line =
{
letter = : ,
command = cdashedline ,
tikz = dashed
}
}

\begin{document}

$\renewcommand{\arraystretch}{1.3} \begin{bNiceArray}{c:c:c:c:c:c}[margin] \boldsymbol{\Phi}_{1} & \boldsymbol{\Psi}_{1} & \mathbf{0} & \Block{*-1}{} \cdots & \mathbf{0} & \mathbf{0} \\ \cdashedline \mathbf{0} & \boldsymbol{\Phi}_{2} & \boldsymbol{\Psi}_{2} & \cdots & \mathbf{0} & \mathbf{0} \\ \cdashedline \Block{1-*}{}\vdots & \vdots & \vdots & & \vdots & \vdots \\ \cdashedline \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \boldsymbol{\Phi}_{n-1} & \boldsymbol{\Psi}_{n-1} \\ \cdashedline \mathbf{0} & \mathbf{0} & \mathbf{0} & \cdots & \mathbf{0} & \boldsymbol{\Phi}_{n} \\ \end{bNiceArray}$

\end{document}