[Tex/LaTex] Block matrices with LaTeX

blockmatrices

Does anyone know how I could write this block matrix with a LaTeX code ? For now, this is a figure I did on photoshop… And I would like it to be an equation to have a better resolution.

enter image description here

Best Answer

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand{\mymatrix}{
    \left(\begin{gathered}
    \tikzpicture[every node/.style={anchor=south west}]
        \node[minimum width=2cm,minimum height=.6cm] at (0,0) {$C_2$};
        \node[minimum width=2cm,minimum height=.6cm] at (0,.6) {$B_2$};
        \node[minimum width=4cm,minimum height=1.2cm] at (2,0) {$M_{3,7}^{[1,2]}$};
        \node[minimum width=1.5cm,minimum height=1.2cm] at (0,1.2) {$A_4$};
        \node[minimum width=4.5cm,minimum height=1.2cm] at (1.5,1.2) {$M_{3,7}^{[1]}$};
        \draw[dashed] (0,1.2) -- (6,1.2);
        \draw[dashed] (0,0.6) -- (2,0.6);
        \draw[dashed] (2,0) -- (2,1.2);
        \draw[dashed] (1.5,1.2) -- (1.5,2.4);
    \endtikzpicture
    \end{gathered}\right)
}

\begin{document}
    \[ M_{3,9} = \mymatrix \]
\end{document}

enter image description here