# How to add dash lines in Matrix [duplicate]

I would like to know how to add dash lines in Matrix (see figuge)

Cheers

S.L.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$$\begin{bmatrix} N & B_i \\ B_i^T & 0 \end{bmatrix} \begin{bmatrix} x_i\\ k \end{bmatrix} =\begin{bmatrix} n\\ 0 \end{bmatrix} \text{ with } n = A^TPl$$
\end{document}


If using array instead of bmatrix is possible, you can use arydshln package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

$$\left[ \begin{array}{c;{2pt/2pt}c} N & B_i \\ \hdashline[2pt/2pt] B_i^T & 0 \end{array} \right] \left[ \begin{array}{c} x_i \\ \hdashline[2pt/2pt] k \end{array} \right] =\left[ \begin{array}{c} n \\ \hdashline[2pt/2pt] 0 \end{array} \right] \text{ with } n = A^TPl$$

\end{document}


you can of course, modify options to achieve the look that you desire.

• How do you move the dashed line from the superscript, T? If you do move that dashed line, how do you then align all the horizontal dashed lines?
– Joe
Sep 27 '15 at 17:00
• In my latex version I also have to load the "array" package.
– jack
Jun 9 '20 at 6:47