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 would like to illustrate the structure of two matrices, but unfortunately they become hard to read very quickly. This is because its entries' expressions grow with every line.

The equation looks as follows:

Matrix structure

An MWE is:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\begin{multline}
    \underbracket[0pt][0pt]{%
    \begin{pmatrix}
        \mathbf{x}(0) \\
        \mathbf{x}(1) \\
        \mathbf{x}(2) \\
        \vdots \\
        \mathbf{x}(N) 
    \end{pmatrix}
}_{\mathbf{X}}
    = 
    \underbracket[0pt][0pt]{%
    \begin{bmatrix} 
        \eyezero  &     &        &         &  \\
                  & A_0 &        &         &  \\
                  &     & A_1A_0 &         &  \\
                  &     &        & \ddots  &  \\
                  &     &        &         & A_{N-1}A_{N-2}\cdots A_0
    \end{bmatrix} 
}_{S_x}
\underbracket[0pt][0pt]{%
    \begin{pmatrix} 
        \mathbf{x}_0 \\
        \mathbf{x}_0 \\
        \mathbf{x}_0 \\
        \vdots \\
        \mathbf{x}_0 
    \end{pmatrix}
}_{\mathbf{X}_0} \cdots \\*
\hspace*{6em}
    \cdots+ 
    \underbracket[0pt][0pt]{%
        \begin{bmatrix*}[r]
        \zermzero                         &             &        &        & \\
        B_0                               &             &        &        & \\
        A_1 B_0                           & B_{1}       &        &        & \\
        A_2 A_1 B_0                       & A_{2} B_{1} & B_{3}  &        & \\
        \vdots                            & \vdots      & \vdots & \ddots & \\
        A_{N-1}A_{N-2} \cdots A_{1} B_{0} & \cdots      & \cdots & \cdots & B_{N-1} \\
    \end{bmatrix*} 
}_{S_u}
\underbracket[0pt][0pt]{%
    \begin{pmatrix}
        \mathbf{u}(0) \\
        \mathbf{u}(1) \\
        \mathbf{u}(2) \\
        \vdots \\
        \mathbf{u}(N-1)
    \end{pmatrix} 
}_{\mathbf{U}}
\end{multline}

\end{document}

Do you have any idea how I can improve the readability of this equation with the tools available in LaTeX?

share|improve this question
    
    
@Manuel, it's Minion Pro with its math counterpart Minion Math. –  Ingo May 2 at 15:18
1  
@Ingo: Maybe you could comment on cbento's suggested approach, so that they have the chance to improve it (since you don't seem to be satisfied with it)? –  Jake May 14 at 8:43
    
Should'nt B_3 be B_2? –  JLDiaz May 14 at 10:33
    
@JLDiaz yes indeed, that is is a mistake. –  Ingo May 16 at 13:03

3 Answers 3

up vote 6 down vote accepted
+100

Update: I had got wrong the matrices structure, I modified the code and the figures and I think it is right now.

One idea is to use TikZ to typeset those matrices, and use its drawing facilities to graphically highlight the structure. For example, for the first matrix:

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

\begin{document}
\begin{equation*}
\begin{pmatrix} x(0)
\\ x(1)
\\ x(2)
\\ \vdots 
\\ x(N)

\end{pmatrix} = \vcenter{\hbox{\tikz[]{
\matrix[matrix of math nodes, ampersand replacement=\&,
left delimiter={[}, right delimiter={]}, row sep=0pt, 
nodes={inner sep=2pt}] (M) {
  I \&  \&  \&  \&  \&   \\ 
    \&  A_0 \&  \&  \&  \&   \\ 
    \&  \&  A_1 A_0 \&  \&  \& \\ 
    \&  \&  \& \ddots  \&   \& \\ 
    \&  \&  \&  \& A_{N-1} A_{N-2} \cdots A0 \\
}; 
\fill[orange, opacity=0.2, rounded corners]
  (M-1-1.north west) -- (M-1-1.north east) -- (M-5-5.north east) 
--(M-5-5.south east) -- (M-5-5.south west) -- (M-1-1.south west)
--cycle;
}}} \begin{pmatrix} x(0)
\\ x(0)
\\ x(0)
\\ \vdots 
\\ x(0)
\end{pmatrix} \cdots 
\end{equation*}     
\end{document}

Gives:

Result

One possibilty for the second matrix:

\begin{equation*}
\cdots + \vcenter{\hbox{\tikz[]{
\matrix[matrix of math nodes, ampersand replacement=\&,
left delimiter={[}, right delimiter={]}, row sep=0pt, 
nodes={inner sep=2pt}, 
column 1/.style={minimum width=9em},
column 2/.style={minimum width=4em},
column 3/.style={minimum width=4em},
column sep=2pt,
] (M) {
 0 \&  \&  \&  \& \\ 
 B_0 \&  \&  \&  \& \\ 
 A_1B_0 \& B_1 \&  \&  \& \\ 
 A_2A_1B_0 \& A_2B_1 \& B_3 \&  \& \\ 
 \vdots   \&  \vdots  \&  \vdots  \&  \ddots  \& \\ 
 A_{N-1} A_{N-2} \cdots A_1B_0 \& \cdots \& \cdots  \&  \cdots \& B_{N-1} \\
};
\fill[orange, opacity=0.2, rounded corners]
 (M-1-1.north west) rectangle (M-6-1.south east);
\fill[orange, opacity=0.2, rounded corners]
 (M-3-2.north west) rectangle (M-6-2.south east);
\fill[orange, opacity=0.2, rounded corners]
 (M-4-3.north west) rectangle (M-6-3.south east);
\draw[line cap=round, draw opacity=0.2, yellow!70!green, line width=3ex, shorten >=-1ex, shorten <=-1ex]
 (M-2-1.center) to[bend left=15] (M-6-5.center);
}}} \begin{pmatrix} u(0)
 \\ u(1)
 \\ u(2)
 \\ \vdots
 \\ u(N-1)
 \end{pmatrix}
 \end{equation*}

