Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

enter image description here

\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}
share|improve this question
    
In the tensor product, you want to indicate the product of T and exactly what part? –  Gonzalo Medina Sep 18 '12 at 22:33
    
There is a square antidiagonal matrix, {{0 & 0& K & K'},{0 & 0 & L' & L},{M & M' & 0 &0},{N' & N & 0 & 0}} (just the matrix that remains in the red rectangle by forgetting the T) and all this matrix is tensorially multiplied by T. So, perhaps if I just could lower the \otimes T a little without modifying other rows...? or make some brackets that imply that it is all the matrix which it's been multiplied by T? –  c.p. Sep 18 '12 at 23:01

2 Answers 2

up vote 9 down vote accepted

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{equation}
\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{equation}
\end{document}

enter image description here

share|improve this answer
    
OK, that is really helpful. And yes, I understand it's better to specify the matrix by smaller blocks. It's for a beamer; I actually want to convince that I have to dramatically abuse of notation, in order not to see this ugly expressions all time. Thanks again! –  c.p. Sep 18 '12 at 23:37
    
@JorgeCampos My pleasure. I also know that sometimes ugly solution is the most pragmatic solution. –  percusse Sep 18 '12 at 23:41
    
@percusse Can you explain a bit how the positioning of the three \node commands does what it does? For example, the at (m1 |- m2). –  lpdbw Jul 24 '13 at 12:06

I just introduced three minor changes, but I think they contribute to improve the aspect: the blue vertical dashed line it's now really vertical; I moved the tensor product with T down so as to imply product with all the block to its left; I used {}\otimes T to get the proper spacing around \otimes.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath}
\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' & \phantom{00} & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  L'  & L  & & 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-5-4.north east -| mymatrix-1-4.south east);
\draw[red,dashed] (mymatrix-4-4.south east) -- (mymatrix-4-10.south west);
\draw[red,dashed] ([xshift=3pt]mymatrix-5-4.north east) -- ([xshift=3pt]mymatrix-8-4.south east); 
\draw[red,dashed] (mymatrix-4-10.south west) -- (mymatrix-8-10.south west);
\draw[red,dashed] ([xshift=3pt]mymatrix-8-4.south east) -- (mymatrix-8-10.south west);
\node[xshift=8pt] at (mymatrix-6-8.south east) {${}\otimes T$};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
this is nice as well! thank you. It really improved. –  c.p. Sep 18 '12 at 23:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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