1

I am trying to typeset an equation involving multiple lines of matrices with 'annotations' that identify the rows / columns that certain entries appear in. My fairly shambolic effort (which hopefully at least indicates what I'm going for) is shown below, but given that:

  1. the spaces between each line are far too large; and
  2. the code as a whole is really messy,

I'm sure there must be a far better, neater way of doing this using techniques I'm unaware of.

Does anyone have recommendations for (most importantly) how to reduce the spaces between the different lines and (more generally) improve the overall presentation? Any help, as always, greatly appreciated.

My mediocre attempt...

\documentclass[10pt,a4paper,twoside]{article}

\usepackage{color,amsmath}
\definecolor{gray}{gray}{.5}

\begin{document}
\begin{align*}
E_{ik}(b_{ij}a_{kl}^{-1})AE_{lj} & = 
\begin{array}{l} \color{gray} \phantom{\vdots} \\ \color{gray} 
\phantom{\vdots} \\ \scriptstyle \color{gray} i \phantom{\vdots} \\ 
\phantom{\vdots} \\ \phantom{\vdots} \\ \scriptstyle \color{gray} \end{array} 
\! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \!
\bordermatrix{
& & {\scriptstyle \color{gray} k} & \cr
& 0 & \color{gray} \scriptstyle \vdots & 0 \cr
\phantom{XX} & \color{gray} \scriptstyle \cdots & b_{ij}a_{kl}^{-1} & 
\phantom{XX} \cr
& & & \cr
& 0 & & 0 }
\left( \begin{array}{ccc} a_{11} & \cdots & a_{1n} \\ \vdots & & \vdots \\ 
a_{n1} & \cdots & a_{nn} \end{array} \right)
\! \! \! \! \! \! \! \! \! \! \! \! \! \! \bordermatrix{
& & {\scriptstyle \color{gray} l} & \cr
& 0 & \color{gray} \scriptstyle \vdots & 0 \cr
& & \color{gray} \scriptstyle \vdots & \cr
\phantom{XX} & \phantom{XX} & 1 & \color{gray} \scriptstyle \cdots \cr
& 0 & & 0 } \! 
\begin{array}{l} \color{gray} \phantom{\scriptstyle \vdots} \\ \color{gray} 
\phantom{\scriptstyle \vdots} \\ \phantom{\scriptstyle \vdots} \\ \scriptstyle 
\color{gray} j \phantom{\vdots}  \\ \phantom{\vdots} \\ \scriptstyle 
\color{gray} \end{array} \\
& = 
\begin{array}{l} \color{gray} \phantom{\vdots} \\ \color{gray} 
\phantom{\vdots} \\ \scriptstyle \color{gray} i \phantom{\vdots} \\ 
\phantom{\vdots} \\ \phantom{\vdots} \\ \scriptstyle \color{gray} \end{array} 
\! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \!
\bordermatrix{
& & {\scriptstyle \color{gray} k} & \cr
& 0 & \color{gray} \scriptstyle \vdots & 0 \cr
\phantom{XX} & \color{gray} \scriptstyle \cdots & b_{ij}a_{kl}^{-1} & 
\phantom{XX} \cr
& & & \cr
& 0 & & 0 }
\! \! \! \! \! \! \! \! \! \! \! \! \! \! \bordermatrix{
& & {\scriptstyle \color{gray} j} & \cr
& & a_{1l} & \cr
& 0 & \vdots & 0 \cr
\phantom{XX} & \phantom{XX} & a_{nl} & \cr} \\
& = 
\begin{array}{l} \color{gray} \phantom{\vdots} \\ \color{gray} 
\phantom{\vdots} \\ \scriptstyle \color{gray} i \phantom{\vdots} \\ 
\phantom{\vdots} \\ \phantom{\vdots} \\ \scriptstyle \color{gray} \end{array} 
\! \! \! \! \! \! \! \! \! \! \! \! \! \! \! \!
\bordermatrix{
& & {\scriptstyle \color{gray} j} & \cr
& 0 & \color{gray} \scriptstyle \vdots & 0 \cr
\phantom{XX} & \color{gray} \scriptstyle \cdots & b_{ij} & \phantom{XX} \cr
& & & \cr
& 0 & & 0 } \\
& = E_{ij}(b_{ij})
\end{align*}
\end{document}
  • ! LaTeX Error: Environment align* undefined., ! Undefined control sequence. l.5 \begin{array}{l} \color – David Carlisle Mar 10 '18 at 18:16
3

something like this perhaps, i just do the first row here

enter image description here

\documentclass[10pt,a4paper,twoside]{article}
\usepackage{color,mathtools}
\definecolor{gray}{gray}{.5}
\newcommand\Ldots[1]{\phantom\vdots\mathclap{\color{gray}#1\quad\cdots\quad}}
\newcommand\Rdots[1]{\mathrlap{\color{gray}\!\cdots\quad#1}\phantom\vdots}
\newcommand\Vdots[1]{\mathclap{\color{gray}\smash{%
    \begin{array}[b]{@{}c@{}}#1\\[-3pt]\vdots\end{array}}}}
\begin{document}
\begin{align*}
E_{ik}(b_{ij}a_{kl}^{-1})AE_{1j} & = 
\quad\begin{pmatrix}
 0 & \Vdots{j} & 0 \\
\Ldots{i} & b_{ij}a_{kl}^{-1} & \\ 
 0 & & 0
\end{pmatrix}
\begin{pmatrix}
a_{11}& \cdots& a_{1n} \\
\vdots&&\vdots\\
a_{n1} & \cdots & a_{nn} 
\end{pmatrix} 
\begin{pmatrix}
a_{11}& \Vdots{l}& a_{1n} \\
&1&\Rdots{j}\\
a_{n1} &  & a_{nn} 
\end{pmatrix} 
\\
\end{align*}
\end{document}
| improve this answer | |
  • David, thanks so much - that's far better. Have posted full version for completeness. – Rob Harness Mar 11 '18 at 16:12
1

With thanks to @DavidCarlisle, full updated version as follows. Updated version

\documentclass[10pt,a4paper,twoside]{article}
\usepackage{color,mathtools}
\definecolor{gray}{gray}{.5}
\newcommand\Ldots[1]{\phantom\vdots\mathclap{\color{gray}{\scriptstyle 
#1}\quad\cdots\quad}}
\newcommand\Rdots[1]
{\mathrlap{\color{gray}\!\cdots\quad\scriptstyle#1}\phantom\vdots}
\newcommand\Vdots[1]{\mathclap{\color{gray}\smash{%
    \begin{array}[b]{@{}c@{}}\scriptstyle#1\\[-3pt]\vdots\end{array}}}}
\newcommand\Vtag[2]{\mathclap{\color{gray}\smash{%
    \begin{array}[b]{@{}c@{}}\scriptstyle#1\\
[-3pt]\color{black}\vphantom{\vdots}#2\end{array}}}}
\begin{document}
\begin{align*}
E_{ik}(b_{ij}a_{kl}^{-1})AE_{lj} & = 
\quad
\begin{pmatrix}
0 & \Vdots{j} & 0 \\
\Ldots{i} & b_{ij}a_{kl}^{-1} & \\ 
0 & & 0
\end{pmatrix}
\begin{pmatrix}
a_{11}& \cdots& a_{1n} \\
\vdots&&\vdots\\
a_{n1} & \cdots & a_{nn} 
\end{pmatrix} 
\begin{pmatrix}
a_{11}& \Vdots{l}& a_{1n} \\
&1&\Rdots{j}\\
a_{n1} &  & a_{nn} 
\end{pmatrix} \\[15pt]
& =
\quad
\begin{pmatrix}
0 & \Vdots{j} & 0 \\
\Ldots{i} & b_{ij}a_{kl}^{-1} & \\ 
0 & & 0
\end{pmatrix}
\begin{pmatrix}
& \Vtag{l}{a_{1l}} & \\
0 & \vdots & 0 \\
& a_{nl} & 
\end{pmatrix} \\[15pt]
& =
\quad
\begin{pmatrix}
0 & \Vdots{j} & 0 \\
\Ldots{i} & b_{ij} & \\ 
0 & & 0
\end{pmatrix} \\
& = E_{ij}(b_{ij})
\end{align*}
\end{document}
| improve this answer | |

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.