Gives:

Second matrix

Update. A different approach for the second matrix:

\begin{equation*}
\cdots + \vcenter{\hbox{\tikz[]{
\matrix[matrix of nodes, ampersand replacement=\&,
left delimiter={[}, right delimiter={]}, row sep=0pt, 
nodes={inner sep=2pt, align=right}, 
column 1/.style={text width=9em},
column 2/.style={text width=4em},
column 3/.style={text width=4em},
row 6/.style={minimum height=3ex},
column sep=2pt,
] (M) {
 $0$ \\
 $B_0$ \\
 $A_1B_0$ \& $B_1$ \\
 $A_2A_1B_0$ \& $A_2B_1$ \& $B_3$ \\
 $\vdots$   \&  $\vdots$  \&  $\vdots$  \&  $\ddots$  \\ 
 $A_{N-1} A_{N-2} \cdots A_1B_0$ \& $\cdots$ \& $\cdots$  \&  $\cdots$ \& $B_{N-1}$ \\
};
\fill[orange, opacity=0.2, rounded corners]
 (M-1-1.north west) rectangle (M-6-1.south east);
\fill[orange, opacity=0.2, rounded corners]
 (M-3-2.north west) rectangle (M-6-2.south east);
\fill[orange, opacity=0.2, rounded corners]
 (M-4-3.north west) rectangle (M-6-3.south east);
\fill[orange, opacity=0.2, rounded corners]
 (M-6-5.north west) rectangle (M-6-5.south east);
}}} \begin{pmatrix} u(0)
 \\ u(1)
 \\ u(2)
 \\ \vdots
 \\ u(N-1)
 \end{pmatrix}
 \end{equation*} 

gives:

Variant

share|improve this answer
    
I really like your use of TikZ here. I think I'll go for this solution, thanks! –  Ingo May 16 at 13:07

One thing you could try is to split the matrix structure into different equation environments.

You could also omit the numbering in all equation environments, except the last one, so it is easier to understand that the various segments are part of only one equation.

\documentclass{article}

\usepackage{amsmath}
\begin{document}

\begin{equation*}
\begin{pmatrix} x(0)
\\ x(1)
\\ x(2)
\\ \vdots 
\\ x(N)

\end{pmatrix} = \begin{bmatrix}
I &  &  &  &  &  &  & \\ 
&  A_0&  &  &  &  &  & \\ 
&  &  A_1 A_0 &  &  &  &  & \\ 
&  &  & \ddots  &  &  &  & \\ 
&  &  &  & A_{N-1} A_{N-2} &  \cdots &  A0
\end{bmatrix} \begin{pmatrix} x(0)
\\ x(0)
\\ x(0)
\\ \vdots 
\\ x(0)

\end{pmatrix} \cdots 
\end{equation*}

\begin{equation*}
\cdots + \begin{bmatrix}
 &  & 0 &  &  &  & \\ 
 &  & B_0 &  &  &  & \\ 
 &  & A_1B_0 & B_1 &  &  & \\ 
 &  &  A_2A_1B_0 & A_2B_1 & B_3 &  & \\ 
 &  & \vdots   &  \vdots  &  \vdots  &  \ddots  & \\ 
 A_{N-1} A_{N-2} &  \cdots &  A_1B_0 & \cdots & \cdots  &  \cdots & B_{N-1}
 \end{bmatrix} \begin{pmatrix} u(0)
 \\ u(1)
 \\ u(2)
 \\ \vdots
 \\ u(N-1)

 \end{pmatrix}
 \end{equation*}
 \end{document}

Visually, it is similar to your WE, but its now segmented:

enter image description here

Also, if you wan to refer to specific segments of the matrix structure later on in the text, you could add a labels to the equation environments:

\begin{equation*}\label{part1}
share|improve this answer
    
This does look nicer, although it uses even more space. Thanks! –  Ingo May 16 at 13:06

This is maybe not what you are after, but I would rather introduce a notation to shorten the matrix entries. E.g. defining

\bar{A}_i^j=\prod_{k=i}^j A_k

would allow to have nearly constant-width columns. Also, I cannot guess what the dots below $A_2 B_1$ and $B_3$ (typo for $B_2$ in this one?) in $S_u$ actually contain.

share|improve this answer
    
you probably want \Pi_{k=i}. And I would never use such notation, but that's probably a matter of taste. I would keep with \hat{A}_{N,n} = A_N A_{N-1}\dots A_{n+1}A_n. –  tohecz May 14 at 11:46
    
@tohecz: thanks for the correction. The style of the new variable is up to the author of the document, this is just an example. Having subscript and superscript allows a more compact matrix, that's why I offered it, depending on the context it may be unwelcome – or not. –  Joce May 14 at 11:51
    
This is a nice proposal. However, I already show that exact same equation before this and then stack it up to a matrix, so I would rather like to write it out at this point. –  Ingo May 16 at 13:06
    
@Ingo: The choice of course depends on the context. As you note, the eye understands a matrix because of its grid-like arrangement, which is lost when elements have very different sizes. So one has to make a trade-off between the gain of matrix clarity and the loss of introducing notations. –  Joce May 16 at 13:37

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.