0
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother
\begin{document}
\begin{equation}
  \begin{bmatrix}[cc|c|c]
0 & -I & I & 0\\
0 & 0 & -I & I \\
\end{bmatrix}
\end{equation}
\end{document}

enter image description here

2
  • Is your image the matrix you want? Or the matrix you get? What does your code snippet do? Could you make it a complete example by including the necessary \usepackage and document commands?
    – Teepeemm
    Sep 29, 2020 at 17:00
  • here you go, i modified it. i was just able to generate like the right matrix in the picture but i need the left one.
    – user224189
    Sep 29, 2020 at 17:06

1 Answer 1

2

You can't get those matrices just with bmatrix, but you need to use the lower level array:

\documentclass{article}
\usepackage{amsmath,booktabs}

\begin{document}

\[
\mathbf{L}=
\begin{bmatrix}
\begin{array}{@{}cc@{}}
\mathbf{I} & \mathbf{0} \\
\mathbf{0} & \mathbf{I} \\
\midrule[\arrayrulewidth]
\mathbf{0} & \mathbf{I} \\
\midrule[\arrayrulewidth]
\mathbf{0} & \mathbf{I}
\end{array}
\end{bmatrix}
\implies
\mathbf{L}^+=
\begin{bmatrix}
\begin{array}{@{}cc|c|c@{}}
\mathbf{I} & \mathbf{0} & \mathbf{0} & \mathbf{0} \\
\mathbf{0} & \mathbf{I} & \mathbf{0} & \mathbf{0}
\end{array}
\end{bmatrix}
\]

\end{document}

enter image description here

2
  • when i adding ` \begin{equation}` ` \end{equation}` does not work. it seems not possible to put in one equation.
    – user224189
    Sep 29, 2020 at 20:06
  • @user224189 You need to replace \[ with \begin{equation} and \] with \end{equation}.
    – egreg
    Sep 29, 2020 at 20:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.