# [Tex/LaTex] Big block matrix with tikz

diagramsmatricestikz-pgf

I know this is very similar to plenty of questions.

The matrix below s actually bigger, so I realized that I had to use tikz.
In this array, A, A',…,L', T are square matrices, and I filled with
zeros the right half, although the original matrix doesn't have these trivial entries, so I cannot remove them (don't try to fix the entries in the right side,
because the spacing is ok when I introduce their actual values)

• Is there a less ugly way to write this block matrix?
• I'm sure there is a better way to display this tensor product in the non-zero block below, because, as it is displayed, it is not readable. I mean, it seems that \otimes T is multiplying only the matrix L!

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}

\begin{document}

\begin{tikzpicture}[node distance=-1ex]
\matrix (mymatrix) [matrix of math nodes,left delimiter={(},right
delimiter={)}]
{ 0  &  0 & A&  A'  &  0  &  0  &  0  &  0 & 0 & 0 &  0  &  0  &  0  & 0  &  0  &  0  &  0&0 &\!\!\!\!\! \\
0  &  0  &  B' & B\,\, &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
C &  C'  &  0  &  0  &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
D' & D &  0  &  0  &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  K  &  K' &  & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  L'  & L  & \!\!\!\otimes T & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  M  &  M'  &  0   &0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  N'  &  N  &  0  & 0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
};
\draw[blue,dashed] (mymatrix-4-1.south west) -- (mymatrix-4-4.south east);
\draw[blue,dashed] (mymatrix-1-4.north east) -- (mymatrix-4-4.south east);
\draw[red,dashed] (mymatrix-4-4.south east) -- (mymatrix-4-10.south west);
\draw[red,dashed] (mymatrix-5-4.north east) -- (mymatrix-8-4.south east);
\draw[red,dashed] (mymatrix-4-10.south west) -- (mymatrix-8-10.south west);
\draw[red,dashed] (mymatrix-8-4.south east) -- (mymatrix-8-10.south west);
\end{tikzpicture}
\end{document}


Some matrices are not meant to be typeset.

You have specifically mentioned not to fiddle with the right part but I can't see any special treatment as white spaces are gobbled in the math mode and you have enabled it via matrix of math nodes.

Anyway, here is an idea.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}

\begin{document}
We regret to state that we can not publish the following matrix in any journal in its current state. We
encourage the authors leave these all behind.

$$\begin{pmatrix} \begin{tikzpicture}[every node/.style={minimum width=1.5em}] \matrix (m1) [matrix of math nodes] { 0 & 0 & A & A' \\ 0 & 0 & B' & B \\ C & C' & 0 & 0 \\ D' & D & 0 & 0 \\ }; \matrix (m2) at (m1-4-4.south east) [anchor=m2-1-1.north west, matrix of math nodes] { 0 & 0 & K & K' \\ 0 & 0 & L' & L \\ M & M' & 0 & 0 \\ N' & N & 0 & 0 \\ }; \node[scale=2] at (m1 |- m2) {0}; \node[scale=2,anchor=west] (kron) at ([xshift=-5mm]m2.east) {\otimes T}; \node[scale=2] at (m1 -| m2-1-4) {0}; \matrix (m3) at ([xshift=5pt]kron.east |- m1-1-4.north east) [matrix of math nodes,anchor=m3-1-1.north west] { A' & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & B' & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & C' & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & D' & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & E' & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & ASD' & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & H & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & G & I'0\\ }; \draw (m1-1-4.north east) -- (m1-1-4.north east |- m2-4-1.south west); \draw (m1-1-4.north east -| m3.west) -- (m3.west |- m3-8-1.south east); \draw (m1-4-1.south west) -- (m3-4-9.south east); \end{tikzpicture} \end{pmatrix}$$
\end{document}